diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml new file mode 100644 index 0000000..d0789fa --- /dev/null +++ b/.github/workflows/test-pr.yml @@ -0,0 +1,52 @@ +name: Test PR + +on: + pull_request: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +env: + BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} + BW_USERNAME: ${{ secrets.BW_USERNAME }} + BW_PASSWORD: ${{ secrets.BW_PASSWORD }} + BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }} + BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }} + BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }} + BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }} + 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 }} + MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }} + MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }} + MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }} + MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }} + +jobs: + test: + name: Test PR + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-2022, windows-2025, ubuntu-22.04, ubuntu-24.04] + php-version: [8.2, 8.3, 8.4, 8.5] + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + + - name: Install Packages and Test + run: | + npm install -g @stoplight/prism-cli + composer install + prism mock ./bandwidth.yml & (sleep 4; ./vendor/bin/phpunit tests/Unit) + shell: bash diff --git a/.github/workflows/test-smoke.yml b/.github/workflows/test-smoke.yml new file mode 100644 index 0000000..44550a5 --- /dev/null +++ b/.github/workflows/test-smoke.yml @@ -0,0 +1,88 @@ +name: Smoke Tests + +on: + schedule: + - cron: "0 4 * * *" + pull_request: + paths: + - "spec/smoke/*" + - ".github/workflows/test-smoke.yml" + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +env: + BW_USERNAME: ${{ secrets.BW_USERNAME }} + BW_PASSWORD: ${{ secrets.BW_PASSWORD }} + BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }} + BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }} + BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }} + BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }} + USER_NUMBER: ${{ secrets.USER_NUMBER }} + BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }} + MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }} + +jobs: + test: + name: Smoke Test + runs-on: ubuntu-latest + env: + BW_NUMBER: ${{ secrets.BW_NUMBER }} + BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} + BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }} + BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }} + MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }} + MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }} + MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }} + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.5 + + - name: Install Packages and Test + run: | + composer install + ./vendor/bin/phpunit tests/Smoke + + test_up: + name: Smoke Test UP Account + runs-on: ubuntu-latest + env: + BW_NUMBER: ${{ secrets.BW_UP_NUMBER }} + BW_ACCOUNT_ID: ${{ secrets.BW_UP_ACCOUNT_ID }} + BW_VOICE_APPLICATION_ID: ${{ secrets.BW_UP_VOICE_APPLICATION_ID }} + BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_UP_MESSAGING_APPLICATION_ID }} + MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_UP_ACTIVE_NUMBER }} + MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_UP_IDLE_NUMBER }} + MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_UP_APPLICATION_ID }} + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.5 + + - name: Install Packages and Test + run: | + composer install + ./vendor/bin/phpunit tests/Smoke + + notify_for_failures: + name: Notify for Failures + needs: [test, test_up] + if: failure() + runs-on: ubuntu-latest + steps: + - name: Notify Slack of Failures + uses: Bandwidth/build-notify-slack-action@v2 + with: + job-status: failure + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + slack-channel: ${{ secrets.SLACK_CHANNEL }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 669c386..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Test - -on: - schedule: - - cron: "0 4 * * *" - pull_request: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref }} - cancel-in-progress: true - -jobs: - test: - name: Test - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-2022, windows-2025, ubuntu-22.04, ubuntu-24.04] - php-version: [8.0, 8.1, 8.2, 8.3, 8.4] - steps: - - name: Checkout - uses: actions/checkout@v5 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - - - name: Install Packages - run: composer install - - - name: Test - env: - BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} - BW_USERNAME: ${{ secrets.BW_USERNAME }} - BW_PASSWORD: ${{ secrets.BW_PASSWORD }} - 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 }} - run: ./vendor/bin/phpunit tests diff --git a/.gitignore b/.gitignore index 8cb8bd3..cc2a4bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,19 @@ -# PHP Dev Resources -vendor +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore + +composer.phar +/vendor/ + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# makes sense since it's a library(client SDK) and not a project composer.lock + +# php-cs-fixer cache +.php_cs.cache +.php-cs-fixer.cache + +# PHPUnit cache .phpunit.result.cache -composer.phar -.idea + +# PHPLint cache +build/phplint.cache diff --git a/.gitkeep b/.gitkeep deleted file mode 100644 index 3d865cb..0000000 --- a/.gitkeep +++ /dev/null @@ -1,4 +0,0 @@ -README.md -src/Voice/Bxml/* -src/WebRtc/Utils/* -tests/* diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# 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 + +# 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 0000000..7272a80 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,438 @@ +.gitignore +.php-cs-fixer.dist.php +.phplint.yml +.travis.yml +README.md +composer.json +docs/Api/CallsApi.md +docs/Api/ConferencesApi.md +docs/Api/EndpointsApi.md +docs/Api/MFAApi.md +docs/Api/MediaApi.md +docs/Api/MessagesApi.md +docs/Api/MultiChannelApi.md +docs/Api/PhoneNumberLookupApi.md +docs/Api/RecordingsApi.md +docs/Api/StatisticsApi.md +docs/Api/TollFreeVerificationApi.md +docs/Api/TranscriptionsApi.md +docs/Model/AccountStatistics.md +docs/Model/AdditionalDenialReason.md +docs/Model/Address.md +docs/Model/AnswerCallback.md +docs/Model/AsyncLookupRequest.md +docs/Model/BlockedWebhook.md +docs/Model/BridgeCompleteCallback.md +docs/Model/BridgeTargetCompleteCallback.md +docs/Model/BrtcError.md +docs/Model/BrtcErrorResponse.md +docs/Model/BrtcErrorSource.md +docs/Model/BrtcLink.md +docs/Model/BusinessEntityTypeEnum.md +docs/Model/BusinessRegistrationTypeEnum.md +docs/Model/CallDirectionEnum.md +docs/Model/CallRecordingMetadata.md +docs/Model/CallState.md +docs/Model/CallStateEnum.md +docs/Model/CallTranscription.md +docs/Model/CallTranscriptionDetectedLanguageEnum.md +docs/Model/CallTranscriptionMetadata.md +docs/Model/CallTranscriptionResponse.md +docs/Model/CallTranscriptionTrackEnum.md +docs/Model/Callback.md +docs/Model/CallbackMethodEnum.md +docs/Model/CardWidthEnum.md +docs/Model/CodeRequest.md +docs/Model/CompletedLookupStatusEnum.md +docs/Model/Conference.md +docs/Model/ConferenceCompletedCallback.md +docs/Model/ConferenceCreatedCallback.md +docs/Model/ConferenceMember.md +docs/Model/ConferenceMemberExitCallback.md +docs/Model/ConferenceMemberJoinCallback.md +docs/Model/ConferenceRecordingAvailableCallback.md +docs/Model/ConferenceRecordingMetadata.md +docs/Model/ConferenceRedirectCallback.md +docs/Model/ConferenceStateEnum.md +docs/Model/Contact.md +docs/Model/CreateAsyncBulkLookupResponse.md +docs/Model/CreateAsyncBulkLookupResponseData.md +docs/Model/CreateCall.md +docs/Model/CreateCallResponse.md +docs/Model/CreateEndpointRequestBase.md +docs/Model/CreateEndpointResponse.md +docs/Model/CreateEndpointResponseData.md +docs/Model/CreateMessageRequestError.md +docs/Model/CreateMultiChannelMessageResponse.md +docs/Model/CreateSyncLookupResponse.md +docs/Model/CreateSyncLookupResponseData.md +docs/Model/CreateWebRtcConnectionRequest.md +docs/Model/DeactivationEventEnum.md +docs/Model/Device.md +docs/Model/DeviceStatusEnum.md +docs/Model/DisconnectCallback.md +docs/Model/Diversion.md +docs/Model/DtmfCallback.md +docs/Model/Endpoint.md +docs/Model/EndpointDirectionEnum.md +docs/Model/EndpointEvent.md +docs/Model/EndpointEventTypeEnum.md +docs/Model/EndpointResponse.md +docs/Model/EndpointStatusEnum.md +docs/Model/EndpointTypeEnum.md +docs/Model/Endpoints.md +docs/Model/ErrorObject.md +docs/Model/ErrorSource.md +docs/Model/FailureWebhook.md +docs/Model/FieldError.md +docs/Model/FileFormatEnum.md +docs/Model/GatherCallback.md +docs/Model/GetAsyncBulkLookupResponse.md +docs/Model/GetAsyncBulkLookupResponseData.md +docs/Model/InProgressLookupStatusEnum.md +docs/Model/InboundCallback.md +docs/Model/InboundCallbackMessage.md +docs/Model/InboundCallbackTypeEnum.md +docs/Model/InitiateCallback.md +docs/Model/LatestMessageDeliveryStatusEnum.md +docs/Model/LineTypeEnum.md +docs/Model/Link.md +docs/Model/LinkSchema.md +docs/Model/LinksObject.md +docs/Model/ListEndpointsResponse.md +docs/Model/ListMessageDirectionEnum.md +docs/Model/ListMessageItem.md +docs/Model/LookupErrorResponse.md +docs/Model/LookupErrorSchema.md +docs/Model/LookupErrorSchemaMeta.md +docs/Model/LookupResult.md +docs/Model/MachineDetectionCompleteCallback.md +docs/Model/MachineDetectionConfiguration.md +docs/Model/MachineDetectionModeEnum.md +docs/Model/MachineDetectionResult.md +docs/Model/Media.md +docs/Model/Message.md +docs/Model/MessageDirectionEnum.md +docs/Model/MessageRequest.md +docs/Model/MessageStatusEnum.md +docs/Model/MessageTypeEnum.md +docs/Model/MessagesList.md +docs/Model/MessagingCodeResponse.md +docs/Model/MessagingRequestError.md +docs/Model/MfaForbiddenRequestError.md +docs/Model/MfaRequestError.md +docs/Model/MfaUnauthorizedRequestError.md +docs/Model/MmsMessageContent.md +docs/Model/MmsMessageContentFile.md +docs/Model/MultiChannelAction.md +docs/Model/MultiChannelActionCalendarEvent.md +docs/Model/MultiChannelChannelListMMSObject.md +docs/Model/MultiChannelChannelListMMSResponseObject.md +docs/Model/MultiChannelChannelListObjectBase.md +docs/Model/MultiChannelChannelListOwnerObject.md +docs/Model/MultiChannelChannelListRBMObject.md +docs/Model/MultiChannelChannelListRBMObjectAllOfContent.md +docs/Model/MultiChannelChannelListRBMResponseObject.md +docs/Model/MultiChannelChannelListRequestObject.md +docs/Model/MultiChannelChannelListResponseObject.md +docs/Model/MultiChannelChannelListSMSObject.md +docs/Model/MultiChannelChannelListSMSResponseObject.md +docs/Model/MultiChannelError.md +docs/Model/MultiChannelMessageChannelEnum.md +docs/Model/MultiChannelMessageContent.md +docs/Model/MultiChannelMessageRequest.md +docs/Model/MultiChannelMessageResponseData.md +docs/Model/OptInWorkflow.md +docs/Model/Page.md +docs/Model/PageInfo.md +docs/Model/PriorityEnum.md +docs/Model/ProductTypeEnum.md +docs/Model/RbmActionBase.md +docs/Model/RbmActionDial.md +docs/Model/RbmActionOpenUrl.md +docs/Model/RbmActionTypeEnum.md +docs/Model/RbmActionViewLocation.md +docs/Model/RbmCardContent.md +docs/Model/RbmCardContentMedia.md +docs/Model/RbmLocationResponse.md +docs/Model/RbmMediaHeightEnum.md +docs/Model/RbmMessageCarouselCard.md +docs/Model/RbmMessageContentFile.md +docs/Model/RbmMessageContentRichCard.md +docs/Model/RbmMessageContentText.md +docs/Model/RbmMessageMedia.md +docs/Model/RbmOpenUrlEnum.md +docs/Model/RbmStandaloneCard.md +docs/Model/RbmSuggestionResponse.md +docs/Model/RbmWebViewEnum.md +docs/Model/RecordingAvailableCallback.md +docs/Model/RecordingCompleteCallback.md +docs/Model/RecordingStateEnum.md +docs/Model/RecordingTranscriptionClip.md +docs/Model/RecordingTranscriptionMetadata.md +docs/Model/RecordingTranscriptions.md +docs/Model/RedirectCallback.md +docs/Model/RedirectMethodEnum.md +docs/Model/SipConnectionMetadata.md +docs/Model/SipCredentials.md +docs/Model/SmsMessageContent.md +docs/Model/StandaloneCardOrientationEnum.md +docs/Model/StatusCallback.md +docs/Model/StatusCallbackMessage.md +docs/Model/StatusCallbackTypeEnum.md +docs/Model/StirShaken.md +docs/Model/SyncLookupRequest.md +docs/Model/TelephoneNumber.md +docs/Model/TfvBasicAuthentication.md +docs/Model/TfvCallbackStatusEnum.md +docs/Model/TfvError.md +docs/Model/TfvStatus.md +docs/Model/TfvStatusEnum.md +docs/Model/TfvSubmissionInfo.md +docs/Model/TfvSubmissionWrapper.md +docs/Model/ThumbnailAlignmentEnum.md +docs/Model/TranscribeRecording.md +docs/Model/Transcription.md +docs/Model/TranscriptionAvailableCallback.md +docs/Model/TransferAnswerCallback.md +docs/Model/TransferCompleteCallback.md +docs/Model/TransferDisconnectCallback.md +docs/Model/UpdateCall.md +docs/Model/UpdateCallRecording.md +docs/Model/UpdateConference.md +docs/Model/UpdateConferenceMember.md +docs/Model/VerificationDenialWebhook.md +docs/Model/VerificationRequest.md +docs/Model/VerificationUpdateRequest.md +docs/Model/VerificationWebhook.md +docs/Model/VerifyCodeRequest.md +docs/Model/VerifyCodeResponse.md +docs/Model/VoiceApiError.md +docs/Model/VoiceCodeResponse.md +docs/Model/WebhookSubscription.md +docs/Model/WebhookSubscriptionBasicAuthentication.md +docs/Model/WebhookSubscriptionError.md +docs/Model/WebhookSubscriptionRequestSchema.md +docs/Model/WebhookSubscriptionTypeEnum.md +docs/Model/WebhookSubscriptionsListBody.md +git_push.sh +phpunit.xml.dist +src/Api/CallsApi.php +src/Api/ConferencesApi.php +src/Api/EndpointsApi.php +src/Api/MFAApi.php +src/Api/MediaApi.php +src/Api/MessagesApi.php +src/Api/MultiChannelApi.php +src/Api/PhoneNumberLookupApi.php +src/Api/RecordingsApi.php +src/Api/StatisticsApi.php +src/Api/TollFreeVerificationApi.php +src/Api/TranscriptionsApi.php +src/ApiException.php +src/Configuration.php +src/FormDataProcessor.php +src/HeaderSelector.php +src/Model/AccountStatistics.php +src/Model/AdditionalDenialReason.php +src/Model/Address.php +src/Model/AnswerCallback.php +src/Model/AnyOfInterface.php +src/Model/AsyncLookupRequest.php +src/Model/BlockedWebhook.php +src/Model/BridgeCompleteCallback.php +src/Model/BridgeTargetCompleteCallback.php +src/Model/BrtcError.php +src/Model/BrtcErrorResponse.php +src/Model/BrtcErrorSource.php +src/Model/BrtcLink.php +src/Model/BusinessEntityTypeEnum.php +src/Model/BusinessRegistrationTypeEnum.php +src/Model/CallDirectionEnum.php +src/Model/CallRecordingMetadata.php +src/Model/CallState.php +src/Model/CallStateEnum.php +src/Model/CallTranscription.php +src/Model/CallTranscriptionDetectedLanguageEnum.php +src/Model/CallTranscriptionMetadata.php +src/Model/CallTranscriptionResponse.php +src/Model/CallTranscriptionTrackEnum.php +src/Model/Callback.php +src/Model/CallbackMethodEnum.php +src/Model/CardWidthEnum.php +src/Model/CodeRequest.php +src/Model/CompletedLookupStatusEnum.php +src/Model/Conference.php +src/Model/ConferenceCompletedCallback.php +src/Model/ConferenceCreatedCallback.php +src/Model/ConferenceMember.php +src/Model/ConferenceMemberExitCallback.php +src/Model/ConferenceMemberJoinCallback.php +src/Model/ConferenceRecordingAvailableCallback.php +src/Model/ConferenceRecordingMetadata.php +src/Model/ConferenceRedirectCallback.php +src/Model/ConferenceStateEnum.php +src/Model/Contact.php +src/Model/CreateAsyncBulkLookupResponse.php +src/Model/CreateAsyncBulkLookupResponseData.php +src/Model/CreateCall.php +src/Model/CreateCallResponse.php +src/Model/CreateEndpointRequestBase.php +src/Model/CreateEndpointResponse.php +src/Model/CreateEndpointResponseData.php +src/Model/CreateMessageRequestError.php +src/Model/CreateMultiChannelMessageResponse.php +src/Model/CreateSyncLookupResponse.php +src/Model/CreateSyncLookupResponseData.php +src/Model/CreateWebRtcConnectionRequest.php +src/Model/DeactivationEventEnum.php +src/Model/Device.php +src/Model/DeviceStatusEnum.php +src/Model/DisconnectCallback.php +src/Model/Diversion.php +src/Model/DtmfCallback.php +src/Model/Endpoint.php +src/Model/EndpointDirectionEnum.php +src/Model/EndpointEvent.php +src/Model/EndpointEventTypeEnum.php +src/Model/EndpointResponse.php +src/Model/EndpointStatusEnum.php +src/Model/EndpointTypeEnum.php +src/Model/Endpoints.php +src/Model/ErrorObject.php +src/Model/ErrorSource.php +src/Model/FailureWebhook.php +src/Model/FieldError.php +src/Model/FileFormatEnum.php +src/Model/GatherCallback.php +src/Model/GetAsyncBulkLookupResponse.php +src/Model/GetAsyncBulkLookupResponseData.php +src/Model/InProgressLookupStatusEnum.php +src/Model/InboundCallback.php +src/Model/InboundCallbackMessage.php +src/Model/InboundCallbackTypeEnum.php +src/Model/InitiateCallback.php +src/Model/LatestMessageDeliveryStatusEnum.php +src/Model/LineTypeEnum.php +src/Model/Link.php +src/Model/LinkSchema.php +src/Model/LinksObject.php +src/Model/ListEndpointsResponse.php +src/Model/ListMessageDirectionEnum.php +src/Model/ListMessageItem.php +src/Model/LookupErrorResponse.php +src/Model/LookupErrorSchema.php +src/Model/LookupErrorSchemaMeta.php +src/Model/LookupResult.php +src/Model/MachineDetectionCompleteCallback.php +src/Model/MachineDetectionConfiguration.php +src/Model/MachineDetectionModeEnum.php +src/Model/MachineDetectionResult.php +src/Model/Media.php +src/Model/Message.php +src/Model/MessageDirectionEnum.php +src/Model/MessageRequest.php +src/Model/MessageStatusEnum.php +src/Model/MessageTypeEnum.php +src/Model/MessagesList.php +src/Model/MessagingCodeResponse.php +src/Model/MessagingRequestError.php +src/Model/MfaForbiddenRequestError.php +src/Model/MfaRequestError.php +src/Model/MfaUnauthorizedRequestError.php +src/Model/MmsMessageContent.php +src/Model/MmsMessageContentFile.php +src/Model/ModelInterface.php +src/Model/MultiChannelAction.php +src/Model/MultiChannelActionCalendarEvent.php +src/Model/MultiChannelChannelListMMSObject.php +src/Model/MultiChannelChannelListMMSResponseObject.php +src/Model/MultiChannelChannelListObjectBase.php +src/Model/MultiChannelChannelListOwnerObject.php +src/Model/MultiChannelChannelListRBMObject.php +src/Model/MultiChannelChannelListRBMObjectAllOfContent.php +src/Model/MultiChannelChannelListRBMResponseObject.php +src/Model/MultiChannelChannelListRequestObject.php +src/Model/MultiChannelChannelListResponseObject.php +src/Model/MultiChannelChannelListSMSObject.php +src/Model/MultiChannelChannelListSMSResponseObject.php +src/Model/MultiChannelError.php +src/Model/MultiChannelMessageChannelEnum.php +src/Model/MultiChannelMessageContent.php +src/Model/MultiChannelMessageRequest.php +src/Model/MultiChannelMessageResponseData.php +src/Model/OneOfInterface.php +src/Model/OptInWorkflow.php +src/Model/Page.php +src/Model/PageInfo.php +src/Model/PriorityEnum.php +src/Model/ProductTypeEnum.php +src/Model/RbmActionBase.php +src/Model/RbmActionDial.php +src/Model/RbmActionOpenUrl.php +src/Model/RbmActionTypeEnum.php +src/Model/RbmActionViewLocation.php +src/Model/RbmCardContent.php +src/Model/RbmCardContentMedia.php +src/Model/RbmLocationResponse.php +src/Model/RbmMediaHeightEnum.php +src/Model/RbmMessageCarouselCard.php +src/Model/RbmMessageContentFile.php +src/Model/RbmMessageContentRichCard.php +src/Model/RbmMessageContentText.php +src/Model/RbmMessageMedia.php +src/Model/RbmOpenUrlEnum.php +src/Model/RbmStandaloneCard.php +src/Model/RbmSuggestionResponse.php +src/Model/RbmWebViewEnum.php +src/Model/RecordingAvailableCallback.php +src/Model/RecordingCompleteCallback.php +src/Model/RecordingStateEnum.php +src/Model/RecordingTranscriptionClip.php +src/Model/RecordingTranscriptionMetadata.php +src/Model/RecordingTranscriptions.php +src/Model/RedirectCallback.php +src/Model/RedirectMethodEnum.php +src/Model/SipConnectionMetadata.php +src/Model/SipCredentials.php +src/Model/SmsMessageContent.php +src/Model/StandaloneCardOrientationEnum.php +src/Model/StatusCallback.php +src/Model/StatusCallbackMessage.php +src/Model/StatusCallbackTypeEnum.php +src/Model/StirShaken.php +src/Model/SyncLookupRequest.php +src/Model/TelephoneNumber.php +src/Model/TfvBasicAuthentication.php +src/Model/TfvCallbackStatusEnum.php +src/Model/TfvError.php +src/Model/TfvStatus.php +src/Model/TfvStatusEnum.php +src/Model/TfvSubmissionInfo.php +src/Model/TfvSubmissionWrapper.php +src/Model/ThumbnailAlignmentEnum.php +src/Model/TranscribeRecording.php +src/Model/Transcription.php +src/Model/TranscriptionAvailableCallback.php +src/Model/TransferAnswerCallback.php +src/Model/TransferCompleteCallback.php +src/Model/TransferDisconnectCallback.php +src/Model/UpdateCall.php +src/Model/UpdateCallRecording.php +src/Model/UpdateConference.php +src/Model/UpdateConferenceMember.php +src/Model/VerificationDenialWebhook.php +src/Model/VerificationRequest.php +src/Model/VerificationUpdateRequest.php +src/Model/VerificationWebhook.php +src/Model/VerifyCodeRequest.php +src/Model/VerifyCodeResponse.php +src/Model/VoiceApiError.php +src/Model/VoiceCodeResponse.php +src/Model/WebhookSubscription.php +src/Model/WebhookSubscriptionBasicAuthentication.php +src/Model/WebhookSubscriptionError.php +src/Model/WebhookSubscriptionRequestSchema.php +src/Model/WebhookSubscriptionTypeEnum.php +src/Model/WebhookSubscriptionsListBody.php +src/ObjectSerializer.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..8fc8df6 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.25.0-SNAPSHOT diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..af9cf39 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/.phplint.yml b/.phplint.yml new file mode 100644 index 0000000..ef4be48 --- /dev/null +++ b/.phplint.yml @@ -0,0 +1,11 @@ +path: + - ./src + - ./tests +jobs: 10 +extensions: + - php +exclude: + - vendor +warning: true +memory-limit: -1 +no-cache: true diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..707be2a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: php +# Jammy Jellyfish environment has preinstalled PHP 8.1 +# Focal Fossa doesn't fit since it contains preinstalled PHP 7.4 only +# https://docs.travis-ci.com/user/reference/jammy/#php-support +dist: jammy +os: + - linux +php: + - 8.1 + - 8.2 +before_install: "composer install" +script: "vendor/bin/phpunit" diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 749af7f..0000000 --- a/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -License: -======== -The MIT License (MIT) -http://opensource.org/licenses/MIT - -Copyright (c) 2014 - 2020 APIMATIC Limited - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -Trade Mark: -========== -APIMATIC is a trade mark for APIMATIC Limited \ No newline at end of file diff --git a/README.md b/README.md index c3dbb35..866a9a5 100644 --- a/README.md +++ b/README.md @@ -1,161 +1,376 @@ -# Bandwidth PHP SDK +# Bandwidth SDK -[![Test](https://github.com/Bandwidth/php-sdk/actions/workflows/test.yml/badge.svg)](https://github.com/Bandwidth/php-sdk/actions/workflows/test.yml) +Bandwidth's Communication APIs -| **OS** | **PHP** | -|:------------:|:-----------------------:| -| Windows 2022 | 8.0, 8.1, 8.2, 8.3, 8.4 | -| Windows 2025 | 8.0, 8.1, 8.2, 8.3, 8.4 | -| Ubuntu 22.04 | 8.0, 8.1, 8.2, 8.3, 8.4 | -| Ubuntu 24.04 | 8.0, 8.1, 8.2, 8.3, 8.4 | +For more information, please visit [https://dev.bandwidth.com](https://dev.bandwidth.com). -## Getting Started +## Installation & Usage -### Installation +### Requirements -``` -composer require bandwidth/sdk -``` +PHP 8.1 and later. -### Initialize +### Composer -```php +To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: -require "vendor/autoload.php"; - -$config = new BandwidthLib\Configuration( - array( - 'messagingBasicAuthUserName' => 'username', - 'messagingBasicAuthPassword' => 'password', - 'voiceBasicAuthUserName' => 'username', - 'voiceBasicAuthPassword' => 'password', - 'twoFactorAuthBasicAuthUserName' => 'username', - 'twoFactorAuthBasicAuthPassword' => 'password', - 'webRtcBasicAuthUserName' => 'username', - 'webRtcBasicAuthPassword' => 'password' - ) -); -$client = new BandwidthLib\BandwidthClient($config); -$accountId = "12345"; -``` - -### Create A Phone Call - -```php - -$voiceClient = $client->getVoice()->getClient(); - -$body = new BandwidthLib\Voice\Models\CreateCallRequest(); -$body->from = "+15554443333"; -$body->to = "+15554442222"; -$body->answerUrl = "https://test.com"; -$body->applicationId = "3-d-4-b-5"; - -try { - $response = $voiceClient->createCall($voiceAccountId, $body); - print_r($response); -} catch (Exception $e) { - print_r($e); +```json +{ + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/bandwidth/php-sdk.git" + } + ], + "require": { + "bandwidth/php-sdk": "*@dev" + } } ``` -### Send A Text Message - -```php +Then run `composer install` -$messagingClient = $client->getMessaging()->getClient(); +### Manual Installation -$body = new BandwidthLib\Messaging\Models\MessageRequest(); -$body->from = "+12345678901"; -$body->to = array("+12345678902"); -$body->applicationId = "1234-ce-4567-de"; -$body->text = "Greetings!"; - -try { - $response = $messagingClient->createMessage($messagingAccountId, $body); - print_r($response); -} catch (Exception $e) { - print_r($e); -} -``` - -### Create BXML +Download the files and include `autoload.php`: ```php - -$speakSentence = BandwidthLib\Voice\Bxml\SpeakSentence::make("Hello!") - ->voice("susan") - ->locale("en_US") - ->gender("female"); -$response = BandwidthLib\Voice\Bxml\Response::make() - ->addVerb($speakSentence); -echo $response->toBxml(); +getTwoFactorAuth()->getMFA(); - -$body = new BandwidthLib\TwoFactorAuth\Models\TwoFactorCodeRequestSchema(); -$body->from = "+15554443333"; -$body->to = "+15553334444"; -$body->applicationId = "3-a-b-d"; -$body->scope = "scope"; -$body->digits = 6; -$body->message = "Your temporary {NAME} {SCOPE} code is {CODE}"; -$mfaClient->createVoiceTwoFactor($accountId, $body); - -$body = new BandwidthLib\TwoFactorAuth\Models\TwoFactorVerifyRequestSchema(); -$body->from = "+15554443333"; -$body->to = "+15553334444"; -$body->applicationId = "3-a-b-d"; -$body->scope = "scope"; -$body->code = "123456"; -$body->digits = 6; -$body->expirationTimeInMinutes = 3; - -$response = $mfaClient->createVerifyTwoFactor($accountId, $body); -echo $response->getResult()->valid; -``` +```php +getWebRtc()->getClient(); +// Configure HTTP basic authorization: Basic +$config = Bandwidth\Configuration::getDefaultConfiguration() + ->setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); -$createSessionBody = new BandwidthLib\WebRtc\Models\Session(); -$createSessionBody->tag = 'new-session'; +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); -$createSessionResponse = $webRtcClient->createSession($accountId, $createSessionBody); -$sessionId = $createSessionResponse->getResult()->id; -$createParticipantBody = new BandwidthLib\WebRtc\Models\Participant(); -$createParticipantBody->callbackUrl = 'https://sample.com'; -$createParticipantBody->publishPermissions = array( - BandwidthLib\WebRtc\Models\PublishPermissionEnum::AUDIO, - BandwidthLib\WebRtc\Models\PublishPermissionEnum::VIDEO +$apiInstance = new Bandwidth\Api\CallsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config ); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$create_call = new \Bandwidth\Model\CreateCall(); // \Bandwidth\Model\CreateCall | JSON object containing information to create an outbound call -$body = new BandwidthLib\WebRtc\Models\Subscriptions(); -$body->sessionId = "1234-abcd"; - -$createParticipantResponse = $webRtcClient->createParticipant($accountId, $createParticipantBody); -$participantId = $createParticipantResponse->getResult()->participant->id; +try { + $result = $apiInstance->createCall($account_id, $create_call); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CallsApi->createCall: ', $e->getMessage(), PHP_EOL; +} -$webRtcClient->addParticipantToSession($accountId, $sessionId, $participantId, $body); ``` -## Supported PHP Versions +## API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*CallsApi* | [**createCall**](docs/Api/CallsApi.md#createcall) | **POST** /accounts/{accountId}/calls | Create Call +*CallsApi* | [**getCallState**](docs/Api/CallsApi.md#getcallstate) | **GET** /accounts/{accountId}/calls/{callId} | Get Call State Information +*CallsApi* | [**listCalls**](docs/Api/CallsApi.md#listcalls) | **GET** /accounts/{accountId}/calls | Get Calls +*CallsApi* | [**updateCall**](docs/Api/CallsApi.md#updatecall) | **POST** /accounts/{accountId}/calls/{callId} | Update Call +*CallsApi* | [**updateCallBxml**](docs/Api/CallsApi.md#updatecallbxml) | **PUT** /accounts/{accountId}/calls/{callId}/bxml | Update Call BXML +*ConferencesApi* | [**downloadConferenceRecording**](docs/Api/ConferencesApi.md#downloadconferencerecording) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media | Download Conference Recording +*ConferencesApi* | [**getConference**](docs/Api/ConferencesApi.md#getconference) | **GET** /accounts/{accountId}/conferences/{conferenceId} | Get Conference Information +*ConferencesApi* | [**getConferenceMember**](docs/Api/ConferencesApi.md#getconferencemember) | **GET** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Get Conference Member +*ConferencesApi* | [**getConferenceRecording**](docs/Api/ConferencesApi.md#getconferencerecording) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId} | Get Conference Recording Information +*ConferencesApi* | [**listConferenceRecordings**](docs/Api/ConferencesApi.md#listconferencerecordings) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings | Get Conference Recordings +*ConferencesApi* | [**listConferences**](docs/Api/ConferencesApi.md#listconferences) | **GET** /accounts/{accountId}/conferences | Get Conferences +*ConferencesApi* | [**updateConference**](docs/Api/ConferencesApi.md#updateconference) | **POST** /accounts/{accountId}/conferences/{conferenceId} | Update Conference +*ConferencesApi* | [**updateConferenceBxml**](docs/Api/ConferencesApi.md#updateconferencebxml) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/bxml | Update Conference BXML +*ConferencesApi* | [**updateConferenceMember**](docs/Api/ConferencesApi.md#updateconferencemember) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Update Conference Member +*EndpointsApi* | [**createEndpoint**](docs/Api/EndpointsApi.md#createendpoint) | **POST** /accounts/{accountId}/endpoints | Create Endpoint +*EndpointsApi* | [**deleteEndpoint**](docs/Api/EndpointsApi.md#deleteendpoint) | **DELETE** /accounts/{accountId}/endpoints/{endpointId} | Delete Endpoint +*EndpointsApi* | [**getEndpoint**](docs/Api/EndpointsApi.md#getendpoint) | **GET** /accounts/{accountId}/endpoints/{endpointId} | Get Endpoint +*EndpointsApi* | [**listEndpoints**](docs/Api/EndpointsApi.md#listendpoints) | **GET** /accounts/{accountId}/endpoints | List Endpoints +*EndpointsApi* | [**updateEndpointBxml**](docs/Api/EndpointsApi.md#updateendpointbxml) | **PUT** /accounts/{accountId}/endpoints/{endpointId}/bxml | Update Endpoint BXML +*MFAApi* | [**generateMessagingCode**](docs/Api/MFAApi.md#generatemessagingcode) | **POST** /accounts/{accountId}/code/messaging | Messaging Authentication Code +*MFAApi* | [**generateVoiceCode**](docs/Api/MFAApi.md#generatevoicecode) | **POST** /accounts/{accountId}/code/voice | Voice Authentication Code +*MFAApi* | [**verifyCode**](docs/Api/MFAApi.md#verifycode) | **POST** /accounts/{accountId}/code/verify | Verify Authentication Code +*MediaApi* | [**deleteMedia**](docs/Api/MediaApi.md#deletemedia) | **DELETE** /users/{accountId}/media/{mediaId} | Delete Media +*MediaApi* | [**getMedia**](docs/Api/MediaApi.md#getmedia) | **GET** /users/{accountId}/media/{mediaId} | Get Media +*MediaApi* | [**listMedia**](docs/Api/MediaApi.md#listmedia) | **GET** /users/{accountId}/media | List Media +*MediaApi* | [**uploadMedia**](docs/Api/MediaApi.md#uploadmedia) | **PUT** /users/{accountId}/media/{mediaId} | Upload Media +*MessagesApi* | [**createMessage**](docs/Api/MessagesApi.md#createmessage) | **POST** /users/{accountId}/messages | Create Message +*MessagesApi* | [**listMessages**](docs/Api/MessagesApi.md#listmessages) | **GET** /users/{accountId}/messages | List Messages +*MultiChannelApi* | [**createMultiChannelMessage**](docs/Api/MultiChannelApi.md#createmultichannelmessage) | **POST** /users/{accountId}/messages/multiChannel | Create Multi-Channel Message +*PhoneNumberLookupApi* | [**createAsyncBulkLookup**](docs/Api/PhoneNumberLookupApi.md#createasyncbulklookup) | **POST** /accounts/{accountId}/phoneNumberLookup/bulk | Create Asynchronous Bulk Number Lookup +*PhoneNumberLookupApi* | [**createSyncLookup**](docs/Api/PhoneNumberLookupApi.md#createsynclookup) | **POST** /accounts/{accountId}/phoneNumberLookup | Create Synchronous Number Lookup +*PhoneNumberLookupApi* | [**getAsyncBulkLookup**](docs/Api/PhoneNumberLookupApi.md#getasyncbulklookup) | **GET** /accounts/{accountId}/phoneNumberLookup/bulk/{requestId} | Get Asynchronous Bulk Number Lookup +*RecordingsApi* | [**deleteRecording**](docs/Api/RecordingsApi.md#deleterecording) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Delete Recording +*RecordingsApi* | [**deleteRecordingMedia**](docs/Api/RecordingsApi.md#deleterecordingmedia) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Delete Recording Media +*RecordingsApi* | [**deleteRecordingTranscription**](docs/Api/RecordingsApi.md#deleterecordingtranscription) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Delete Transcription +*RecordingsApi* | [**downloadCallRecording**](docs/Api/RecordingsApi.md#downloadcallrecording) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Download Recording +*RecordingsApi* | [**getCallRecording**](docs/Api/RecordingsApi.md#getcallrecording) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Get Call Recording +*RecordingsApi* | [**getRecordingTranscription**](docs/Api/RecordingsApi.md#getrecordingtranscription) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Get Transcription +*RecordingsApi* | [**listAccountCallRecordings**](docs/Api/RecordingsApi.md#listaccountcallrecordings) | **GET** /accounts/{accountId}/recordings | Get Call Recordings +*RecordingsApi* | [**listCallRecordings**](docs/Api/RecordingsApi.md#listcallrecordings) | **GET** /accounts/{accountId}/calls/{callId}/recordings | List Call Recordings +*RecordingsApi* | [**transcribeCallRecording**](docs/Api/RecordingsApi.md#transcribecallrecording) | **POST** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Create Transcription Request +*RecordingsApi* | [**updateCallRecordingState**](docs/Api/RecordingsApi.md#updatecallrecordingstate) | **PUT** /accounts/{accountId}/calls/{callId}/recording | Update Recording +*StatisticsApi* | [**getStatistics**](docs/Api/StatisticsApi.md#getstatistics) | **GET** /accounts/{accountId}/statistics | Get Account Statistics +*TollFreeVerificationApi* | [**createWebhookSubscription**](docs/Api/TollFreeVerificationApi.md#createwebhooksubscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription +*TollFreeVerificationApi* | [**deleteVerificationRequest**](docs/Api/TollFreeVerificationApi.md#deleteverificationrequest) | **DELETE** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Delete a Toll-Free Verification Submission +*TollFreeVerificationApi* | [**deleteWebhookSubscription**](docs/Api/TollFreeVerificationApi.md#deletewebhooksubscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription +*TollFreeVerificationApi* | [**getTollFreeVerificationStatus**](docs/Api/TollFreeVerificationApi.md#gettollfreeverificationstatus) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status +*TollFreeVerificationApi* | [**listTollFreeUseCases**](docs/Api/TollFreeVerificationApi.md#listtollfreeusecases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases +*TollFreeVerificationApi* | [**listWebhookSubscriptions**](docs/Api/TollFreeVerificationApi.md#listwebhooksubscriptions) | **GET** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | List Webhook Subscriptions +*TollFreeVerificationApi* | [**requestTollFreeVerification**](docs/Api/TollFreeVerificationApi.md#requesttollfreeverification) | **POST** /accounts/{accountId}/tollFreeVerification | Request Toll-Free Verification +*TollFreeVerificationApi* | [**updateTollFreeVerificationRequest**](docs/Api/TollFreeVerificationApi.md#updatetollfreeverificationrequest) | **PUT** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Update Toll-Free Verification Request +*TollFreeVerificationApi* | [**updateWebhookSubscription**](docs/Api/TollFreeVerificationApi.md#updatewebhooksubscription) | **PUT** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Update Webhook Subscription +*TranscriptionsApi* | [**deleteRealTimeTranscription**](docs/Api/TranscriptionsApi.md#deleterealtimetranscription) | **DELETE** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Delete Real-time Transcription +*TranscriptionsApi* | [**getRealTimeTranscription**](docs/Api/TranscriptionsApi.md#getrealtimetranscription) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Get Real-time Transcription +*TranscriptionsApi* | [**listRealTimeTranscriptions**](docs/Api/TranscriptionsApi.md#listrealtimetranscriptions) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions | List Real-time Transcriptions + +## Models + +- [AccountStatistics](docs/Model/AccountStatistics.md) +- [AdditionalDenialReason](docs/Model/AdditionalDenialReason.md) +- [Address](docs/Model/Address.md) +- [AnswerCallback](docs/Model/AnswerCallback.md) +- [AsyncLookupRequest](docs/Model/AsyncLookupRequest.md) +- [BlockedWebhook](docs/Model/BlockedWebhook.md) +- [BridgeCompleteCallback](docs/Model/BridgeCompleteCallback.md) +- [BridgeTargetCompleteCallback](docs/Model/BridgeTargetCompleteCallback.md) +- [BrtcError](docs/Model/BrtcError.md) +- [BrtcErrorResponse](docs/Model/BrtcErrorResponse.md) +- [BrtcErrorSource](docs/Model/BrtcErrorSource.md) +- [BrtcLink](docs/Model/BrtcLink.md) +- [BusinessEntityTypeEnum](docs/Model/BusinessEntityTypeEnum.md) +- [BusinessRegistrationTypeEnum](docs/Model/BusinessRegistrationTypeEnum.md) +- [CallDirectionEnum](docs/Model/CallDirectionEnum.md) +- [CallRecordingMetadata](docs/Model/CallRecordingMetadata.md) +- [CallState](docs/Model/CallState.md) +- [CallStateEnum](docs/Model/CallStateEnum.md) +- [CallTranscription](docs/Model/CallTranscription.md) +- [CallTranscriptionDetectedLanguageEnum](docs/Model/CallTranscriptionDetectedLanguageEnum.md) +- [CallTranscriptionMetadata](docs/Model/CallTranscriptionMetadata.md) +- [CallTranscriptionResponse](docs/Model/CallTranscriptionResponse.md) +- [CallTranscriptionTrackEnum](docs/Model/CallTranscriptionTrackEnum.md) +- [Callback](docs/Model/Callback.md) +- [CallbackMethodEnum](docs/Model/CallbackMethodEnum.md) +- [CardWidthEnum](docs/Model/CardWidthEnum.md) +- [CodeRequest](docs/Model/CodeRequest.md) +- [CompletedLookupStatusEnum](docs/Model/CompletedLookupStatusEnum.md) +- [Conference](docs/Model/Conference.md) +- [ConferenceCompletedCallback](docs/Model/ConferenceCompletedCallback.md) +- [ConferenceCreatedCallback](docs/Model/ConferenceCreatedCallback.md) +- [ConferenceMember](docs/Model/ConferenceMember.md) +- [ConferenceMemberExitCallback](docs/Model/ConferenceMemberExitCallback.md) +- [ConferenceMemberJoinCallback](docs/Model/ConferenceMemberJoinCallback.md) +- [ConferenceRecordingAvailableCallback](docs/Model/ConferenceRecordingAvailableCallback.md) +- [ConferenceRecordingMetadata](docs/Model/ConferenceRecordingMetadata.md) +- [ConferenceRedirectCallback](docs/Model/ConferenceRedirectCallback.md) +- [ConferenceStateEnum](docs/Model/ConferenceStateEnum.md) +- [Contact](docs/Model/Contact.md) +- [CreateAsyncBulkLookupResponse](docs/Model/CreateAsyncBulkLookupResponse.md) +- [CreateAsyncBulkLookupResponseData](docs/Model/CreateAsyncBulkLookupResponseData.md) +- [CreateCall](docs/Model/CreateCall.md) +- [CreateCallResponse](docs/Model/CreateCallResponse.md) +- [CreateEndpointRequestBase](docs/Model/CreateEndpointRequestBase.md) +- [CreateEndpointResponse](docs/Model/CreateEndpointResponse.md) +- [CreateEndpointResponseData](docs/Model/CreateEndpointResponseData.md) +- [CreateMessageRequestError](docs/Model/CreateMessageRequestError.md) +- [CreateMultiChannelMessageResponse](docs/Model/CreateMultiChannelMessageResponse.md) +- [CreateSyncLookupResponse](docs/Model/CreateSyncLookupResponse.md) +- [CreateSyncLookupResponseData](docs/Model/CreateSyncLookupResponseData.md) +- [CreateWebRtcConnectionRequest](docs/Model/CreateWebRtcConnectionRequest.md) +- [DeactivationEventEnum](docs/Model/DeactivationEventEnum.md) +- [Device](docs/Model/Device.md) +- [DeviceStatusEnum](docs/Model/DeviceStatusEnum.md) +- [DisconnectCallback](docs/Model/DisconnectCallback.md) +- [Diversion](docs/Model/Diversion.md) +- [DtmfCallback](docs/Model/DtmfCallback.md) +- [Endpoint](docs/Model/Endpoint.md) +- [EndpointDirectionEnum](docs/Model/EndpointDirectionEnum.md) +- [EndpointEvent](docs/Model/EndpointEvent.md) +- [EndpointEventTypeEnum](docs/Model/EndpointEventTypeEnum.md) +- [EndpointResponse](docs/Model/EndpointResponse.md) +- [EndpointStatusEnum](docs/Model/EndpointStatusEnum.md) +- [EndpointTypeEnum](docs/Model/EndpointTypeEnum.md) +- [Endpoints](docs/Model/Endpoints.md) +- [ErrorObject](docs/Model/ErrorObject.md) +- [ErrorSource](docs/Model/ErrorSource.md) +- [FailureWebhook](docs/Model/FailureWebhook.md) +- [FieldError](docs/Model/FieldError.md) +- [FileFormatEnum](docs/Model/FileFormatEnum.md) +- [GatherCallback](docs/Model/GatherCallback.md) +- [GetAsyncBulkLookupResponse](docs/Model/GetAsyncBulkLookupResponse.md) +- [GetAsyncBulkLookupResponseData](docs/Model/GetAsyncBulkLookupResponseData.md) +- [InProgressLookupStatusEnum](docs/Model/InProgressLookupStatusEnum.md) +- [InboundCallback](docs/Model/InboundCallback.md) +- [InboundCallbackMessage](docs/Model/InboundCallbackMessage.md) +- [InboundCallbackTypeEnum](docs/Model/InboundCallbackTypeEnum.md) +- [InitiateCallback](docs/Model/InitiateCallback.md) +- [LatestMessageDeliveryStatusEnum](docs/Model/LatestMessageDeliveryStatusEnum.md) +- [LineTypeEnum](docs/Model/LineTypeEnum.md) +- [Link](docs/Model/Link.md) +- [LinkSchema](docs/Model/LinkSchema.md) +- [LinksObject](docs/Model/LinksObject.md) +- [ListEndpointsResponse](docs/Model/ListEndpointsResponse.md) +- [ListMessageDirectionEnum](docs/Model/ListMessageDirectionEnum.md) +- [ListMessageItem](docs/Model/ListMessageItem.md) +- [LookupErrorResponse](docs/Model/LookupErrorResponse.md) +- [LookupErrorSchema](docs/Model/LookupErrorSchema.md) +- [LookupErrorSchemaMeta](docs/Model/LookupErrorSchemaMeta.md) +- [LookupResult](docs/Model/LookupResult.md) +- [MachineDetectionCompleteCallback](docs/Model/MachineDetectionCompleteCallback.md) +- [MachineDetectionConfiguration](docs/Model/MachineDetectionConfiguration.md) +- [MachineDetectionModeEnum](docs/Model/MachineDetectionModeEnum.md) +- [MachineDetectionResult](docs/Model/MachineDetectionResult.md) +- [Media](docs/Model/Media.md) +- [Message](docs/Model/Message.md) +- [MessageDirectionEnum](docs/Model/MessageDirectionEnum.md) +- [MessageRequest](docs/Model/MessageRequest.md) +- [MessageStatusEnum](docs/Model/MessageStatusEnum.md) +- [MessageTypeEnum](docs/Model/MessageTypeEnum.md) +- [MessagesList](docs/Model/MessagesList.md) +- [MessagingCodeResponse](docs/Model/MessagingCodeResponse.md) +- [MessagingRequestError](docs/Model/MessagingRequestError.md) +- [MfaForbiddenRequestError](docs/Model/MfaForbiddenRequestError.md) +- [MfaRequestError](docs/Model/MfaRequestError.md) +- [MfaUnauthorizedRequestError](docs/Model/MfaUnauthorizedRequestError.md) +- [MmsMessageContent](docs/Model/MmsMessageContent.md) +- [MmsMessageContentFile](docs/Model/MmsMessageContentFile.md) +- [MultiChannelAction](docs/Model/MultiChannelAction.md) +- [MultiChannelActionCalendarEvent](docs/Model/MultiChannelActionCalendarEvent.md) +- [MultiChannelChannelListMMSObject](docs/Model/MultiChannelChannelListMMSObject.md) +- [MultiChannelChannelListMMSResponseObject](docs/Model/MultiChannelChannelListMMSResponseObject.md) +- [MultiChannelChannelListObjectBase](docs/Model/MultiChannelChannelListObjectBase.md) +- [MultiChannelChannelListOwnerObject](docs/Model/MultiChannelChannelListOwnerObject.md) +- [MultiChannelChannelListRBMObject](docs/Model/MultiChannelChannelListRBMObject.md) +- [MultiChannelChannelListRBMObjectAllOfContent](docs/Model/MultiChannelChannelListRBMObjectAllOfContent.md) +- [MultiChannelChannelListRBMResponseObject](docs/Model/MultiChannelChannelListRBMResponseObject.md) +- [MultiChannelChannelListRequestObject](docs/Model/MultiChannelChannelListRequestObject.md) +- [MultiChannelChannelListResponseObject](docs/Model/MultiChannelChannelListResponseObject.md) +- [MultiChannelChannelListSMSObject](docs/Model/MultiChannelChannelListSMSObject.md) +- [MultiChannelChannelListSMSResponseObject](docs/Model/MultiChannelChannelListSMSResponseObject.md) +- [MultiChannelError](docs/Model/MultiChannelError.md) +- [MultiChannelMessageChannelEnum](docs/Model/MultiChannelMessageChannelEnum.md) +- [MultiChannelMessageContent](docs/Model/MultiChannelMessageContent.md) +- [MultiChannelMessageRequest](docs/Model/MultiChannelMessageRequest.md) +- [MultiChannelMessageResponseData](docs/Model/MultiChannelMessageResponseData.md) +- [OptInWorkflow](docs/Model/OptInWorkflow.md) +- [Page](docs/Model/Page.md) +- [PageInfo](docs/Model/PageInfo.md) +- [PriorityEnum](docs/Model/PriorityEnum.md) +- [ProductTypeEnum](docs/Model/ProductTypeEnum.md) +- [RbmActionBase](docs/Model/RbmActionBase.md) +- [RbmActionDial](docs/Model/RbmActionDial.md) +- [RbmActionOpenUrl](docs/Model/RbmActionOpenUrl.md) +- [RbmActionTypeEnum](docs/Model/RbmActionTypeEnum.md) +- [RbmActionViewLocation](docs/Model/RbmActionViewLocation.md) +- [RbmCardContent](docs/Model/RbmCardContent.md) +- [RbmCardContentMedia](docs/Model/RbmCardContentMedia.md) +- [RbmLocationResponse](docs/Model/RbmLocationResponse.md) +- [RbmMediaHeightEnum](docs/Model/RbmMediaHeightEnum.md) +- [RbmMessageCarouselCard](docs/Model/RbmMessageCarouselCard.md) +- [RbmMessageContentFile](docs/Model/RbmMessageContentFile.md) +- [RbmMessageContentRichCard](docs/Model/RbmMessageContentRichCard.md) +- [RbmMessageContentText](docs/Model/RbmMessageContentText.md) +- [RbmMessageMedia](docs/Model/RbmMessageMedia.md) +- [RbmOpenUrlEnum](docs/Model/RbmOpenUrlEnum.md) +- [RbmStandaloneCard](docs/Model/RbmStandaloneCard.md) +- [RbmSuggestionResponse](docs/Model/RbmSuggestionResponse.md) +- [RbmWebViewEnum](docs/Model/RbmWebViewEnum.md) +- [RecordingAvailableCallback](docs/Model/RecordingAvailableCallback.md) +- [RecordingCompleteCallback](docs/Model/RecordingCompleteCallback.md) +- [RecordingStateEnum](docs/Model/RecordingStateEnum.md) +- [RecordingTranscriptionClip](docs/Model/RecordingTranscriptionClip.md) +- [RecordingTranscriptionMetadata](docs/Model/RecordingTranscriptionMetadata.md) +- [RecordingTranscriptions](docs/Model/RecordingTranscriptions.md) +- [RedirectCallback](docs/Model/RedirectCallback.md) +- [RedirectMethodEnum](docs/Model/RedirectMethodEnum.md) +- [SipConnectionMetadata](docs/Model/SipConnectionMetadata.md) +- [SipCredentials](docs/Model/SipCredentials.md) +- [SmsMessageContent](docs/Model/SmsMessageContent.md) +- [StandaloneCardOrientationEnum](docs/Model/StandaloneCardOrientationEnum.md) +- [StatusCallback](docs/Model/StatusCallback.md) +- [StatusCallbackMessage](docs/Model/StatusCallbackMessage.md) +- [StatusCallbackTypeEnum](docs/Model/StatusCallbackTypeEnum.md) +- [StirShaken](docs/Model/StirShaken.md) +- [SyncLookupRequest](docs/Model/SyncLookupRequest.md) +- [TelephoneNumber](docs/Model/TelephoneNumber.md) +- [TfvBasicAuthentication](docs/Model/TfvBasicAuthentication.md) +- [TfvCallbackStatusEnum](docs/Model/TfvCallbackStatusEnum.md) +- [TfvError](docs/Model/TfvError.md) +- [TfvStatus](docs/Model/TfvStatus.md) +- [TfvStatusEnum](docs/Model/TfvStatusEnum.md) +- [TfvSubmissionInfo](docs/Model/TfvSubmissionInfo.md) +- [TfvSubmissionWrapper](docs/Model/TfvSubmissionWrapper.md) +- [ThumbnailAlignmentEnum](docs/Model/ThumbnailAlignmentEnum.md) +- [TranscribeRecording](docs/Model/TranscribeRecording.md) +- [Transcription](docs/Model/Transcription.md) +- [TranscriptionAvailableCallback](docs/Model/TranscriptionAvailableCallback.md) +- [TransferAnswerCallback](docs/Model/TransferAnswerCallback.md) +- [TransferCompleteCallback](docs/Model/TransferCompleteCallback.md) +- [TransferDisconnectCallback](docs/Model/TransferDisconnectCallback.md) +- [UpdateCall](docs/Model/UpdateCall.md) +- [UpdateCallRecording](docs/Model/UpdateCallRecording.md) +- [UpdateConference](docs/Model/UpdateConference.md) +- [UpdateConferenceMember](docs/Model/UpdateConferenceMember.md) +- [VerificationDenialWebhook](docs/Model/VerificationDenialWebhook.md) +- [VerificationRequest](docs/Model/VerificationRequest.md) +- [VerificationUpdateRequest](docs/Model/VerificationUpdateRequest.md) +- [VerificationWebhook](docs/Model/VerificationWebhook.md) +- [VerifyCodeRequest](docs/Model/VerifyCodeRequest.md) +- [VerifyCodeResponse](docs/Model/VerifyCodeResponse.md) +- [VoiceApiError](docs/Model/VoiceApiError.md) +- [VoiceCodeResponse](docs/Model/VoiceCodeResponse.md) +- [WebhookSubscription](docs/Model/WebhookSubscription.md) +- [WebhookSubscriptionBasicAuthentication](docs/Model/WebhookSubscriptionBasicAuthentication.md) +- [WebhookSubscriptionError](docs/Model/WebhookSubscriptionError.md) +- [WebhookSubscriptionRequestSchema](docs/Model/WebhookSubscriptionRequestSchema.md) +- [WebhookSubscriptionTypeEnum](docs/Model/WebhookSubscriptionTypeEnum.md) +- [WebhookSubscriptionsListBody](docs/Model/WebhookSubscriptionsListBody.md) + +## Authorization + +### Basic + +- **Type**: HTTP basic authentication + + +### OAuth2 + +- **Type**: `OAuth` +- **Flow**: `application` +- **Authorization URL**: `` +- **Scopes**: N/A + +## Tests + +To run the tests, use: + +```bash +composer install +vendor/bin/phpunit +``` -This package can be used with PHP >= 7.2 +## Author -## Documentation +letstalk@bandwidth.com -Documentation for this package can be found at [https://dev.bandwidth.com/sdks/php/](https://dev.bandwidth.com/sdks/php/) +## About this package -## Credentials +This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -Information for credentials for this package can be found at https://dev.bandwidth.com/guides/accountCredentials.html +- API version: `1.0.0` + - Generator version: `7.25.0-SNAPSHOT` +- Build package: `org.openapitools.codegen.languages.PhpNextgenClientCodegen` diff --git a/bandwidth.yml b/bandwidth.yml new file mode 100644 index 0000000..52ceffd --- /dev/null +++ b/bandwidth.yml @@ -0,0 +1,9896 @@ +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: [] + - OAuth2: [] +tags: + - name: Messages + - name: Media + - name: Multi-Channel + - name: Calls + - name: Conferences + - name: Recordings + - name: Statistics + - name: Transcriptions + - name: MFA + - name: Phone Number Lookup + - name: Toll-Free Verification + - name: Endpoints +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 at [Bandwidth + Support](https://www.bandwidth.com/support/en/articles/12823220-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. + + + **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 + minutes per Source IP address. Exceeding the limit returns HTTP 429 with + a `Retry-After` header. + 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/fromBwLatency' + - $ref: '#/components/parameters/bwQueued' + - $ref: '#/components/parameters/product' + - $ref: '#/components/parameters/location' + - $ref: '#/components/parameters/carrierQueued' + - $ref: '#/components/parameters/fromCarrierLatency' + - $ref: '#/components/parameters/callingNumberCountryA3' + - $ref: '#/components/parameters/calledNumberCountryA3' + - $ref: '#/components/parameters/fromSegmentCount' + - $ref: '#/components/parameters/toSegmentCount' + - $ref: '#/components/parameters/fromMessageSize' + - $ref: '#/components/parameters/toMessageSize' + - $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' + '405': + $ref: '#/components/responses/messagingMethodNotAllowedError' + '415': + $ref: '#/components/responses/messagingInvalidMediaTypeError' + '429': + $ref: '#/components/responses/listMessagesTooManyRequestsError' + '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' + '405': + $ref: '#/components/responses/messagingMethodNotAllowedError' + '406': + $ref: '#/components/responses/messagingNotAcceptableError' + '415': + $ref: '#/components/responses/messagingInvalidMediaTypeError' + '429': + $ref: '#/components/responses/messagingTooManyRequestsError' + '500': + $ref: '#/components/responses/messagingInternalServerError' + callbacks: + statusCallback: + $ref: '#/components/callbacks/statusCallback' + servers: *ref_0 + /users/{accountId}/messages/multiChannel: + post: + summary: Create Multi-Channel Message + description: Endpoint for sending Multi-Channel messages. + operationId: createMultiChannelMessage + parameters: + - $ref: '#/components/parameters/accountId' + tags: + - Multi-Channel + requestBody: + $ref: '#/components/requestBodies/createMultiChannelMessageRequest' + responses: + '202': + $ref: '#/components/responses/createMultiChannelMessageResponse' + '400': + $ref: '#/components/responses/multiChannelBadRequestError' + '401': + $ref: '#/components/responses/multiChannelUnauthorizedError' + '403': + $ref: '#/components/responses/multiChannelForbiddenError' + '404': + $ref: '#/components/responses/multiChannelNotFoundError' + '405': + $ref: '#/components/responses/multiChannelMethodNotAllowedError' + '406': + $ref: '#/components/responses/multiChannelNotAcceptableError' + '415': + $ref: '#/components/responses/multiChannelInvalidMediaTypeError' + '429': + $ref: '#/components/responses/multiChannelTooManyRequestsError' + '500': + $ref: '#/components/responses/multiChannelInternalServerError' + callbacks: + statusCallback: + $ref: '#/components/callbacks/statusCallback' + x-badges: + - name: Beta + color: '#076EA8' + 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' + get: + tags: + - Calls + summary: Get Calls + description: >- + Returns a max of 10000 calls, sorted by `createdTime` from oldest to + newest. + + + **NOTE:** If the number of calls 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 call records. + + Also, 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 empty array [] in response. + operationId: listCalls + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/to' + - $ref: '#/components/parameters/from' + - $ref: '#/components/parameters/minStartTimeCalls' + - $ref: '#/components/parameters/maxStartTimeCalls' + - $ref: '#/components/parameters/disconnectCause' + - $ref: '#/components/parameters/pageSizeCalls' + - $ref: '#/components/parameters/pageToken1' + responses: + '200': + $ref: '#/components/responses/listCallsResponse' + '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': + $ref: '#/components/responses/updateCallResponse' + '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': + $ref: '#/components/responses/updateRecordingResponse' + '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 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: getRecordingTranscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/recordingId' + responses: + '200': + $ref: '#/components/responses/getRecordingTranscriptionResponse' + '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: deleteRecordingTranscription + 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}/calls/{callId}/transcriptions: + get: + tags: + - Transcriptions + summary: List Real-time Transcriptions + description: >- + List the transcriptions created on this call via + [startTranscription](/docs/voice/bxml/startTranscription). + operationId: listRealTimeTranscriptions + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + responses: + '200': + $ref: '#/components/responses/listTranscriptionsResponse' + '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}/transcriptions/{transcriptionId}: + get: + tags: + - Transcriptions + summary: Get Real-time Transcription + description: >- + Retrieve the specified transcription that was created on this call via + [startTranscription](/docs/voice/bxml/startTranscription). + operationId: getRealTimeTranscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/transcriptionId' + 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' + delete: + tags: + - Transcriptions + summary: Delete Real-time Transcription + description: >- + Delete the specified transcription that was created on this call via + [startTranscription](/docs/voice/bxml/startTranscription). + + + Note: After the deletion is requested and a `200` 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: deleteRealTimeTranscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/transcriptionId' + responses: + '200': + $ref: '#/components/responses/deleteCallTranscriptionResponse' + '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}/phoneNumberLookup: + post: + summary: Create Synchronous Number Lookup + description: >- + Creates a synchronous phone number lookup request. Maximum of 100 + telephone numbers per request. + operationId: createSyncLookup + tags: + - Phone Number Lookup + parameters: + - $ref: '#/components/parameters/accountId1' + requestBody: + $ref: '#/components/requestBodies/createSyncLookupRequest' + responses: + '200': + $ref: '#/components/responses/createSyncLookupResponse' + default: + $ref: '#/components/responses/tnLookupDefaultResponse' + servers: &ref_3 + - url: https://api.bandwidth.com/v2 + description: Production + /accounts/{accountId}/phoneNumberLookup/bulk: + post: + summary: Create Asynchronous Bulk Number Lookup + description: >- + Creates an asynchronous bulk phone number lookup request. Maximum of + 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk + Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) + endpoint to check the status of the request and view the results. + operationId: createAsyncBulkLookup + tags: + - Phone Number Lookup + parameters: + - $ref: '#/components/parameters/accountId1' + requestBody: + $ref: '#/components/requestBodies/createAsyncBulkLookupRequest' + responses: + '202': + $ref: '#/components/responses/createAsyncBulkLookupResponse' + default: + $ref: '#/components/responses/tnLookupDefaultResponse' + servers: *ref_3 + /accounts/{accountId}/phoneNumberLookup/bulk/{requestId}: + get: + summary: Get Asynchronous Bulk Number Lookup + description: >- + Get an existing [Asynchronous Bulk Number + Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use + this endpoint to check the status of the request and view the results. + operationId: getAsyncBulkLookup + tags: + - Phone Number Lookup + parameters: + - $ref: '#/components/parameters/accountId1' + - $ref: '#/components/parameters/requestId' + responses: + '200': + $ref: '#/components/responses/getAsyncBulkLookupResponse' + default: + $ref: '#/components/responses/tnLookupDefaultResponse' + servers: *ref_3 + /accounts/{accountId}/tollFreeVerification: + post: + tags: + - Toll-Free Verification + summary: Request Toll-Free Verification + description: Submit a request for verification of a toll-free phone number. + operationId: requestTollFreeVerification + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/requestTollFreeVerificationRequest' + responses: + '202': + description: Accepted + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + callbacks: + tfVerificationStatus: + $ref: '#/components/callbacks/tfVerificationStatus' + servers: &ref_4 + - url: https://api.bandwidth.com/api/v2 + description: Production + /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification: + get: + tags: + - Toll-Free Verification + summary: Get Toll-Free Verification Status + description: >- + Gets the verification status for a phone number that is provisioned to + your account. + + Submission information will be appended to the response if it is + available. + operationId: getTollFreeVerificationStatus + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/tfPhoneNumberPathParam' + responses: + '200': + $ref: '#/components/responses/getTollFreeVerificationStatusResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + put: + tags: + - Toll-Free Verification + summary: Update Toll-Free Verification Request + description: >- + Updates a toll-free verification request. + + Submissions are only eligible for resubmission for 7 days within being + processed and if resubmission is allowed (resubmitAllowed field is + true). + operationId: updateTollFreeVerificationRequest + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/tfPhoneNumberPathParam' + requestBody: + $ref: '#/components/requestBodies/updateTollFreeVerificationRequestRequest' + responses: + '202': + $ref: '#/components/responses/verifyPutResponse' + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + callbacks: + tfVerificationStatus: + $ref: '#/components/callbacks/tfVerificationStatus' + delete: + description: Delete a toll-free verification submission for a toll-free number. + operationId: deleteVerificationRequest + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/tfPhoneNumberPathParam' + responses: + '204': + $ref: '#/components/responses/noContentResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + summary: Delete a Toll-Free Verification Submission + tags: + - Toll-Free Verification + servers: *ref_4 + /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions: + get: + tags: + - Toll-Free Verification + summary: List Webhook Subscriptions + description: >- + Lists all webhook subscriptions that are registered to receive status + updates for the toll-free verification requests submitted under this + account (password will not be returned through this API + + If `basicAuthentication` is defined, the `password` property of that + object will be null). + operationId: listWebhookSubscriptions + parameters: + - $ref: '#/components/parameters/accountId' + responses: + '200': + $ref: '#/components/responses/listWebhookSubscriptionsResponse' + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + post: + tags: + - Toll-Free Verification + summary: Create Webhook Subscription + description: >- + Create a new webhook subscription (this webhook will be called for every + update on every submission). + + In addition to a `callbackUrl`, this subscription can provide optional + HTTP basic authentication credentials (a username and a password). + + The returned subscription object will contain an ID that can be used to + modify or delete the subscription at a later time. + operationId: createWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/webhookSubscriptionRequest' + responses: + '201': + $ref: '#/components/responses/createWebhookSubscriptionResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 + /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}: + delete: + tags: + - Toll-Free Verification + summary: Delete Webhook Subscription + description: Delete a webhook subscription by ID. + operationId: deleteWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/webhookSubscriptionIdPathParam' + responses: + '204': + $ref: '#/components/responses/noContentResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + put: + tags: + - Toll-Free Verification + summary: Update Webhook Subscription + description: >- + Update an existing webhook subscription (`callbackUrl` and + `basicAuthentication` can be updated). + operationId: updateWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/webhookSubscriptionIdPathParam' + requestBody: + $ref: '#/components/requestBodies/webhookSubscriptionRequest' + responses: + '200': + $ref: '#/components/responses/updateWebhookSubscriptionResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 + /tollFreeVerification/useCases: + get: + tags: + - Toll-Free Verification + summary: List Toll-Free Use Cases + description: Lists valid toll-free use cases. + operationId: listTollFreeUseCases + responses: + '200': + $ref: '#/components/responses/listTollFreeUseCasesResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 + /accounts/{accountId}/endpoints: + get: + tags: + - Endpoints + summary: List Endpoints + description: Returns a list of endpoints associated with the specified account. + operationId: listEndpoints + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/endpointType' + - $ref: '#/components/parameters/endpointStatus' + - $ref: '#/components/parameters/afterCursor' + - $ref: '#/components/parameters/limit1' + responses: + '200': + $ref: '#/components/responses/listEndpointsResponse' + '400': + $ref: '#/components/responses/badRequestErrorResponse' + '401': + $ref: '#/components/responses/unauthorizedErrorResponse' + '403': + $ref: '#/components/responses/forbiddenErrorResponse' + '404': + $ref: '#/components/responses/notFoundErrorResponse' + '405': + $ref: '#/components/responses/methodNotAllowedErrorResponse' + '415': + $ref: '#/components/responses/unsupportedMediaTypeErrorResponse' + '429': + $ref: '#/components/responses/tooManyRequestsErrorResponse' + '500': + $ref: '#/components/responses/serviceUnavailableErrorResponse' + post: + tags: + - Endpoints + summary: Create Endpoint + description: Creates a new Endpoint for the specified account. + operationId: createEndpoint + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/createEndpointRequest' + responses: + '201': + $ref: '#/components/responses/createEndpointResponse' + '400': + $ref: '#/components/responses/badRequestErrorResponse' + '401': + $ref: '#/components/responses/unauthorizedErrorResponse' + '403': + $ref: '#/components/responses/forbiddenErrorResponse' + '404': + $ref: '#/components/responses/notFoundErrorResponse' + '405': + $ref: '#/components/responses/methodNotAllowedErrorResponse' + '415': + $ref: '#/components/responses/unsupportedMediaTypeErrorResponse' + '429': + $ref: '#/components/responses/tooManyRequestsErrorResponse' + '500': + $ref: '#/components/responses/serviceUnavailableErrorResponse' + callbacks: + endpointEventCallback: + $ref: '#/components/callbacks/endpointEvent' + servers: &ref_5 + - url: https://api.bandwidth.com/v2 + description: Production + /accounts/{accountId}/endpoints/{endpointId}: + get: + tags: + - Endpoints + summary: Get Endpoint + description: Returns information about the specified endpoint. + operationId: getEndpoint + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/endpointId' + responses: + '200': + $ref: '#/components/responses/getEndpointResponse' + '400': + $ref: '#/components/responses/badRequestErrorResponse' + '401': + $ref: '#/components/responses/unauthorizedErrorResponse' + '403': + $ref: '#/components/responses/forbiddenErrorResponse' + '404': + $ref: '#/components/responses/notFoundErrorResponse' + '405': + $ref: '#/components/responses/methodNotAllowedErrorResponse' + '415': + $ref: '#/components/responses/unsupportedMediaTypeErrorResponse' + '429': + $ref: '#/components/responses/tooManyRequestsErrorResponse' + '500': + $ref: '#/components/responses/serviceUnavailableErrorResponse' + delete: + tags: + - Endpoints + summary: Delete Endpoint + description: >- + Deletes the specified endpoint. If the endpoint is actively streaming + media, the media stream will be terminated. + operationId: deleteEndpoint + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/endpointId' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/badRequestErrorResponse' + '401': + $ref: '#/components/responses/unauthorizedErrorResponse' + '403': + $ref: '#/components/responses/forbiddenErrorResponse' + '404': + $ref: '#/components/responses/notFoundErrorResponse' + '405': + $ref: '#/components/responses/methodNotAllowedErrorResponse' + '415': + $ref: '#/components/responses/unsupportedMediaTypeErrorResponse' + '429': + $ref: '#/components/responses/tooManyRequestsErrorResponse' + '500': + $ref: '#/components/responses/serviceUnavailableErrorResponse' + servers: *ref_5 + /accounts/{accountId}/endpoints/{endpointId}/bxml: + put: + tags: + - Endpoints + summary: Update Endpoint BXML + description: Updates the BXML for the specified endpoint. + operationId: updateEndpointBxml + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/endpointId' + requestBody: + $ref: '#/components/requestBodies/updateEndpointBxmlRequest' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/badRequestErrorResponse' + '401': + $ref: '#/components/responses/unauthorizedErrorResponse' + '403': + $ref: '#/components/responses/forbiddenErrorResponse' + '404': + $ref: '#/components/responses/notFoundErrorResponse' + '405': + $ref: '#/components/responses/methodNotAllowedErrorResponse' + '415': + $ref: '#/components/responses/unsupportedMediaTypeErrorResponse' + '429': + $ref: '#/components/responses/tooManyRequestsErrorResponse' + '500': + $ref: '#/components/responses/serviceUnavailableErrorResponse' + servers: *ref_5 +components: + schemas: + applicationId: + type: string + description: >- + The ID of the Application your from number or senderId is associated + with in the Bandwidth App. + example: 93de2206-9669-4e07-948d-329f4b722ee2 + priorityEnum: + type: string + description: >- + Specifies the message's sending priority with respect to other messages + in your account. For best results and optimal throughput, reserve the + 'high' priority setting for critical messages only. + 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 + example: INBOUND + messageDirectionEnum: + type: string + description: The direction of the message. One of in out. + enum: + - in + - out + example: in + messageTypeEnum: + type: string + description: The type of message. Either SMS or MMS. + enum: + - sms + - mms + - rcs + example: sms + productTypeEnum: + type: string + description: The type of product associated with the message. + enum: + - LOCAL_A2P + - P2P + - SHORT_CODE_REACH + - TOLL_FREE + - HOSTED_SHORT_CODE + - ALPHA_NUMERIC + - RBM_MEDIA + - RBM_RICH + - RBM_CONVERSATIONAL + example: P2P + 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: + $ref: '#/components/schemas/segmentCount' + 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 + bwLatency: + type: integer + description: >- + The Bandwidth latency of the message in seconds. Only available for + accounts with the Advanced Quality Metrics feature enabled. + nullable: true + example: 20 + carrierLatency: + type: integer + description: >- + The carrier latency of the message in seconds. Only available for + OUTBOUND messages from accounts with the Advanced Quality Metrics + feature enabled. + nullable: true + example: 20 + callingNumberCountryA3: + type: string + description: The A3 country code of the calling number. + nullable: true + example: USA + calledNumberCountryA3: + type: string + description: The A3 country code of the called number. + nullable: true + example: USA + product: + type: string + description: The messaging product associated with the message. + nullable: true + example: P2P + location: + type: string + description: The location ID associated with this message. + nullable: true + example: 123ID + 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 + id: + type: string + description: The ID of the message. + example: 1589228074636lm4k2je7j7jklbn2 + media: + title: Media + type: object + properties: + content: + type: string + contentLength: + type: integer + example: 1024 + mediaName: + type: string + example: image.png + segmentCount: + type: integer + description: >- + The number of segments the user's message is broken into before sending + over carrier networks. + example: 1 + tag: + title: Tag + type: string + description: >- + A custom string that will be included in callback events of the message. + Max 1024 characters. + example: custom string + 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. + example: '2021-02-01T11:29:18-05:00' + carrierName: + type: string + description: >- + The name of the Authorized Message Provider (AMP) that handled this + message. + + In the US, this is the carrier that the message was sent to. + + This field is present only when this account feature has been enabled. + example: AT&T + 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: + $ref: '#/components/schemas/applicationId' + time: + type: string + format: date-time + description: The datetime stamp of the message in ISO 8601 + example: 2024-12-02T20:15:57.278Z + segmentCount: + $ref: '#/components/schemas/segmentCount' + 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: + $ref: '#/components/schemas/tag' + priority: + $ref: '#/components/schemas/priorityEnum' + expiration: + $ref: '#/components/schemas/expiration' + messageRequest: + title: MessageRequest + type: object + required: + - applicationId + - to + - from + properties: + applicationId: + $ref: '#/components/schemas/applicationId' + 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: >- + Either an alphanumeric sender ID or the sender's Bandwidth phone + number in E.164 format, which must be hosted within Bandwidth and + linked to the account that is generating the message. + + Alphanumeric Sender IDs can contain up to 11 characters, upper-case + letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, + plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must + contain at least one letter. + example: '+15551113333' + text: + $ref: '#/components/schemas/messageText' + media: + $ref: '#/components/schemas/messageMedia' + tag: + $ref: '#/components/schemas/tag' + priority: + $ref: '#/components/schemas/priorityEnum' + expiration: + $ref: '#/components/schemas/expiration' + messageText: + type: string + description: The contents of the text message. Must be 2048 characters or less. + maxLength: 2048 + example: Hello world + messageMedia: + 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 + createMultiChannelMessageResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + example: [] + data: + $ref: '#/components/schemas/multiChannelMessageResponseData' + errors: + type: array + items: + $ref: '#/components/schemas/errorObject' + example: [] + multiChannelError: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + example: [] + data: + type: object + nullable: true + example: null + errors: + type: array + items: + $ref: '#/components/schemas/errorObject' + link: + type: object + properties: + rel: + type: string + href: + type: string + errorObject: + type: object + properties: + type: + description: A concise summary of the error used for categorization. + type: string + description: + description: A detailed explanation of the error. + type: string + source: + $ref: '#/components/schemas/errorSource' + required: + - type + - description + - source + errorSource: + title: Error Source + type: object + description: Specifies relevant sources of the error, if any. + properties: + parameter: + type: string + description: The relevant URI query parameter causing the error + field: + type: string + description: The request body field that led to the error + header: + type: string + description: The header field that contributed to the error + reference: + type: string + description: A resource ID or path linked to the error + multiChannelMessageChannelEnum: + description: The channel of the multi-channel message. + type: string + enum: + - RBM + - SMS + - MMS + example: RBM + multiChannelSenderId: + type: string + description: The sender ID of the message. This could be an alphanumeric sender ID. + example: BandwidthRBM + multiChannelDestination: + type: string + description: The phone number the message should be sent to in E164 format. + example: '+15552223333' + multiChannelDestinations: + uniqueItems: true + type: array + description: The destination phone number(s) of the message, in E164 format. + example: + - '+15554443333' + items: + type: string + rbmMessageContentText: + title: RBM Text + type: object + properties: + text: + type: string + description: >- + The text associated with the message. Must be 3270 characters or + less + maxLength: 3270 + example: Hello world + suggestions: + $ref: '#/components/schemas/multiChannelFullActions' + required: + - text + rbmMediaHeightEnum: + type: string + description: The height of the media. + enum: + - SHORT + - MEDIUM + - TALL + example: SHORT + rbmMessageContentFile: + title: RBM Rich Media File + type: object + properties: + fileUrl: + type: string + format: uri + description: The URL of the media file. 100MB is the maximum file size. + example: https://dev.bandwidth.com/images/bandwidth-logo.png + maxLength: 1000 + thumbnailUrl: + type: string + format: uri + description: The URL of the thumbnail image. Applies only to video file media. + example: https://dev.bandwidth.com/images/bandwidth-logo.png + maxLength: 1000 + required: + - fileUrl + mmsMessageContentFile: + title: MMS Media File + type: object + properties: + fileUrl: + type: string + format: uri + description: >- + The URL of a media attachment. + + + For MMS, the API limits file size to 3.5MB. Specific carriers and + channels may have a smaller limit that could cause a large file to + fail, see more at [Bandwidth + Support](https://www.bandwidth.com/support/en/articles/12823216-what-are-the-mms-file-size-limits) + for more details. + example: https://dev.bandwidth.com/images/bandwidth-logo.png + maxLength: 1000 + required: + - fileUrl + rbmMessageMedia: + title: RBM Media + type: object + properties: + media: + type: array + items: + $ref: '#/components/schemas/rbmMessageContentFile' + suggestions: + $ref: '#/components/schemas/multiChannelFullActions' + required: + - media + rbmCardContent: + type: object + description: Must contain at least one of title, description, or media to be valid. + properties: + title: + type: string + description: The title of the card. Must be 200 characters or less. + maxLength: 200 + example: Bandwidth + description: + type: string + description: The description of the card. Must be 2000 characters or less. + maxLength: 2000 + example: Bandwidth is a communications platform as a service (CPaaS) company. + media: + allOf: + - $ref: '#/components/schemas/rbmMessageContentFile' + - type: object + properties: + height: + $ref: '#/components/schemas/rbmMediaHeightEnum' + required: + - height + suggestions: + description: >- + An array of suggested actions for the recipient that will be + displayed on the rich card. + type: array + items: + $ref: '#/components/schemas/multiChannelAction' + maxItems: 4 + rbmStandaloneCard: + title: Standalone Card + type: object + properties: + orientation: + $ref: '#/components/schemas/standaloneCardOrientationEnum' + thumbnailImageAlignment: + $ref: '#/components/schemas/thumbnailAlignmentEnum' + cardContent: + $ref: '#/components/schemas/rbmCardContent' + suggestions: + $ref: '#/components/schemas/multiChannelFullActions' + required: + - orientation + - cardContent + standaloneCardOrientationEnum: + type: string + enum: + - HORIZONTAL + - VERTICAL + example: VERTICAL + thumbnailAlignmentEnum: + type: string + description: >- + The alignment of the thumbnail image in the card. Required when + orientation is HORIZONTAL. + enum: + - LEFT + - RIGHT + example: LEFT + rbmMessageCarouselCard: + title: Carousel + type: object + properties: + cardWidth: + $ref: '#/components/schemas/cardWidthEnum' + cardContents: + type: array + items: + $ref: '#/components/schemas/rbmCardContent' + minItems: 2 + maxItems: 10 + suggestions: + $ref: '#/components/schemas/multiChannelFullActions' + required: + - cardContents + - cardWidth + cardWidthEnum: + type: string + enum: + - SMALL + - MEDIUM + example: SMALL + smsMessageContent: + title: SMS Text + type: object + properties: + text: + $ref: '#/components/schemas/messageText' + required: + - text + mmsMessageContent: + title: MMS Message + type: object + properties: + text: + $ref: '#/components/schemas/messageText' + media: + type: array + items: + $ref: '#/components/schemas/mmsMessageContentFile' + rbmMessageContentRichCard: + title: RBM Rich Card + oneOf: + - $ref: '#/components/schemas/rbmStandaloneCard' + - $ref: '#/components/schemas/rbmMessageCarouselCard' + rbmActionTypeEnum: + type: string + enum: + - REPLY + - DIAL_PHONE + - SHOW_LOCATION + - CREATE_CALENDAR_EVENT + - OPEN_URL + - REQUEST_LOCATION + example: REPLY + rbmOpenUrlEnum: + type: string + description: >- + Specifies how the URL should be opened on a mobile device. + + - `BROWSER` Opens the URL in the device's default browser. If + application is not set or the device doesn't support WebView, this + option is used by default. + + - `WEBVIEW` Opens the URL in an in-app WebView. + enum: + - BROWSER + - WEBVIEW + example: WEBVIEW + rbmWebViewEnum: + type: string + description: >- + Defines the layout of the WebView on a mobile device. It must be defined + + when application is set to `WEBVIEW` and must not be set when + application + + is set to `BROWSER`. + + - `FULL` WebView takes the full screen. + + - `HALF` WebView takes half of the screen. + + - `TALL` WebView takes three-quarters of the screen. + enum: + - FULL + - HALF + - TALL + rbmActionText: + title: Text + type: string + description: Displayed text for user to click + maxLength: 25 + example: Hello world + rbmActionPostbackData: + title: Post Back Data + type: string + format: byte + description: Base64 payload the customer receives when the reply is clicked. + maxLength: 2048 + example: SGVsbG8gd29ybGQ= + rbmActionBase: + type: object + properties: + type: + $ref: '#/components/schemas/rbmActionTypeEnum' + text: + $ref: '#/components/schemas/rbmActionText' + postbackData: + $ref: '#/components/schemas/rbmActionPostbackData' + required: + - text + - postbackData + - type + rbmActionDial: + allOf: + - $ref: '#/components/schemas/rbmActionBase' + - title: Dial Phone + type: object + properties: + phoneNumber: + type: string + description: The phone number to dial. Must be E164 format. + example: '+15552223333' + required: + - phoneNumber + rbmActionViewLocation: + allOf: + - $ref: '#/components/schemas/rbmActionBase' + - title: Show Location + type: object + properties: + latitude: + type: string + format: double + description: >- + The latitude of the location. Must be in range [-90.000000, + 90.000000]. + example: '37.7749' + longitude: + type: string + format: double + description: >- + The longitude of the location. Must be in range [-180.000000, + 180.000000]. + example: '-122.4194' + label: + type: string + description: The label of the location. + example: San Francisco + maxLength: 100 + required: + - latitude + - longitude + multiChannelActionCalendarEvent: + allOf: + - $ref: '#/components/schemas/rbmActionBase' + - title: Calendar Event + type: object + properties: + title: + type: string + description: The title of the event. + example: Meeting with John + maxLength: 100 + startTime: + type: string + format: date-time + description: >- + The start time of the event. Must be a valid RFC-3339 value, + e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. + example: 2022-09-14T18:20:16.000Z + endTime: + type: string + format: date-time + description: >- + The end time of the event. Must be a valid RFC-3339 value, e.g., + 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. + example: 2022-09-14T18:20:16.000Z + description: + type: string + description: The description of the event. + example: Discuss the new project + maxLength: 500 + required: + - title + - startTime + - endTime + rbmActionOpenUrl: + allOf: + - $ref: '#/components/schemas/rbmActionBase' + - title: Open URL + type: object + properties: + url: + type: string + format: uri + description: The URL to open in browser. Must use http:// or https:// scheme. + example: https://dev.bandwidth.com + maxLength: 2048 + application: + $ref: '#/components/schemas/rbmOpenUrlEnum' + webviewViewMode: + $ref: '#/components/schemas/rbmWebViewEnum' + required: + - url + multiChannelFullActions: + type: array + description: An array of suggested actions for the recipient. + items: + $ref: '#/components/schemas/multiChannelAction' + maxItems: 11 + multiChannelAction: + anyOf: + - $ref: '#/components/schemas/rbmActionBase' + - $ref: '#/components/schemas/rbmActionDial' + - $ref: '#/components/schemas/rbmActionViewLocation' + - $ref: '#/components/schemas/multiChannelActionCalendarEvent' + - $ref: '#/components/schemas/rbmActionOpenUrl' + discriminator: + propertyName: type + mapping: + REPLY: '#/components/schemas/rbmActionBase' + DIAL_PHONE: '#/components/schemas/rbmActionDial' + SHOW_LOCATION: '#/components/schemas/rbmActionViewLocation' + CREATE_CALENDAR_EVENT: '#/components/schemas/multiChannelActionCalendarEvent' + OPEN_URL: '#/components/schemas/rbmActionOpenUrl' + REQUEST_LOCATION: '#/components/schemas/rbmActionBase' + multiChannelChannelListObjectBase: + type: object + properties: + from: + $ref: '#/components/schemas/multiChannelSenderId' + applicationId: + $ref: '#/components/schemas/applicationId' + channel: + $ref: '#/components/schemas/multiChannelMessageChannelEnum' + required: + - from + - applicationId + - channel + multiChannelChannelListRBMObject: + allOf: + - $ref: '#/components/schemas/multiChannelChannelListObjectBase' + - type: object + properties: + content: + description: The content of the message. + oneOf: + - $ref: '#/components/schemas/rbmMessageContentText' + - $ref: '#/components/schemas/rbmMessageMedia' + - $ref: '#/components/schemas/rbmMessageContentRichCard' + required: + - content + multiChannelChannelListSMSObject: + allOf: + - $ref: '#/components/schemas/multiChannelChannelListObjectBase' + - type: object + properties: + content: + $ref: '#/components/schemas/smsMessageContent' + required: + - content + multiChannelChannelListMMSObject: + allOf: + - $ref: '#/components/schemas/multiChannelChannelListObjectBase' + - type: object + properties: + content: + $ref: '#/components/schemas/mmsMessageContent' + required: + - content + multiChannelChannelListRBMResponseObject: + allOf: + - $ref: '#/components/schemas/multiChannelChannelListRBMObject' + - $ref: '#/components/schemas/multiChannelChannelListOwnerObject' + multiChannelChannelListSMSResponseObject: + allOf: + - $ref: '#/components/schemas/multiChannelChannelListSMSObject' + - $ref: '#/components/schemas/multiChannelChannelListOwnerObject' + multiChannelChannelListMMSResponseObject: + allOf: + - $ref: '#/components/schemas/multiChannelChannelListMMSObject' + - $ref: '#/components/schemas/multiChannelChannelListOwnerObject' + multiChannelChannelListRequestObject: + anyOf: + - $ref: '#/components/schemas/multiChannelChannelListRBMObject' + - $ref: '#/components/schemas/multiChannelChannelListSMSObject' + - $ref: '#/components/schemas/multiChannelChannelListMMSObject' + discriminator: + propertyName: channel + mapping: + RBM: '#/components/schemas/multiChannelChannelListRBMObject' + SMS: '#/components/schemas/multiChannelChannelListSMSObject' + MMS: '#/components/schemas/multiChannelChannelListMMSObject' + multiChannelChannelListOwnerObject: + type: object + properties: + owner: + type: string + description: >- + The Bandwidth senderId associated with the message. Identical to + 'from'. + required: + - owner + multiChannelChannelListResponseObject: + anyOf: + - $ref: '#/components/schemas/multiChannelChannelListRBMResponseObject' + - $ref: '#/components/schemas/multiChannelChannelListSMSResponseObject' + - $ref: '#/components/schemas/multiChannelChannelListMMSResponseObject' + discriminator: + propertyName: channel + mapping: + RBM: '#/components/schemas/multiChannelChannelListRBMResponseObject' + SMS: '#/components/schemas/multiChannelChannelListSMSResponseObject' + MMS: '#/components/schemas/multiChannelChannelListMMSResponseObject' + multiChannelMessageRequest: + description: Multi-Channel Message Request + type: object + properties: + to: + $ref: '#/components/schemas/multiChannelDestination' + channelList: + type: array + description: >- + A list of message bodies. The messages will be attempted in the + order they are listed. Once a message sends successfully, the others + will be ignored. + items: + $ref: '#/components/schemas/multiChannelChannelListRequestObject' + maxItems: 4 + tag: + $ref: '#/components/schemas/tag' + priority: + $ref: '#/components/schemas/priorityEnum' + expiration: + $ref: '#/components/schemas/expiration' + required: + - to + - channelList + multiChannelMessageResponseData: + description: The data returned in a multichannel message response. + type: object + properties: + id: + $ref: '#/components/schemas/id' + time: + description: The time the message was received by the Bandwidth API. + type: string + format: date-time + example: 2025-01-01T18:20:16.000Z + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + $ref: '#/components/schemas/multiChannelDestinations' + channelList: + type: array + description: >- + A list of message bodies. The messages will be attempted in the + order they are listed. Once a message sends successfully, the others + will be ignored. + items: + $ref: '#/components/schemas/multiChannelChannelListResponseObject' + maxItems: 4 + tag: + $ref: '#/components/schemas/tag' + priority: + $ref: '#/components/schemas/priorityEnum' + expiration: + $ref: '#/components/schemas/expiration' + required: + - id + - time + - direction + - to + - channelList + multiChannelMessageContent: + description: The structure of the content field of a multichannel message. + type: object + properties: + text: + type: string + media: + $ref: '#/components/schemas/rbmMessageContentFile' + rbmSuggestionResponse: + type: object + properties: + text: + type: string + description: The text associated with the suggestion response. + example: Yes, I would like to proceed + postbackData: + $ref: '#/components/schemas/rbmActionPostbackData' + pairedMessageId: + type: string + nullable: true + description: Corresponding parent message ID (MT). + example: 1752697342534u24xerqdukke523x + rbmLocationResponse: + type: object + properties: + latitude: + type: string + format: double + description: The latitude of the client's location. + example: '37.7749' + longitude: + type: string + format: double + description: The longitude of the client's location. + example: '-122.4194' + callback: + description: >- + Callbacks are divided into two types based on direction of the related + message: + + - `statusCallback` indicates status of an outbound MT SMS, MMS, or RBM + message. + + - `inboundCallback` indicates an inbound MO message or a multichannel + message client's response to a suggestion or location request. + type: object + oneOf: + - $ref: '#/components/schemas/statusCallback' + - $ref: '#/components/schemas/inboundCallback' + discriminator: + propertyName: type + mapping: + message-sending: '#/components/schemas/statusCallback' + message-sent: '#/components/schemas/statusCallback' + message-delivered: '#/components/schemas/statusCallback' + message-failed: '#/components/schemas/statusCallback' + message-read: '#/components/schemas/statusCallback' + message-received: '#/components/schemas/inboundCallback' + requested-location-response: '#/components/schemas/inboundCallback' + suggestion-response: '#/components/schemas/inboundCallback' + statusCallback: + type: object + description: >- + Represents a status callback for an outbound MT SMS or MMS or RBM + message. + properties: + time: + type: string + format: date-time + example: 2024-12-02T20:15:57.278Z + eventTime: + type: string + description: >- + Represents the time at which the message was read, for + `message-read` callbacks. + format: date-time + example: 2024-12-02T20:15:58.278Z + type: + $ref: '#/components/schemas/statusCallbackTypeEnum' + to: + type: string + description: >- + The destination phone number the message was sent to. + + For status callbacks, this the the Bandwidth user's client phone + number. + example: '+15552223333' + description: + type: string + description: A detailed description of the event described by the callback. + example: Message delivered to handset. + message: + $ref: '#/components/schemas/statusCallbackMessage' + errorCode: + type: integer + description: Optional error code, applicable only when type is `message-failed`. + example: 4405 + carrierName: + $ref: '#/components/schemas/carrierName' + required: + - time + - type + - to + - description + - message + inboundCallback: + type: object + description: Represents an inbound callback. + properties: + time: + type: string + format: date-time + example: 2024-12-02T20:15:57.278Z + type: + $ref: '#/components/schemas/inboundCallbackTypeEnum' + to: + type: string + description: > + The destination phone number the message was sent to. + + For inbound callbacks, this is the Bandwidth number or alphanumeric + identifier that received the message. + example: '+15552223333' + description: + type: string + description: A detailed description of the event described by the callback. + example: Incoming message received + message: + $ref: '#/components/schemas/inboundCallbackMessage' + carrierName: + $ref: '#/components/schemas/carrierName' + required: + - time + - type + - to + - description + - message + statusCallbackTypeEnum: + type: string + description: >- + The possible status callbacks when sending an MT SMS or MMS or RBM + message: + + - `message-sending` indicates that Bandwidth is sending the message to + the upstream provider. + + - `message-sent` indicates that the message has left the Bandwidth + network and is in transit to the provider. + + - `message-delivered` indicates that the message was successfully + delivered to handset. + + - `message-failed` indicates that the message could not be sent to the + intended recipient. + + - `message-read` indicates that the RBM message was read by the + recipient. + enum: + - message-sending + - message-sent + - message-delivered + - message-failed + - message-read + example: message-delivered + inboundCallbackTypeEnum: + type: string + description: >- + The possible inbound callback types originating from MO messages or + multichannel message client responses: + + - `message-received` indicates an MO message from a Bandwidth user's + client to a Bandwidth number. + + - `requested-location-response` indicates a response to a location + request sent by the Bandwidth user's client after receiving an RBM + message. + + - `suggestion-response` indicates a response to a suggestion sent by the + Bandwidth user's client after receiving an RBM message. + enum: + - message-received + - requested-location-response + - suggestion-response + example: message-received + statusCallbackMessage: + description: Message payload schema within a callback + type: object + properties: + id: + type: string + description: A unique identifier of the message. + example: 1661365814859loidf7mcwd4qacn7 + owner: + type: string + description: >- + The Bandwidth phone number or alphanumeric identifier associated + with the message. + example: '+15553332222' + applicationId: + $ref: '#/components/schemas/applicationId' + time: + type: string + format: date-time + example: 2024-12-02T20:15:57.666Z + segmentCount: + $ref: '#/components/schemas/segmentCount' + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + description: The phone number recipients of the message. + uniqueItems: true + type: array + items: + type: string + example: + - '+15552223333' + from: + type: string + description: >- + The Bandwidth phone number or alphanumeric identifier the message + was sent from. + example: '+15553332222' + text: + type: string + example: Hello world + tag: + $ref: '#/components/schemas/tag' + media: + type: array + description: Optional media, not applicable for sms + 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' + channel: + $ref: '#/components/schemas/multiChannelMessageChannelEnum' + required: + - id + - owner + - applicationId + - time + - segmentCount + - direction + - to + - from + inboundCallbackMessage: + allOf: + - $ref: '#/components/schemas/statusCallbackMessage' + - type: object + properties: + content: + $ref: '#/components/schemas/multiChannelMessageContent' + suggestionResponse: + $ref: '#/components/schemas/rbmSuggestionResponse' + locationResponse: + $ref: '#/components/schemas/rbmLocationResponse' + required: + - id + - owner + - applicationId + - time + - segmentCount + - direction + - to + - from + 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 + callTranscriptionDetectedLanguageEnum: + type: string + enum: + - en-US + - es-US + - fr-FR + description: The detected language for this transcription. + example: en-US + callTranscriptionTrackEnum: + type: string + enum: + - inbound + - outbound + description: Which `track` this transcription is derived from. + example: inbound + 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`) even if + `privacy` is set to true. + example: '+15555551212' + privacy: + nullable: true + type: boolean + description: >- + Hide the calling number. The `displayName` field can be used to + customize the displayed name. + example: false + 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. + + If `privacy` is true, only the following values are valid: + `Restricted`, `Anonymous`, `Private`, or `Unavailable`. + 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', 'base64' and 'hex' 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 4096 characters. + maxLength: 4096 + 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-Validation-Passed` or `TN-Validation-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-Validation-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 4096 characters. + + + Not allowed if `state` is `completed`. + maxLength: 4096 + 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/applicationId1' + 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/recordingTranscriptionMetadata' + recordingName: + $ref: '#/components/schemas/recordingName' + 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 + format: uri + 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-apis/voice/#tag/Conferences/operation/getConferenceMember) + endpoint + + and [Modify Conference + Member](/apis/voice-apis/voice/#tag/Conferences/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' + recordingName: + $ref: '#/components/schemas/recordingName' + machineDetectionConfiguration: + type: object + description: >- + The machine detection request used to perform machine detection on the + call. Currently, there is an issue where decimal values are not getting + processed correctly. Please use whole number values. We are working to + resolve this issue. Please contact Bandwidth Support if you need more + information. + 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 + recordingTranscriptions: + type: object + properties: + transcripts: + type: array + items: + $ref: '#/components/schemas/transcription' + clips: + type: array + description: >- + A list of individual speech clips with speaker, timing, and + confidence information. + items: + $ref: '#/components/schemas/recordingTranscriptionClip' + example: + transcripts: + - speaker: 0 + text: Hi, is Thursday at two still good for you? Perfect, talk soon. + confidence: 0.96 + - speaker: 1 + text: Yes, that works great. See you then! Sounds good, bye! + confidence: 0.97 + clips: + - speaker: 0 + text: Hi, is Thursday at two still good for you? + confidence: 0.97 + startTimeSeconds: 0.4 + endTimeSeconds: 3.1 + - speaker: 1 + text: Yes, that works great. See you then! + confidence: 0.95 + startTimeSeconds: 3.8 + endTimeSeconds: 6.2 + - speaker: 0 + text: Perfect, talk soon. + confidence: 0.94 + startTimeSeconds: 6.9 + endTimeSeconds: 8.1 + - speaker: 1 + text: Sounds good, bye! + confidence: 0.98 + startTimeSeconds: 8.5 + endTimeSeconds: 9.7 + recordingTranscriptionClip: + type: object + properties: + speaker: + type: integer + description: Zero-based index identifying the speaker. + example: 0 + text: + type: string + description: The transcribed text of this clip. + example: Hi there, thanks for calling! + confidence: + type: number + format: double + minimum: 0 + maximum: 1 + description: >- + How confident the transcription engine was in transcribing this clip + (from `0.0` to `1.0`). + example: 0.85 + startTimeSeconds: + type: number + format: double + description: The start time of this clip within the recording, in seconds. + example: 2.3 + endTimeSeconds: + type: number + format: double + description: The end time of this clip within the recording, in seconds. + example: 3.1 + callTranscriptionMetadataList: + type: array + items: + $ref: '#/components/schemas/callTranscriptionMetadata' + example: + - transcriptionId: t-3f758f24-c7a2fc78-7c91-401a-8b2e-e542f9c40d6b + transcriptionName: live_transcription + transcriptionUrl: >- + https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-fef240ff-5cfc9091-8069-4863-a8c0-a4dcbbf1f1a4/transcriptions/t-3f758f24-c7a2fc78-7c91-401a-8b2e-e542f9c40d6b + callTranscriptionMetadata: + type: object + properties: + transcriptionId: + type: string + description: The programmable voice API transcription ID. + example: t-3f758f24-c7a2fc78-7c91-401a-8b2e-e542f9c40d6b + transcriptionName: + type: string + description: >- + The programmable voice API transcription name. This name could be + provided by the user when creating the transcription. + example: live_transcription + transcriptionUrl: + type: string + description: >- + A URL that may be used to retrieve the transcription itself. This + points to the + + [Get Call + Transcription](/apis/voice-apis/voice/#tag/Transcriptions/operation/getRealTimeTranscription) + endpoint. + example: >- + https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-fef240ff-5cfc9091-8069-4863-a8c0-a4dcbbf1f1a4/transcriptions/t-3f758f24-c7a2fc78-7c91-401a-8b2e-e542f9c40d6b + callTranscriptionResponse: + type: object + properties: + accountId: + type: string + description: The user account associated with the call. + example: '9900000' + callId: + type: string + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + transcriptionId: + type: string + description: The programmable voice API transcription ID. + example: t-3f758f24-c7a2fc78-7c91-401a-8b2e-e542f9c40d6b + tracks: + type: array + items: + $ref: '#/components/schemas/callTranscription' + example: + - detectedLanguage: en-US + track: inbound + transcript: Hello World! This is an example. + confidence: 0.9 + callTranscription: + type: object + properties: + detectedLanguage: + $ref: '#/components/schemas/callTranscriptionDetectedLanguageEnum' + track: + $ref: '#/components/schemas/callTranscriptionTrackEnum' + transcript: + type: string + description: The transcription itself. + example: Hello World! This is an example. + confidence: + type: number + format: double + minimum: 0 + maximum: 1 + description: >- + How confident the transcription engine was in transcribing the + associated audio (from `0` to `1`). + example: 0.9 + recordingTranscriptionMetadata: + 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 + format: date-time + 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/applicationId1' + 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/applicationId1' + 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/applicationId1' + 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/applicationId1' + 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/applicationId1' + 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/applicationId1' + 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/applicationId1' + 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' + uui: + $ref: '#/components/schemas/uui' + 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/applicationId1' + 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/applicationId1' + 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/applicationId1' + 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/channels' + 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/applicationId1' + 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/applicationId1' + 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/applicationId1' + 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/applicationId1' + 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/applicationId1' + 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: '9900000' + applicationId1: + 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. Must be a phone number in E.164 + format (e.g. +15555555555). + 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). + 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 + recordingName: + type: string + description: A name to identify this recording. + example: my-recording-name + callUrl: + type: string + format: uri + 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: + speaker: + type: integer + description: Zero-based index identifying the speaker. + example: 0 + 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-Validation-Passed and TN-Validation-Failed. + example: Tn-Validation-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 + uui: + type: string + description: >- + 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`, `jwt` and `hex` encoding are currently allowed. This + value, including the encoding specifier, may not exceed 256 characters. + example: bXktdXVp + maxLength: 256 + 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: 1589228074636lm4k2je7j7jklbn2 + 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 + completedLookupStatusEnum: + type: string + enum: + - COMPLETE + - PARTIAL_COMPLETE + - FAILED + example: COMPLETE + inProgressLookupStatusEnum: + type: string + enum: + - IN_PROGRESS + - COMPLETE + - PARTIAL_COMPLETE + - FAILED + example: COMPLETE + deactivationEventEnum: + type: string + description: > + [DNI-Only](#section/DNI-Only). + + `DEACTIVATED` if the carrier reported a deactivation event for this + phone number. + enum: + - DEACTIVATED + latestMessageDeliveryStatusEnum: + type: string + description: >- + [DNI-Only](#section/DNI-Only). The current delivery status of the phone + number. + + - ACTIVE: A message was successfully sent to the number (delivery code + 0). + + - DEACTIVATED: A message was not delivered to a number (delivery code + 720) + + - UNKNOWN: Bandwidth cannot find an delivery status entry for the + number. + + - NOT_ENABLED: The phone number is not enabled for messaging, so there + is no delivery status information. + enum: + - ACTIVE + - DEACTIVATED + - UNKNOWN + - NOT_ENABLED + lineTypeEnum: + type: string + enum: + - FIXED + - VOIP-FIXED + - MOBILE + - VOIP + example: MOBILE + requestId: + type: string + format: uuid + description: The phone number lookup request ID from Bandwidth. + example: 004223a0-8b17-41b1-bf81-20732adf5590 + linkSchema: + title: Link + type: object + properties: + href: + type: string + description: URI of the link. + example: /relative/uri + rel: + type: string + description: Specifies the relationship between this link and the resource. + example: aRelatedResource + method: + type: string + description: HTTP method to be used. + example: GET + lookupErrorSchema: + type: object + required: + - code + - type + - description + properties: + code: + type: string + description: Validation error code + example: NO-MATCH + description: + type: string + description: Description of validation error + example: Example error description + type: + type: string + description: Type of validation error + example: NumberInventory + meta: + type: object + properties: + phoneNumbers: + type: array + items: + type: string + description: Phone number experiencing the error. + example: + - '+13992077164' + - '+19196104424' + message: + type: string + description: Message describing the error + example: Invalid TNs + code: + type: integer + description: Error code associated with the message + example: 1001 + syncLookupRequest: + type: object + properties: + phoneNumbers: + description: Telephone numbers in E.164 format. + type: array + minimum: 1 + maximum: 100 + items: + type: string + pattern: ^\+[1-9]\d{1,14}$ + rcsAgent: + type: string + description: >- + Override the default RCS sender/agent ID used when checking RCS + capabilities. + + When provided, this value is used as the `sender` in the RCS + capability-check request instead of the account default. + + Must be 1–40 characters and contain only letters, digits, + underscores, or hyphens. + pattern: ^[A-Za-z0-9_-]{1,40}$ + example: MyCustomRcsAgent + required: + - phoneNumbers + asyncLookupRequest: + type: object + properties: + phoneNumbers: + description: Telephone numbers in E.164 format. + type: array + minimum: 1 + maximum: 15000 + items: + type: string + pattern: ^\+[1-9]\d{1,14}$ + required: + - phoneNumbers + createSyncLookupResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/linkSchema' + example: [] + data: + type: object + description: The phone number lookup response data + properties: + requestId: + $ref: '#/components/schemas/requestId' + status: + $ref: '#/components/schemas/completedLookupStatusEnum' + results: + type: array + description: >- + The carrier information results for the specified telephone + numbers. + items: + $ref: '#/components/schemas/lookupResult' + errors: + type: array + items: + $ref: '#/components/schemas/lookupErrorSchema' + createAsyncBulkLookupResponse: + type: object + properties: + links: + type: array + description: Links for pagination (if applicable) + items: + $ref: '#/components/schemas/linkSchema' + data: + type: object + description: The phone number lookup response data + properties: + requestId: + $ref: '#/components/schemas/requestId' + status: + $ref: '#/components/schemas/inProgressLookupStatusEnum' + errors: + type: array + items: + $ref: '#/components/schemas/lookupErrorSchema' + getAsyncBulkLookupResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/linkSchema' + example: [] + data: + type: object + description: The phone number lookup response data + properties: + requestId: + $ref: '#/components/schemas/requestId' + status: + $ref: '#/components/schemas/inProgressLookupStatusEnum' + results: + type: array + description: >- + The carrier information results for the specified telephone + number. + items: + $ref: '#/components/schemas/lookupResult' + errors: + type: array + items: + $ref: '#/components/schemas/lookupErrorSchema' + lookupErrorResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/linkSchema' + example: [] + data: + type: object + description: The phone number lookup response data + errors: + type: array + items: + $ref: '#/components/schemas/lookupErrorSchema' + rcsErrorEnum: + type: string + description: >- + [RCS-Only](#section/RCS-Only). Error encountered during RCS capability + lookup. Appears as the `code` field in the top-level `errors` array. + + + **RCS service pass-through codes:** + + - `REQUEST_FAILED`: The RCS service returned this error code. + + - `UNKNOWN_CODE`: The RCS service returned this error code. + + - `INVALID_DESTINATION_ADDRESS`: The RCS service returned this error + code. + + - `UNKNOWN_STATUS: `: The RCS service returned an unrecognized + status code, where `` is the raw value. + + + **Service-level errors:** + + - `MISSING_FROM_RESPONSE`: The phone number was absent from the RCS + service response. + + - `RCS_SERVICE_UNAVAILABLE`: An exception was thrown during the async + RCS service call. + + - `RCS_SERVICE_DISABLED`: RCS lookup is disabled in configuration. + + - `EMPTY_RESPONSE`: The RCS service returned a null or empty response + body. + example: RCS_SERVICE_UNAVAILABLE + lookupResult: + type: object + description: Carrier information results for the specified telephone number. + properties: + phoneNumber: + type: string + description: The telephone number in E.164 format. + example: '+10072904498' + lineType: + $ref: '#/components/schemas/lineTypeEnum' + messagingProvider: + type: string + description: The messaging service provider of the telephone number. + example: Verizon Wireless + voiceProvider: + type: string + description: The voice service provider of the telephone number. + example: Verizon Wireless + countryCodeA3: + type: string + description: >- + The country code of the telephone number in ISO 3166-1 alpha-3 + format. + example: USA + deactivationReporter: + type: string + description: > + [DNI-Only](#section/DNI-Only). + + The carrier that reported a deactivation event for this phone + number. + deactivationDate: + type: string + format: date-time-local + description: >- + [DNI-Only](#section/DNI-Only). The datetime the carrier reported a + deactivation event. + example: 2025-06-20 18:35 + deactivationEvent: + $ref: '#/components/schemas/deactivationEventEnum' + latestMessageDeliveryStatus: + $ref: '#/components/schemas/latestMessageDeliveryStatusEnum' + initialMessageDeliveryStatusDate: + type: string + format: date + description: >- + [DNI-Only](#section/DNI-Only). The date the phone number entered the + status described in `latestMessageDeliveryStatus`. + + Think of this as the "start time" for that status. + + Value resets every time the `latestMessageDeliveryStatus` changes. + example: '2025-06-20' + latestMessageDeliveryStatusDate: + type: string + format: date + description: >- + [DNI-Only](#section/DNI-Only). The date bandwidth last received + delivery status information for this phone number. + + Use this field to understand how up-to-date the + `latestMessageDeliveryStatus` is. + + Value resets every time the `latestMessageDeliveryStatus` changes. + example: '2025-06-21' + rcsEnabled: + type: boolean + description: > + [RCS-Only](#section/RCS-Only). Indicates whether the phone number is + capable of receiving RCS messages. Value will be null if account has + RCS, but no value was returned. Absent when account does not have + RCS. + example: true + accountId1: + type: string + description: User's account ID. + example: '1234567' + tfPhoneNumber: + type: string + description: Toll-free telephone number in E.164 format. + minLength: 12 + maxLength: 12 + nullable: false + pattern: ^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$ + example: '+18005555555' + tfvWebhookErrors: + type: array + description: Details of the errors that were encountered when processing the request. + items: + type: string + example: 'optInWorkflowImageURLs: Entries must be a valid array of objects.' + tfvCallbackStatusEnum: + type: string + enum: + - VERIFIED + - UNVERIFIED + example: VERIFIED + tfvUnverifiedStatus: + type: string + default: UNVERIFIED + example: UNVERIFIED + declineReasonDescription: + type: string + description: Explanation for why a verification request was declined. + nullable: false + example: >- + Invalid Information - Can't Validate URL - Website is not accessible / + not available + denialStatusCode: + description: Reason code for denial. + type: integer + example: 511 + denialStatusCodeNullable: + description: Reason code for denial. + nullable: true + type: integer + example: 511 + resubmitAllowed: + description: >- + Whether a Toll-Free Verification request qualifies for resubmission via + PUT. + example: true + type: boolean + additionalDenialReason: + type: object + properties: + statusCode: + $ref: '#/components/schemas/denialStatusCode' + reason: + $ref: '#/components/schemas/declineReasonDescription' + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + required: + - statusCode + - reason + - resubmitAllowed + blocked: + description: >- + Whether a Toll-Free Verification is blocked. This attribute will only be + defined when the number is blocked. + example: true + type: boolean + blockedReason: + description: >- + The reason why the Toll-Free Verification is blocked. This attribute + will only be defined when the number is blocked. + example: Toll-free number was used to send spam messages + type: string + privacyPolicyUrl: + description: The Toll-Free Verification request privacy policy URL. + maxLength: 500 + example: http://your-company.com/privacyPolicy + type: string + termsAndConditionsUrl: + description: The Toll-Free Verification request terms and conditions policy URL. + maxLength: 500 + example: http://your-company.com/termsAndConditions + type: string + businessDba: + description: The company 'Doing Business As'. + maxLength: 500 + example: Another Company Name Inc. + type: string + businessRegistrationNumber: + type: string + description: > + Government-issued business identifying number. + + + **Note: As of October 19th, 2026 this field will be required when + `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is + provided, `businessRegistrationType` and + `businessRegistrationIssuingCountry` are also required.** + nullable: true + maxLength: 500 + example: 12-3456789 + businessRegistrationTypeEnum: + type: string + description: > + The type of business registration number. + + + **Note: As of October 19th, 2026 this field will be required when + `businessRegistrationNumber` is provided.** + enum: + - EIN + - CBN + - NEQ + - PROVINCIAL_NUMBER + - CRN + - VAT + - ACN + - ABN + - BRN + - SIREN + - SIRET + - NZBN + - UST_IDNR + - CIF + - NIF + - CNPJ + - UID + - OTHER + example: EIN + nullable: true + businessRegistrationIssuingCountry: + type: string + description: >- + The country issuing the business registration in ISO-3166-1 alpha-3 + format. Alpha-2 format is accepted by the API, but alpha-3 is highly + encouraged. + + + **Note: As of October 19th, 2026 this field will be required when + `businessRegistrationNumber` is provided.** + + + | Registration Type | Supported Countries | + + |----------------------|------------------------------------| + + | EIN | USA | + + | CBN | CAN | + + | NEQ | CAN | + + | PROVINCIAL_NUMBER | CAN | + + | CRN | GBR, HKG | + + | VAT | GBR, IRL, BRA, NLD | + + | ACN | AUS | + + | ABN | AUS | + + | BRN | HKG | + + | SIREN | FRA | + + | SIRET | FRA | + + | NZBN | NZL | + + | UST_IDNR | DEU | + + | CIF | ESP | + + | NIF | ESP | + + | CNPJ | BRA | + + | UID | CHE | + + | OTHER | Must Provide Country Code | + example: USA + nullable: true + businessEntityTypeEnum: + type: string + description: > + The type of registered business. + + + **Note: As of October 19th, 2026 submissions using a value other than + `SOLE_PROPRIETOR` must provide a value for `businessRegistrationNumber`, + `businessRegistrationType`, and `businessRegistrationIssuingCountry`. + + Submissions using `SOLE_PROPRIETOR` must _omit_ + `businessRegistrationNumber`, `businessRegistrationType`, and + `businessRegistrationIssuingCountry`. Failure to adhere to these + constraints will result in a 400 Bad Request rejection.** + enum: + - SOLE_PROPRIETOR + - PRIVATE_PROFIT + - PUBLIC_PROFIT + - NON_PROFIT + - GOVERNMENT + example: PRIVATE_PROFIT + nullable: false + helpMessageResponse: + type: string + description: A message that gets sent to users requesting help. + nullable: true + maxLength: 500 + example: Please contact support for assistance. + ageGatedContent: + type: boolean + description: Indicates whether the content is age-gated. + example: false + internalTicketNumber: + type: string + description: >- + Unique identifier (UUID) generated by Bandwidth to assist in tracking + the verification status of a toll-free number - included in all webhook + payloads. + example: acde070d-8c4c-4f0d-9d8a-162843c10333 + internalTicketNumberForWebhook: + type: string + description: >- + Unique identifier (UUID) generated by Bandwidth to assist in tracking + the verification status of a toll-free number. + example: acde070d-8c4c-4f0d-9d8a-162843c10333 + businessContactPhoneNumber: + description: Contact telephone number + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: '+19192654500' + verificationRequest: + type: object + required: + - businessAddress + - businessContact + - messageVolume + - phoneNumbers + - useCase + - useCaseSummary + - productionMessageContent + - optInWorkflow + - businessEntityType + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + phoneNumbers: + type: array + minItems: 1 + maxItems: 10 + items: + $ref: '#/components/schemas/tfPhoneNumber' + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + $ref: '#/components/schemas/useCaseSummary' + productionMessageContent: + $ref: '#/components/schemas/productionMessageContent' + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + type: string + description: Any additional information. + minLength: 0 + maxLength: 500 + nullable: true + example: Any additional information + isvReseller: + $ref: '#/components/schemas/isvReseller' + privacyPolicyUrl: + $ref: '#/components/schemas/privacyPolicyUrl' + termsAndConditionsUrl: + $ref: '#/components/schemas/termsAndConditionsUrl' + businessDba: + $ref: '#/components/schemas/businessDba' + businessRegistrationNumber: + $ref: '#/components/schemas/businessRegistrationNumber' + businessRegistrationType: + $ref: '#/components/schemas/businessRegistrationTypeEnum' + businessRegistrationIssuingCountry: + $ref: '#/components/schemas/businessRegistrationIssuingCountry' + businessEntityType: + $ref: '#/components/schemas/businessEntityTypeEnum' + helpMessageResponse: + $ref: '#/components/schemas/helpMessageResponse' + ageGatedContent: + $ref: '#/components/schemas/ageGatedContent' + cvToken: + $ref: '#/components/schemas/cvTokenNullable' + verificationUpdateRequest: + type: object + required: + - businessAddress + - businessContact + - messageVolume + - useCase + - useCaseSummary + - productionMessageContent + - optInWorkflow + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + $ref: '#/components/schemas/useCaseSummary' + productionMessageContent: + $ref: '#/components/schemas/productionMessageContent' + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + $ref: '#/components/schemas/additionalInformation' + isvReseller: + $ref: '#/components/schemas/isvReseller' + privacyPolicyUrl: + $ref: '#/components/schemas/privacyPolicyUrl' + termsAndConditionsUrl: + $ref: '#/components/schemas/termsAndConditionsUrl' + businessDba: + $ref: '#/components/schemas/businessDba' + businessRegistrationNumber: + $ref: '#/components/schemas/businessRegistrationNumber' + businessRegistrationType: + $ref: '#/components/schemas/businessRegistrationTypeEnum' + businessEntityType: + $ref: '#/components/schemas/businessEntityTypeEnum' + businessRegistrationIssuingCountry: + $ref: '#/components/schemas/businessRegistrationIssuingCountry' + helpMessageResponse: + $ref: '#/components/schemas/helpMessageResponse' + ageGatedContent: + $ref: '#/components/schemas/ageGatedContent' + cvToken: + $ref: '#/components/schemas/cvTokenNullable' + tfvBasicAuthentication: + type: object + properties: + username: + type: string + maxLength: 100 + example: username + password: + type: string + maxLength: 200 + example: password + required: + - username + - password + webhookSubscriptionRequestSchema: + type: object + properties: + basicAuthentication: + $ref: '#/components/schemas/tfvBasicAuthentication' + callbackUrl: + $ref: '#/components/schemas/webhookUrl' + sharedSecretKey: + $ref: '#/components/schemas/sharedSecretKey' + required: + - callbackUrl + failureWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + errorCode: + type: string + description: >- + An error code indicating what error was encountered. This code can + be interpreted as an HTTP status code in regards to the error that + was encountered. + example: '400' + errorMessage: + type: string + description: A description of the error that was encountered. + example: cannot process request. + errors: + $ref: '#/components/schemas/tfvWebhookErrors' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + verificationDenialWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + additionalDenialReasons: + description: >- + An optional list of denial reasons in addition to + declineReasonDescription when multiple reasons apply. + type: array + items: + $ref: '#/components/schemas/additionalDenialReason' + example: + - statusCode: 512 + reason: Reason A + resubmitAllowed: true + - statusCode: 513 + reason: Reason B + resubmitAllowed: true + declineReasonDescription: + $ref: '#/components/schemas/declineReasonDescription' + denialStatusCode: + $ref: '#/components/schemas/denialStatusCode' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + status: + $ref: '#/components/schemas/tfvUnverifiedStatus' + blocked: + $ref: '#/components/schemas/blocked' + blockedReason: + $ref: '#/components/schemas/blockedReason' + verificationWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + status: + $ref: '#/components/schemas/tfvCallbackStatusEnum' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + blockedWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + status: + $ref: '#/components/schemas/tfvCallbackStatusEnum' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + blocked: + $ref: '#/components/schemas/blocked' + blockedReason: + $ref: '#/components/schemas/blockedReason' + tfvSubmissionWrapper: + type: object + properties: + submission: + $ref: '#/components/schemas/verificationUpdateRequest' + address: + type: object + nullable: false + required: + - name + - addr1 + - city + - state + - zip + - url + properties: + name: + type: string + description: The name of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Bandwidth Inc. + addr1: + type: string + description: The address of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: 2230 Bandmate Way + addr2: + type: string + description: The address of the business using the toll-free number. + minLength: 0 + maxLength: 500 + nullable: true + example: 2230 Bandmate Way + city: + type: string + description: The city of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Raleigh + state: + type: string + description: The state of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: NC + zip: + type: string + description: The zip of the business using the toll-free number. + nullable: false + example: '27606' + pattern: '[- A-Za-z0-9]{0,500}' + url: + type: string + format: url + description: The website of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: https://www.example.com/path/to/resource + additionalInformation: + type: string + description: Any additional information. + minLength: 0 + maxLength: 500 + nullable: true + example: Any additional information + optInWorkflow: + type: object + nullable: false + required: + - description + - imageUrls + properties: + description: + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: Opt In Flow + imageUrls: + type: array + items: + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: https://www.example.com/path/to/resource + pattern: >- + ^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*) + confirmationResponse: + type: string + minLength: 0 + maxLength: 500 + nullable: true + example: Thank you for opting in! + isvReseller: + type: string + description: ISV name. + minLength: 0 + maxLength: 500 + nullable: true + example: Test ISV + contact: + type: object + nullable: false + required: + - firstName + - lastName + - email + - phoneNumber + properties: + firstName: + type: string + description: The first name of the business contact using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: John + lastName: + type: string + description: The last name of the business contact using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Doe + email: + $ref: '#/components/schemas/email' + phoneNumber: + $ref: '#/components/schemas/businessContactPhoneNumber' + email: + type: string + format: email + minLength: 0 + maxLength: 500 + nullable: false + pattern: >- + ^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$ + example: foo@bar.com + useCases: + type: array + items: + type: string + example: + - 2FA + - App Notifications + - Appointments + - Auctions + - Auto Repair Services + - Bank Transfers + - Billing + - Booking Confirmations + - Business Updates + - COVID-19 Alerts + useCase: + type: string + description: The category of the use case. + minLength: 0 + maxLength: 500 + example: 2FA + useCaseSummary: + type: string + description: A general idea of the use case and customer. + minLength: 0 + maxLength: 500 + nullable: false + example: Text summarizing the use case for the toll-free number + productionMessageContent: + type: string + description: Example of message content. + minLength: 0 + maxLength: 500 + nullable: false + example: Production message content + webhookSubscriptionsListBody: + description: >- + A list of all webhook subscriptions registered for this account ID for + this particular feature (unpaginated). + type: object + required: + - data + properties: + links: + $ref: '#/components/schemas/linksObject' + errors: + type: array + items: + $ref: '#/components/schemas/webhookSubscriptionError' + data: + items: + $ref: '#/components/schemas/webhookSubscription' + type: array + linksObject: + type: object + properties: + first: + description: The first (or only) page of results matching the query. + type: string + next: + description: >- + If more results exist than specified by 'size', this link returns + the next page of 'size' results. + type: string + previous: + description: >- + If the results are more than one page, this link returns the + previous page of 'size' results. + type: string + last: + description: >- + If more results exist than specified by 'size', this link return the + last page of result. + type: string + webhookSubscriptionError: + type: object + properties: + code: + type: integer + description: + type: string + telephoneNumbers: + type: array + items: + $ref: '#/components/schemas/telephoneNumber' + telephoneNumber: + type: object + properties: + telephoneNumber: + description: Simple Telephone Number. + type: string + webhookSubscriptionTypeEnum: + type: string + enum: + - TOLLFREE_VERIFICATION_STATUS + - MESSAGING_PORTOUT_APPROVAL_STATUS + example: TOLLFREE_VERIFICATION_STATUS + webhookSubscription: + description: >- + Information about a webhook that Bandwidth should send upon the + completion of event customer has subscribed to. + type: object + required: + - callbackUrl + properties: + id: + type: string + example: 7hICGStfAfeGxEq3N0lQwO + accountId: + type: string + example: '1234567' + callbackUrl: + $ref: '#/components/schemas/webhookUrl' + type: + $ref: '#/components/schemas/webhookSubscriptionTypeEnum' + basicAuthentication: + description: >- + Basic authentication credentials are not required, but if present, + both username and password must be provided. + type: object + required: + - username + - password + properties: + username: + type: string + maxLength: 100 + password: + type: string + maxLength: 200 + createdDate: + type: string + format: date-time + example: '2023-05-15T13:56:39.965Z' + modifiedDate: + type: string + format: date-time + example: '2023-05-15T13:56:39.965Z' + webhookUrl: + description: >- + Callback URL to receive status updates from Bandwidth. When a webhook + subscription is registered with Bandwidth under a given account ID, it + will be used to send status updates for all requests submitted under + that account ID. + type: string + format: url + minLength: 0 + maxLength: 2000 + nullable: true + example: https://www.example.com/path/to/resource + pattern: >- + ^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*) + tfvError: + description: A generic error object. + properties: + type: + type: string + example: Error Type + description: + type: string + example: Error Message + errors: + type: object + description: >- + Each key of this errors object refers to a field of the submitted + object (using dot notation for nested objects), with the field being + a key to an array of one or more errors for that field. + example: + field: error message + type: object + tfvStatus: + type: object + properties: + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + status: + $ref: '#/components/schemas/tfvStatusEnum' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumber' + declineReasonDescription: + $ref: '#/components/schemas/declineReasonDescription' + denialStatusCode: + $ref: '#/components/schemas/denialStatusCodeNullable' + additionalDenialReasons: + description: >- + An optional list of denial reasons in addition to + declineReasonDescription when multiple reasons apply. + nullable: true + type: array + items: + $ref: '#/components/schemas/additionalDenialReason' + example: + - statusCode: 512 + reason: Reason A + resubmitAllowed: true + - statusCode: 513 + reason: Reason B + resubmitAllowed: true + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + createdDateTime: + type: string + description: Date and time the verification request was created. + format: date-time + example: '2021-06-08T06:45:13.0Z' + modifiedDateTime: + type: string + description: Date and time the verification request was last modified. + format: date-time + example: '2021-06-08T06:45:13.0Z' + submission: + $ref: '#/components/schemas/tfvSubmissionInfo' + blocked: + $ref: '#/components/schemas/blocked' + blockedReason: + $ref: '#/components/schemas/blockedReason' + cvToken: + $ref: '#/components/schemas/cvTokenNullable' + tfvSubmissionInfo: + type: object + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + $ref: '#/components/schemas/useCaseSummary' + productionMessageContent: + $ref: '#/components/schemas/productionMessageContent' + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + $ref: '#/components/schemas/additionalInformation' + isvReseller: + $ref: '#/components/schemas/isvReseller' + privacyPolicyUrl: + $ref: '#/components/schemas/privacyPolicyUrl' + termsAndConditionsUrl: + $ref: '#/components/schemas/termsAndConditionsUrl' + businessDba: + $ref: '#/components/schemas/businessDba' + businessRegistrationNumber: + $ref: '#/components/schemas/businessRegistrationNumber' + description: Government-issued business identifying number. + businessRegistrationType: + $ref: '#/components/schemas/businessRegistrationTypeEnum' + description: The type of business registration number. + businessRegistrationIssuingCountry: + $ref: '#/components/schemas/businessRegistrationIssuingCountry' + description: >- + The country issuing the business registration in ISO-3166-1 alpha-3 + format. + businessEntityType: + $ref: '#/components/schemas/businessEntityTypeEnum' + description: The type of registered business. + tfvStatusEnum: + type: string + enum: + - VERIFIED + - UNVERIFIED + - PENDING + example: VERIFIED + sharedSecretKey: + description: >- + An ASCII string submitted by the user as a shared secret key for + generating an HMAC header for callbacks. + example: This is my $3cret + maxLength: 64 + minLength: 16 + nullable: true + pattern: ^[ -~]{16,64}$ + type: string + cvTokenNullable: + type: string + description: >- + The token provided by Campaign Verify to validate your political use + case. Only required for 527 political organizations. If you are not a + 527 political organization, this field should be omitted. Supplying an + empty string will likely result in rejection. + minLength: 0 + maxLength: 500 + nullable: true + example: >- + cv.user123|sess456|mno|tfree|read_write|X7yZ9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789aBcDeFgHiJkLmNoPqRsTuVw + endpointId: + type: string + description: The unique ID of the endpoint. + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + endpointStatusEnum: + type: string + enum: + - CONNECTED + - DISCONNECTED + deviceStatusEnum: + type: string + enum: + - CONNECTED + - DISCONNECTED + endpointTypeEnum: + type: string + enum: + - WEBRTC + endpointDirectionEnum: + type: string + enum: + - INBOUND + - OUTBOUND + - BIDIRECTIONAL + sipCredentials: + type: object + properties: + username: + type: string + description: The username for the SIP connection. + example: username + password: + type: string + description: The password for the SIP connection. + example: password + sipConnectionMetadata: + title: SIP Connection + type: object + properties: + ipAddress: + type: string + format: ipv4 + description: The IP address of the SIP connection. + example: 192.168.0.0 + port: + type: integer + description: The port of the SIP connection. + example: 5060 + credentials: + $ref: '#/components/schemas/sipCredentials' + uuiHeader: + type: string + description: The User-to-User Information header for the SIP connection. + example: my-uui-header + webRtcConnectionMetadata: + title: WebRTC Connection + type: object + endpointToken: + type: string + description: >- + The json web token specific to the endpoint. Used to authenticate the + client with the media gateway. + example: xxxxx.yyyyy.zzzzz + endpointTag: + type: string + description: A tag for the endpoint. + example: my-tag + maximum: 1024 + device: + type: object + properties: + deviceId: + type: string + description: The unique ID of the device. + example: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: + type: string + description: The name of the device. + maximum: 1024 + example: David's iPhone + status: + $ref: '#/components/schemas/deviceStatusEnum' + creationTimestamp: + type: string + format: date-time + description: The time the device was created. In ISO-8601 format. + example: '2021-01-01T00:00:00Z' + required: + - deviceId + - status + - creationTimestamp + endpoints: + type: object + properties: + endpointId: + $ref: '#/components/schemas/endpointId' + type: + $ref: '#/components/schemas/endpointTypeEnum' + status: + $ref: '#/components/schemas/endpointStatusEnum' + creationTimestamp: + type: string + format: date-time + description: The time the endpoint was created. In ISO-8601 format. + example: '2021-01-01T00:00:00Z' + expirationTimestamp: + type: string + format: date-time + description: >- + The time the endpoint token will expire. In ISO-8601 format. Tokens + last 24 hours. + example: '2021-01-02T00:00:00Z' + tag: + $ref: '#/components/schemas/endpointTag' + required: + - endpointId + - type + - status + - creationTimestamp + - expirationTimestamp + endpoint: + type: object + allOf: + - $ref: '#/components/schemas/endpoints' + - type: object + properties: + devices: + type: array + items: + $ref: '#/components/schemas/device' + createWebRtcConnectionRequest: + allOf: + - $ref: '#/components/schemas/createEndpointRequestBase' + - type: object + properties: + connectionMetadata: + $ref: '#/components/schemas/webRtcConnectionMetadata' + createEndpointRequestBase: + type: object + properties: + type: + $ref: '#/components/schemas/endpointTypeEnum' + direction: + $ref: '#/components/schemas/endpointDirectionEnum' + eventCallbackUrl: + type: string + format: uri + description: The URL to send event callbacks to. + example: https://myapp.com/callback + eventFallbackUrl: + type: string + format: uri + description: The URL to send event fallbacks to. + example: https://fallback.myapp.com/callback + tag: + $ref: '#/components/schemas/endpointTag' + required: + - type + - direction + createEndpointRequest: + oneOf: + - $ref: '#/components/schemas/createWebRtcConnectionRequest' + discriminator: + propertyName: type + mapping: + WEBRTC: '#/components/schemas/createWebRtcConnectionRequest' + createEndpointResponseData: + allOf: + - $ref: '#/components/schemas/endpoint' + - type: object + properties: + token: + $ref: '#/components/schemas/endpointToken' + required: + - token + endpointEventTypeEnum: + type: string + enum: + - DEVICE_CONNECTED + - DEVICE_DISCONNECTED + endpointEvent: + description: An event that occurred on an endpoint. + allOf: + - $ref: '#/components/schemas/endpoints' + - type: object + properties: + eventTime: + type: string + format: date-time + description: The time the event occurred. In ISO-8601 format. + example: '2021-01-01T00:00:00Z' + eventType: + $ref: '#/components/schemas/endpointEventTypeEnum' + device: + $ref: '#/components/schemas/device' + required: + - eventType + - eventTime + brtcLink: + type: object + properties: + href: + type: string + description: The full URL of the link. + example: >- + https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + rel: + type: string + description: The relationship of the link to the current resource. + example: self + method: + type: string + description: The HTTP method to use when making the request. + example: GET + page: + type: object + properties: + pageSize: + type: integer + description: The number of items per page. + minimum: 0 + example: 10 + totalElements: + type: integer + description: The total number of items. + minimum: 0 + example: 100 + totalPages: + type: integer + description: The total number of pages. + minimum: 0 + example: 10 + pageNumber: + type: integer + description: The current page number. + minimum: 0 + example: 0 + required: + - pageSize + brtcError: + type: object + properties: + id: + type: string + format: uuid + description: A unique identifier for the error. + example: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: + type: string + description: The type of error. + example: resource.not_found + description: + type: string + description: A description of the error. + example: The requested resource was not found. + code: + type: string + description: A code that uniquely identifies the error. + example: '404' + source: + $ref: '#/components/schemas/brtcErrorSource' + required: + - type + - description + brtcErrorSource: + type: object + properties: + parameter: + type: string + description: The URI parameter that caused the error. + example: accountId + field: + type: string + description: The request body field that caused the error. + example: accountId + header: + type: string + description: The header that caused the error. + example: Authorization + reference: + type: string + description: >- + The resource ID or path to the resource (or non-existent resource) + causing the error. + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + listEndpointsResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/brtcLink' + page: + $ref: '#/components/schemas/page' + data: + type: array + items: + $ref: '#/components/schemas/endpoints' + errors: + type: array + items: + $ref: '#/components/schemas/brtcError' + required: + - links + - data + - errors + endpointResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/brtcLink' + data: + $ref: '#/components/schemas/endpoint' + errors: + type: array + items: + $ref: '#/components/schemas/brtcError' + required: + - links + - data + - errors + createEndpointResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/brtcLink' + data: + $ref: '#/components/schemas/createEndpointResponseData' + errors: + type: array + items: + $ref: '#/components/schemas/brtcError' + required: + - links + - data + - errors + brtcErrorResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/brtcLink' + data: + type: object + nullable: true + additionalProperties: false + errors: + type: array + items: + $ref: '#/components/schemas/brtcError' + required: + - links + - data + - errors + responses: + createMessageResponse: + description: Accepted + content: + application/json: + schema: + $ref: '#/components/schemas/message' + createMultiChannelMessageResponse: + description: Accepted + content: + application/json: + schema: + $ref: '#/components/schemas/createMultiChannelMessageResponse' + 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' + messagingMethodNotAllowedError: + description: Method Not Allowed + 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' + multiChannelBadRequestError: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: request-validation + description: >- + The 'channelList[0].from' field must contain exactly one + telephone number + source: + field: channelList[0].from + multiChannelNotAcceptableError: + description: Not Acceptable + multiChannelUnauthorizedError: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: unauthorized + description: Authentication Failed + source: {} + multiChannelForbiddenError: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: forbidden + description: Access Denied + source: {} + multiChannelNotFoundError: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: forbidden + description: Resource not found. + source: {} + multiChannelMethodNotAllowedError: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: method-not-allowed + description: Method 'PUT' not supported for this resource. + source: {} + multiChannelInvalidMediaTypeError: + description: Unsupported Media Type + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: unsupported-content-type + description: >- + Content-Type 'application/xml;charset=UTF-8' is not supported. + Please use 'application/json' + source: + header: Content-Type + multiChannelTooManyRequestsError: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: rate-limit-exceeded + description: >- + You have exceeded your rate limit for this endpoint. Please + retry later. + source: {} + multiChannelInternalServerError: + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: internal-server-error + description: Internal server error. No further information available + source: {} + listMessagesTooManyRequestsError: + description: Too Many Requests + headers: + Retry-After: + description: The number of seconds to wait before retrying the request. + schema: + type: integer + example: 300 + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + example: + type: rate_limit_exceeded + description: >- + Rate limit exceeded. Wait for Retry-After time before sending + another request. + createCallResponse: + description: 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: OK + content: + application/json: + schema: + $ref: '#/components/schemas/callState' + updateCallResponse: + description: OK + listCallsResponse: + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/callState' + getStatisticsResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/accountStatistics' + updateRecordingResponse: + description: OK + listCallRecordingsResponse: + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/callRecordingMetadata' + getCallRecordingResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/callRecordingMetadata' + downloadRecordingMediaResponse: + description: OK + content: + audio/vnd.wave: + schema: + type: string + format: binary + audio/mpeg: + schema: + type: string + format: binary + getRecordingTranscriptionResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/recordingTranscriptions' + listTranscriptionsResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/callTranscriptionMetadataList' + getCallTranscriptionResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/callTranscriptionResponse' + deleteCallTranscriptionResponse: + description: No Content + listConferencesResponse: + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/conference' + examples: + listConferences Response: + $ref: '#/components/examples/listConferencesResponseExample' + getConferenceResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/conference' + getConferenceMemberResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/conferenceMember' + listConferenceRecordingsResponse: + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/conferenceRecordingMetadata' + getConferenceRecordingResponse: + description: OK + 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' + createSyncLookupResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/createSyncLookupResponse' + examples: + lookupCompleteWithDniExample: + $ref: '#/components/examples/lookupCompleteWithDniExample' + lookupCompleteExample: + $ref: '#/components/examples/lookupCompleteExample' + lookupCompleteWithRcsExample: + $ref: '#/components/examples/lookupCompleteWithRcsExample' + lookupCompleteWithRcsErrorExample: + $ref: '#/components/examples/lookupCompleteWithRcsErrorExample' + lookupPartialExample: + $ref: '#/components/examples/lookupPartialExample' + lookupFailedExample: + $ref: '#/components/examples/lookupFailedExample' + createAsyncBulkLookupResponse: + description: Accepted + content: + application/json: + schema: + $ref: '#/components/schemas/createAsyncBulkLookupResponse' + examples: + lookupAcceptedExample: + $ref: '#/components/examples/lookupAcceptedExample' + getAsyncBulkLookupResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/getAsyncBulkLookupResponse' + examples: + lookupCompleteWithDniExample: + $ref: '#/components/examples/lookupCompleteWithDniExample' + lookupCompleteExample: + $ref: '#/components/examples/lookupCompleteExample' + lookupInProgressExample: + $ref: '#/components/examples/lookupInProgressExample' + lookupPartialExample: + $ref: '#/components/examples/lookupPartialExample' + lookupFailedExample: + $ref: '#/components/examples/lookupFailedExample' + tnLookupDefaultResponse: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/lookupErrorResponse' + examples: + badRequest: + $ref: '#/components/examples/badRequestExample' + unauthorized: + $ref: '#/components/examples/unauthorizedExample' + forbidden: + $ref: '#/components/examples/forbiddenExample' + mediaType: + $ref: '#/components/examples/unsupportedMediaTypeExample' + notFound: + $ref: '#/components/examples/notFoundExample' + tooManyRequests: + $ref: '#/components/examples/tooManyRequestsExample' + internalServer: + $ref: '#/components/examples/internalServerErrorExample' + getTollFreeVerificationStatusResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/tfvStatus' + listWebhookSubscriptionsResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscriptionsListBody' + createWebhookSubscriptionResponse: + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + updateWebhookSubscriptionResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + listTollFreeUseCasesResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/useCases' + tfvBadRequestResponse: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Cannot process request. + type: bad request + noContentResponse: + description: No Content + tfvPostBadRequestResponse: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: cannot process request. + errors: + businessName: Business name is required. + businessContactEmail: Business contact email is not a valid email address. + optInWorkflowImageURLs: Entries must be a valid array of objects. + tfvUnauthorizedResponse: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + tfvForbiddenResponse: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Client is not authorized for the action. + type: forbidden + tfvNotFoundResponse: + description: Cannot find the requested resource. + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Cannot find the requested resource. + type: Not Found + tfvNotAllowedResponse: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Method is not allowed. + type: Method Not Allowed + tfvTooManyRequestsResponse: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Throttling error. Too many requests. + type: Too Many Requests + tfvServerErrorResponse: + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Internal Server Error. + type: Internal Server Error + tfvServiceUnavailableResponse: + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Service Unavailable Error. + type: Service Unavailable + verifyPutResponse: + description: Accepted + listEndpointsResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/listEndpointsResponse' + examples: + listEndpointsResponseExample: + $ref: '#/components/examples/listEndpointsResponseExample' + createEndpointResponse: + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/createEndpointResponse' + examples: + createEndpointResponseExample: + $ref: '#/components/examples/createEndpointResponseExample' + getEndpointResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/endpointResponse' + examples: + getEndpointResponseExample: + $ref: '#/components/examples/getEndpointResponseExample' + badRequestErrorResponse: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/brtcErrorResponse' + examples: + badRequestErrorExample: + $ref: '#/components/examples/badRequestErrorExample' + unauthorizedErrorResponse: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/brtcErrorResponse' + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/unauthorizedErrorExample' + forbiddenErrorResponse: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/brtcErrorResponse' + examples: + forbiddenErrorExample: + $ref: '#/components/examples/forbiddenErrorExample' + notFoundErrorResponse: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/brtcErrorResponse' + examples: + notFoundErrorExample: + $ref: '#/components/examples/notFoundErrorExample' + methodNotAllowedErrorResponse: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/brtcErrorResponse' + examples: + methodNotAllowedErrorExample: + $ref: '#/components/examples/methodNotAllowedErrorExample' + unsupportedMediaTypeErrorResponse: + description: Unsupported Media Type + content: + application/json: + schema: + $ref: '#/components/schemas/brtcErrorResponse' + examples: + unsuppotedMediaTypeErrorExample: + $ref: '#/components/examples/unsupportedMediaTypeErrorExample' + tooManyRequestsErrorResponse: + description: Too Many Requests + headers: + Retry-After: + description: >- + The number of seconds the client should wait before making another + request. + required: true + schema: + type: integer + example: 900 + content: + application/json: + schema: + $ref: '#/components/schemas/brtcErrorResponse' + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/tooManyRequestsErrorExample' + serviceUnavailableErrorResponse: + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/brtcErrorResponse' + examples: + serviceUnavailableErrorExample: + $ref: '#/components/examples/serviceUnavailableErrorExample' + 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 + fromBwLatency: + in: query + name: fromBwLatency + required: false + description: >- + The minimum Bandwidth latency of the message in seconds. Only available + for accounts with the Advanced Quality Metrics feature enabled. + example: 5 + schema: + type: integer + bwQueued: + in: query + name: bwQueued + required: false + description: >- + A boolean value indicating whether the message is queued in the + Bandwidth network. + example: true + schema: + type: boolean + product: + in: query + name: product + required: false + description: Messaging product associated with the message. + example: P2P + schema: + $ref: '#/components/schemas/productTypeEnum' + location: + in: query + name: location + required: false + description: Location Id associated with the message. + example: 123ABC + schema: + type: string + carrierQueued: + in: query + name: carrierQueued + required: false + description: >- + A boolean value indicating whether the message is queued in the carrier + network. Only available for OUTBOUND messages from accounts with the + Advanced Quality Metrics feature enabled. + example: true + schema: + type: boolean + fromCarrierLatency: + in: query + name: fromCarrierLatency + required: false + description: >- + The minimum carrier latency of the message in seconds. Only available + for OUTBOUND messages from accounts with the Advanced Quality Metrics + feature enabled. + example: 50 + schema: + type: integer + callingNumberCountryA3: + in: query + name: callingNumberCountryA3 + required: false + description: Calling number country in A3 format. + example: USA + schema: + type: string + calledNumberCountryA3: + in: query + name: calledNumberCountryA3 + required: false + description: Called number country in A3 format. + example: USA + schema: + type: string + fromSegmentCount: + in: query + name: fromSegmentCount + required: false + description: Segment count (start range). + example: 1 + schema: + type: integer + toSegmentCount: + in: query + name: toSegmentCount + required: false + description: Segment count (end range). + example: 3 + schema: + type: integer + fromMessageSize: + in: query + name: fromMessageSize + required: false + description: Message size (start range). + example: 100 + schema: + type: integer + toMessageSize: + in: query + name: toMessageSize + required: false + description: Message size (end range). + example: 120 + schema: + type: integer + 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 + transcriptionId: + name: transcriptionId + in: path + required: true + schema: + type: string + description: Programmable Voice API Transcription ID. + example: t-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 + minStartTimeCalls: + name: minStartTime + in: query + required: false + schema: + type: string + description: >- + Filter results to calls which have a `startTime` after or including + `minStartTime` (in ISO8601 format). + example: '2022-06-21T19:13:21Z' + maxStartTimeCalls: + name: maxStartTime + in: query + required: false + schema: + type: string + description: >- + Filter results to calls which have a `startTime` before or including + `maxStartTime` (in ISO8601 format). + example: '2022-06-21T19:13:21Z' + pageSizeCalls: + name: pageSize + in: query + required: false + schema: + type: integer + format: int32 + minimum: 1 + maximum: 10000 + default: 1000 + description: Specifies the max number of calls 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. + example: eyJwYWdlVG9rZW4iOiJ0b2tlbiJ9 + disconnectCause: + name: disconnectCause + in: query + required: false + schema: + type: string + description: Filter results to calls with specified call Disconnect Cause. + example: hangup + accountId1: + in: path + name: accountId + required: true + schema: + type: string + description: Your Bandwidth Account ID. + example: '9900000' + requestId: + in: path + name: requestId + required: true + schema: + type: string + format: uuid + description: The phone number lookup request ID from Bandwidth. + example: 004223a0-8b17-41b1-bf81-20732adf5590 + tfPhoneNumberPathParam: + in: path + name: phoneNumber + required: true + schema: + $ref: '#/components/schemas/tfPhoneNumber' + description: Valid Toll-Free telephone number in E.164 format. + example: '+18885555555' + webhookSubscriptionIdPathParam: + in: path + name: id + required: true + schema: + type: string + description: Webhook subscription ID + example: 7bt57JcsVYJrN9K1OcV1Nu + endpointId: + name: endpointId + in: path + required: true + schema: + type: string + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + description: BRTC Endpoint ID. + endpointType: + name: type + in: query + schema: + $ref: '#/components/schemas/endpointTypeEnum' + description: The type of endpoint. + endpointStatus: + name: status + in: query + schema: + $ref: '#/components/schemas/endpointStatusEnum' + description: The status of the endpoint. + afterCursor: + name: afterCursor + in: query + schema: + type: string + example: TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ== + description: >- + The cursor to use for pagination. This is the value of the `next` link + in the previous response. + limit1: + name: limit + in: query + schema: + type: integer + minimum: 1 + maximum: 1000 + default: 100 + example: 2 + description: The maximum number of endpoints to return in the response. + examples: + smsMessageReceivedCallbackExample: + summary: An example of a sms message-received callback body. + value: + time: '2025-01-06T15:43:35.502180Z' + type: message-received + to: '+12345678902' + description: Incoming message received + message: + id: 14762070468292kw2fuqty55yp2b2 + owner: '+12345678902' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: '2025-01-06T15:43:34.000000Z' + segmentCount: 1 + direction: in + to: + - '+12345678902' + from: '+12345678901' + text: Hey, check out this SMS! + mmsMessageReceivedCallbackExample: + summary: An example of a mms message-received callback body. + value: + time: '2024-09-14T18:20:45.160744Z' + type: message-received + to: '+12345678902' + description: Incoming message received + message: + id: 14762070468292kw2fuqty55yp2b2 + owner: '+12345678902' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + time: '2024-09-14T18:20:45.160744Z' + segmentCount: 1 + direction: in + to: + - '+12345678902' + - '+12345678903' + from: '+12345678901' + text: Hey, check out the MMS! + media: + - >- + https://messaging.bandwidth.com/api/v2/users/9900902/media/14762070468292kw2fuqty55yp2b2/0/bw.png + messageSendingCallbackExample: + summary: An example of a message-sending callback body. + value: + time: '2024-06-25T18:42:36.979456Z' + type: message-sending + to: '+15554443333' + description: Message is sending to carrier. + message: + id: 1593110555875xo7watq5px6rbe5d + owner: '+15552221111' + applicationId: cfd4fb83-7531-4acc-b471-42d0bb76a65c + time: '2024-06-25T18:42:35.876906Z' + segmentCount: 1 + direction: out + to: + - '+15554443333' + from: '+15552221111' + text: '' + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + tag: your tag here + messageSentCallbackExample: + summary: An example of a message-sent callback body. + value: + time: '2024-06-25T18:42:36.979456Z' + type: message-sent + to: '+15554443333' + description: Message sent to carrier + message: + id: 1593110555875xo7watq5px6rbe5d + owner: '+15552221111' + applicationId: cfd4fb83-7531-4acc-b471-42d0bb76a65c + time: '2024-06-25T18:42:35.876906Z' + segmentCount: 1 + direction: out + to: + - '+15554443333' + from: '+15552221111' + text: '' + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + tag: v2 lab + smsMessageDeliveredCallbackExample: + summary: An example of a sms message-delivered callback body. + value: + type: message-delivered + time: '2024-09-14T18:20:11.160744Z' + description: Message delivered to handset. + to: '+12345678902' + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-09-14T18:20:11.160744Z' + to: + - '+12345678902' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: '+12345678902' + direction: out + segmentCount: 1 + mmsMessageDeliveredCallbackExample: + summary: An example of a mms message-delivered callback body. + value: + type: message-delivered + time: '2024-09-14T18:20:24.160544Z' + description: Message delivered to handset. + to: '+12345678902' + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-09-14T18:20:24.160544Z' + to: + - '+12345678902' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: '+12345678902' + direction: out + segmentCount: 1 + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + groupMmsMessageDeliveredCallbackExample: + summary: An example of a group mms message-delivered callback body. + value: + type: message-delivered + time: '2024-09-14T18:20:17.160544Z' + description: Message delivered to handset. + to: '+12345678902' + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-09-14T18:20:17.160544Z' + to: + - '+12345678902' + - '+12345678903' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + owner: '+12345678902' + direction: out + segmentCount: 1 + messageFailedCallbackExample: + summary: An example of a message-failed callback body. + value: + type: message-failed + time: '2024-12-18T16:51:27.704450Z' + description: forbidden to country + to: '+52345678903' + errorCode: 4432 + message: + id: 14762070468292kw2fuqty55yp2b2 + time: '2024-12-18T16:51:27.704450Z' + to: + - '+12345678902' + - '+52345678903' + from: '+12345678901' + text: '' + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + owner: '+12345678901' + direction: out + segmentCount: 1 + 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 + answerFallbackUrl: https://myServer.example/bandwidth/webhooks/answerFallback + 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: Number Lookup Request + value: + phoneNumbers: + - '+19196104423' + multipleNumberRequestExample: + summary: Number Lookup Request for Multiple Numbers + value: + phoneNumbers: + - '+19196104423' + - '+19196104424' + rcsAgentRequestExample: + summary: Number Lookup Request with Custom RCS Agent + value: + phoneNumbers: + - '+19196104423' + - '+19196104424' + rcsAgent: MyCustomRcsAgent + lookupAcceptedExample: + summary: Numbers Lookup Accepted + value: + links: + - href: >- + /accounts/9912345/phoneNumberLookup/bulk/004223a0-8b17-41b1-bf81-20732adf5590 + rel: createdRequest + method: GET + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: IN_PROGRESS + results: [] + errors: [] + lookupInProgressExample: + summary: Numbers Lookup In Progress + value: + links: [] + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: IN_PROGRESS + results: [] + errors: [] + lookupFailedExample: + summary: Numbers Lookup Failed + value: + links: [] + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: FAILED + results: [] + errors: + - code: NO-MATCH + description: The following TNs could not be found in the Number Industry data + meta: + phoneNumbers: + - '+13992077164' + message: Invalid TNs + code: 1001 + type: NumberInventory + lookupPartialExample: + summary: Numbers Lookup Partial Complete + value: + links: [] + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: PARTIAL_COMPLETE + results: + - phoneNumber: '+19196104423' + lineType: MOBILE + messagingProvider: Verizon Wireless + voiceProvider: Verizon Wireless + countryCodeA3: USA + - phoneNumber: '+19196104424' + lineType: MOBILE + messagingProvider: T-Mobile USA + voiceProvider: T-Mobile USA + countryCodeA3: USA + errors: + - code: NO-MATCH + description: The following TNs could not be found in the Number Industry data + meta: + phoneNumbers: + - '+13992077164' + message: Invalid TNs + code: 1001 + type: NumberInventory + lookupCompleteExample: + summary: Numbers Lookup Complete (without DNI) + value: + links: [] + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + results: + - phoneNumber: '+10072904497' + lineType: MOBILE + messagingProvider: Verizon Wireless + voiceProvider: Verizon Wireless + countryCodeA3: USA + - phoneNumber: '+10072904498' + lineType: MOBILE + messagingProvider: T-Mobile USA + voiceProvider: T-Mobile USA + countryCodeA3: USA + errors: [] + lookupCompleteWithDniExample: + summary: Numbers Lookup Complete (with DNI) + value: + links: [] + data: + requestId: 20732adf-bf81-8b17-41b1-004223a05590 + status: COMPLETE + results: + - phoneNumber: '+10072904497' + countryCodeA3: USA + lineType: MOBILE + messagingProvider: T-MOBILE USA INC + voiceProvider: T-MOBILE USA INC + latestMessageDeliveryStatus: ACTIVE + initialMessageDeliveryStatusDate: '2025-05-14' + latestMessageDeliveryStatusDate: '2025-05-18' + - phoneNumber: '+10072904498' + countryCodeA3: USA + lineType: MOBILE + voiceProvider: VERIZON + latestMessageDeliveryStatus: DEACTIVATED + initialMessageDeliveryStatusDate: '2025-09-05' + latestMessageDeliveryStatusDate: '2025-09-05' + - phoneNumber: '+10072904499' + lineType: MOBILE + countryCodeA3: USA + messagingProvider: VERIZON + voiceProvider: VERIZON + deactivationReporter: Verizon Wireless + deactivationDate: '2025-09-29 01:23:00' + deactivationEvent: DEACTIVATED + latestMessageDeliveryStatus: UNKNOWN + - phoneNumber: '+10072904500' + lineType: FIXED + countryCodeA3: USA + voiceProvider: VERIZON + deactivationReporter: Verizon Wireless + deactivationDate: '2025-09-29 01:23:00' + deactivationEvent: DEACTIVATED + latestMessageDeliveryStatus: NOT_ENABLED + errors: [] + lookupCompleteWithRcsExample: + summary: Numbers Lookup Complete (with RCS) + value: + links: [] + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + results: + - phoneNumber: '+10072904497' + lineType: MOBILE + messagingProvider: Verizon Wireless + voiceProvider: Verizon Wireless + countryCodeA3: USA + rcsEnabled: true + - phoneNumber: '+10072904498' + lineType: MOBILE + messagingProvider: T-Mobile USA + voiceProvider: T-Mobile USA + countryCodeA3: USA + rcsEnabled: false + errors: [] + lookupCompleteWithRcsErrorExample: + summary: Numbers Lookup Complete (with RCS error) + value: + links: [] + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + results: + - phoneNumber: '+10072904497' + lineType: MOBILE + messagingProvider: Verizon Wireless + voiceProvider: Verizon Wireless + countryCodeA3: USA + - phoneNumber: '+10072904498' + lineType: MOBILE + messagingProvider: T-Mobile USA + voiceProvider: T-Mobile USA + countryCodeA3: USA + errors: + - code: RCS_SERVICE_UNAVAILABLE + type: rcs-error + description: An exception was thrown during the async RCS service call. + meta: + phoneNumbers: + - '+10072904497' + - code: MISSING_FROM_RESPONSE + type: rcs-error + description: The phone number was absent from the RCS service response. + meta: + phoneNumbers: + - '+10072904498' + badRequestExample: + summary: Example Bad Request Error + value: + links: [] + data: {} + errors: + - type: bad-request + description: >- + Bad Request. Ensure that you have set the requestId as a URL path + parameter. + unauthorizedExample: + summary: Unauthorized Error + value: + links: [] + data: {} + errors: + - type: Unauthorized + description: You are not authorized to access this resource. + code: '1' + page: null + forbiddenExample: + summary: Forbidden Error + value: + links: [] + data: {} + errors: + - type: Forbidden + description: You do not have permission to access this resource. + code: '2' + page: null + unsupportedMediaTypeExample: + summary: Unsupported Media Type Error + value: + links: [] + data: {} + errors: + - type: invalid-content-type + description: >- + Invalid content-type. Ensure that your content-type header is set + to application/json. + notFoundExample: + summary: Not Found Error + value: + links: [] + data: {} + errors: + - type: not-found + description: >- + RequestId not found. Ensure that the requestId used in the URL + path is valid and maps to a previous request that was submitted. + tooManyRequestsExample: + summary: Too Many Requests Error + value: + links: [] + data: {} + errors: + - type: rate-limiting + description: >- + Rate limit exceeded. Wait for the time specified in the + Retry-After header before sending another request. + internalServerErrorExample: + summary: Internal Server Error + value: + links: [] + data: {} + errors: + - code: '500' + type: unexpected-error + description: >- + Unexpected error. Please contact Bandwidth Support if your + requests are receiving this status code for an extended period of + time. + listEndpointsResponseExample: + summary: List Endpoints Paginated Response + value: + links: + - href: >- + https://api.bandwidth.com/v2/accounts/5500123/endpoints?type=SIP&status=CONNECTED&limit=2 + rel: self + method: GET + - href: >- + https://api.bandwidth.com/v2/accounts/5500123/endpoints?type=SIP&status=CONNECTED&limit=2&afterCursor=TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ== + rel: next + method: GET + page: + pageSize: 2 + totalElements: 10 + totalPages: 5 + pageNumber: 0 + data: + - endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: WEBRTC + status: CONNECTED + creationTimestamp: '2021-01-01T00:00:00Z' + expirationTimestamp: '2021-01-02T00:00:00Z' + tag: my-tag + - endpointId: e-2cb0-4a07-b215-b22865662d85-15ac29a2-1331029c + type: WEBRTC + status: CONNECTED + creationTimestamp: '2021-01-01T00:00:00Z' + expirationTimestamp: '2021-01-02T00:00:00Z' + tag: my-tag + errors: [] + createEndpointResponseExample: + summary: Create Endpoint Response + value: + links: + - href: >- + https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + rel: endpoint + method: GET + data: + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + token: xxxxx.yyyyy.zzzzz + type: WEBRTC + status: CONNECTED + creationTimestamp: '2021-01-01T00:00:00Z' + expirationTimestamp: '2021-01-02T00:00:00Z' + devices: [] + tag: my-tag + errors: [] + getEndpointResponseExample: + summary: Get Endpoint Response + value: + links: + - href: >- + https://api.bandwidth.com/v2/accounts/5500123/endpoints/e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + rel: self + method: GET + data: + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: WEBRTC + status: CONNECTED + creationTimestamp: '2021-01-01T00:00:00Z' + expirationTimestamp: '2021-01-02T00:00:00Z' + devices: [] + tag: my-tag + errors: [] + createSipEndpointRequestExample: + summary: SIP Endpoint Example + value: + type: SIP + connectionMetadata: + ipAddress: 0.0.0.0 + port: 3000 + credentials: + username: username + password: '********' + uuiHeader: 123456;encoding=jwt + direction: INBOUND + eventCallbackUrl: https://myEventCallbackUrl.com/callbacks/bandwidth + eventFallbackUrl: https://fallback.myEventCallbackUrl.com/callbacks/bandwidth + tag: '{"myTag": "myTagValue"}' + createWeRtcEndpointExample: + summary: WebRTC Endpoint Example + value: + type: WEBRTC + direction: BIDIRECTIONAL + eventCallbackUrl: https://myEventCallbackUrl.com/callbacks/bandwidth + eventFallbackUrl: https://fallback.myEventCallbackUrl.com/callbacks/bandwidth + tag: '{"myTag": "myTagValue"}' + updateEndpointBxmlRequestExample: + summary: Update Endpoint BXML Request Example + value: + endpointDisconnectedEventExample: + summary: Endpoint Disconnected Event + value: + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: WEBRTC + status: DISCONNECTED + creationTimestamp: '2021-01-01T00:00:00Z' + expirationTimestamp: '2021-01-02T00:00:00Z' + eventTime: '2021-01-01T00:00:00Z' + eventType: DEVICE_DISCONNECTED + tag: my-tag + badRequestErrorExample: + summary: Bad Request Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: invalid_parameter + description: accountId must not contain any characters other than numbers. + code: '400' + source: + parameter: accountId + unauthorizedErrorExample: + summary: Unauthorized Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: unauthorized + description: >- + The provided credentials are not authorized to access this + resource. + code: '401' + source: + header: Authorization + forbiddenErrorExample: + summary: Forbidden Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: forbidden + description: >- + The provided credentials are not authorized to access this + resource. + code: '403' + source: + header: Authorization + notFoundErrorExample: + summary: Not Found Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: resource_not_found + description: The requested resource was not found. + code: '404' + source: + reference: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + methodNotAllowedErrorExample: + summary: Method Not Allowed Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: method_not_allowed + description: The requested method is not allowed on this resource. + code: '405' + source: + parameter: accountId + unsupportedMediaTypeErrorExample: + summary: Unsupported Media Type Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: unsupported_media_type + description: The provided media type is not supported. + code: '415' + source: + header: Content-Type + tooManyRequestsErrorExample: + summary: Too Many Requests Error Example + value: + links: [] + data: null + errors: + - type: too_many_endpoints + description: >- + Too many endpoints. Please delete an existing endpoint or wait 24 + hours for an endpoint to be removed. + serviceUnavailableErrorExample: + summary: Service Unavailable Error Example + value: + links: [] + data: null + errors: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: service_unavailable + description: The service is currently unavailable. + code: '500' + requestBodies: + createMessageRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/messageRequest' + required: true + createMultiChannelMessageRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelMessageRequest' + 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/heic: + schema: + type: string + format: binary + image/heif: + 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/html: + 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 + video/x-flv: + 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' + createSyncLookupRequest: + description: Synchronous phone number lookup request. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/syncLookupRequest' + examples: + singleNumberRequestExample: + $ref: '#/components/examples/singleNumberRequestExample' + multipleNumberRequestExample: + $ref: '#/components/examples/multipleNumberRequestExample' + rcsAgentRequestExample: + $ref: '#/components/examples/rcsAgentRequestExample' + createAsyncBulkLookupRequest: + description: Asynchronous bulk phone number lookup request. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/asyncLookupRequest' + examples: + multipleNumberRequestExample: + $ref: '#/components/examples/multipleNumberRequestExample' + requestTollFreeVerificationRequest: + description: Request for verification of a toll-free phone number. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/verificationRequest' + updateTollFreeVerificationRequestRequest: + description: Update a request for verification of a toll-free phone number. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tfvSubmissionWrapper' + verificationWebhookRequest: + description: Verification callback status of a toll-free phone number. + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/verificationWebhook' + - $ref: '#/components/schemas/verificationDenialWebhook' + - $ref: '#/components/schemas/failureWebhook' + - $ref: '#/components/schemas/blockedWebhook' + webhookSubscriptionRequest: + description: >- + Information about a webhook that Bandwidth should send upon the + completion of event customer is trying to subscribe to. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscriptionRequestSchema' + createEndpointRequest: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/createEndpointRequest' + examples: + createWebRtcEndpointRequestExample: + $ref: '#/components/examples/createWeRtcEndpointExample' + updateEndpointBxmlRequest: + required: true + content: + application/xml: + schema: + type: string + description: >- + The BXML document to update the endpoint with. This BXML document + will be executed against the endpoint when it is updated. + + For more information, please refer to our [BXML + documentation](/docs/voice/bxml/). + examples: + updateEndpointBxmlRequestExample: + $ref: '#/components/examples/updateEndpointBxmlRequestExample' + 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==` + OAuth2: + type: oauth2 + flows: + clientCredentials: + tokenUrl: https://api.bandwidth.com/api/v1/oauth2/token + scopes: {} + callbacks: + inboundCallback: + '{inboundCallbackUrl}': + post: + requestBody: + required: true + description: >- +

This Inbound Message Webhook is an envelope containing either a + received (MO) message to your + + message-enabled Bandwidth telephone number or a multichannel + client's response to a suggestion response + + or location request. + +

The payload type will be one of message-received, + suggestion-response, or + requested-location-response. + +

Note that suggestion-response and + requested-location-response callback types are + pertinent only for RBM messages sent from the + /messages/multiChannel endpoint. + +

Please visit Webhooks

+ content: + application/json: + schema: + $ref: '#/components/schemas/inboundCallback' + examples: + smsMessageReceivedCallback: + $ref: '#/components/examples/smsMessageReceivedCallbackExample' + mmsMessageReceivedCallback: + $ref: '#/components/examples/mmsMessageReceivedCallbackExample' + responses: + '200': + description: OK + '202': + description: Accepted + statusCallback: + '{statusCallbackUrl}': + post: + requestBody: + required: true + description: >- +

This Outbound Message Webhook is an envelope containing status + information regarding a message sent (MT) + + from your message-enabled Bandwidth telephone number. +

The payload type will be one of message-sending, message-sent, message-delivered, message-failed or message-read. +

Note that message-read callbacks are pertinent only for RBM messages sent from the /messages/multiChannel endpoint. +

Please visit Webhooks

+ content: + application/json: + schema: + $ref: '#/components/schemas/statusCallback' + examples: + messageSendingCallback: + $ref: '#/components/examples/messageSendingCallbackExample' + messageSentCallback: + $ref: '#/components/examples/messageSentCallbackExample' + smsMessageDeliveredCallback: + $ref: '#/components/examples/smsMessageDeliveredCallbackExample' + mmsMessageDeliveredCallback: + $ref: '#/components/examples/mmsMessageDeliveredCallbackExample' + groupMmsMessageDeliveredCallback: + $ref: >- + #/components/examples/groupMmsMessageDeliveredCallbackExample + messageFailedCallback: + $ref: '#/components/examples/messageFailedCallbackExample' + responses: + '200': + description: OK + '202': + description: Accepted + tfVerificationStatus: + your_url.com/webhookService: + post: + summary: TFV status updates sent to customer's webhook URL. + description: >- + Unique webhook URL provided by customers to which Bandwidth sends a + POST request to notify customer regarding TFV status updates. + operationId: tfvRequest + parameters: + - description: >- + 64-character lowercase hexidecimal HMAC calculated with a shared + secret key, the canonicalized request body, and SHA256. It is + only included when a shared secret key is set through webhook + subscription. + example: ca7b9e9816c90d336f5dca529e733354b81535c7af027b81878ac98afb2dbaa2 + in: header + name: x-bandwidth-signature-hmac-sha256 + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/verificationWebhookRequest' + responses: + '204': + $ref: '#/components/responses/noContentResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + endpointEvent: + '{request.body#/eventCallbackUrl}': + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/endpointEvent' + examples: + endpointDisconnectedEventExample: + $ref: '#/components/examples/endpointDisconnectedEventExample' + responses: + '204': + description: Event was successfully received. diff --git a/composer.json b/composer.json index d0b683a..8291a2d 100644 --- a/composer.json +++ b/composer.json @@ -1,33 +1,46 @@ { - "name": "bandwidth/sdk", - "type": "library", - "description": "Bandwidth's set of APIs", - "keywords": ["bandwidth","API","SDK"], - "homepage": "https://www.bandwidth.com/", - "license": "MIT", + "name": "bandwidth/php-sdk", + "description": "Bandwidth's Communication APIs", + "keywords": [ + "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", "authors": [ { - "name": "Bandwidth Inc.", - "email": "support@bandwidth.com", - "homepage": "https://www.bandwidth.com/", - "role": "Owner" + "name": "OpenAPI-Generator contributors", + "homepage": "https://openapi-generator.tech" } ], "require": { - "ext-SimpleXML": "*", - "php": ">=8.0.0", + "php": "^8.1", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "mashape/unirest-php": "~3.0.1", - "apimatic/jsonmapper": "~1.3.0" + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.0" }, "require-dev": { - "phpunit/phpunit": "^9" + "friendsofphp/php-cs-fixer": "^3.5", + "overtrue/phplint": "^9.0", + "phpunit/phpunit": "^9.0" }, "autoload": { - "psr-4": { - "BandwidthLib\\": "src/" - } + "psr-4": { "Bandwidth\\" : "src/" } + }, + "autoload-dev": { + "psr-4": { "Bandwidth\\Test\\" : "tests/" } + }, + "scripts": { + "test": [ + "@phplint" + ], + "phplint": "phplint" } } diff --git a/custom_templates/Configuration.mustache b/custom_templates/Configuration.mustache new file mode 100644 index 0000000..9626903 --- /dev/null +++ b/custom_templates/Configuration.mustache @@ -0,0 +1,736 @@ +partial_header}} + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +use InvalidArgumentException; +use GuzzleHttp\Client; + +/** + * Configuration Class Doc Comment + * + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class Configuration +{ + public const BOOLEAN_FORMAT_INT = 'int'; + public const BOOLEAN_FORMAT_STRING = 'string'; + + /** + * @var Configuration|null + */ + private static ?Configuration $defaultConfiguration = null; + + /** + * Associate array to store API key(s) + * + * @var string[] + */ + protected array $apiKeys = []; + + /** + * Associate array to store API prefix (e.g. Bearer) + * + * @var string[] + */ + protected array $apiKeyPrefixes = []; + + /** + * Access token for OAuth/Bearer authentication + * + * @var string + */ + protected string $accessToken = ''; + + /** + * Client ID for OAuth2 client credentials authentication + * + * @var string + */ + protected string $clientId = ''; + + /** + * Client secret for OAuth2 client credentials authentication + * + * @var string + */ + protected string $clientSecret = ''; + + /** + * Token endpoint used to fetch an OAuth2 access token + * + * @var string + */ + protected string $tokenUrl = 'https://api.bandwidth.com/api/v1/oauth2/token'; + + /** + * Unix timestamp at which the current access token expires + * + * @var int|null + */ + protected ?int $accessTokenExpiration = null; + + /** + * Callable that returns a valid access token. Overrides the static access + * token when set. Defaults to an OAuth2 client credentials getter. + * + * @var \Closure|null + */ + protected ?\Closure $accessTokenGetter = null; + + /** + * Boolean format for query string + * + * @var string + */ + protected string $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT; + + /** + * Username for HTTP basic authentication + * + * @var string + */ + protected string $username = ''; + + /** + * Password for HTTP basic authentication + * + * @var string + */ + protected string $password = ''; + + /** + * The host + * + * @var string + */ + protected string $host = '{{basePath}}'; + + /** + * User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default + * + * @var string + */ + protected string $userAgent = '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}{{^artifactVersion}}1.0.0{{/artifactVersion}}/PHP{{/httpUserAgent}}'; + + /** + * Debug switch (default set to false) + * + * @var bool + */ + protected bool $debug = false; + + /** + * Debug file location (log to STDOUT by default) + * + * @var string + */ + protected string $debugFile = 'php://output'; + + /** + * Debug file location (log to STDOUT by default) + * + * @var string + */ + protected string $tempFolderPath; + + /** + * Ignore operation specific hosts + * + * @var bool + */ + protected bool $ignoreOperationHosts = false; + + /** + * Constructor + */ + public function __construct() + { + $this->tempFolderPath = sys_get_temp_dir(); + + // Default OAuth2 getter: reuses a cached token until it nears expiry, + // otherwise fetches a new one via the client credentials grant. + $this->accessTokenGetter = function (): string { + $tokenValid = $this->accessToken !== '' + && ($this->accessTokenExpiration === null || $this->accessTokenExpiration > time() + 60); + if ($tokenValid) { + return $this->accessToken; + } + + // Fall back to the static token when client credentials aren't set + if ($this->clientId === '' || $this->clientSecret === '') { + return $this->accessToken; + } + + $response = (new Client())->post($this->tokenUrl, [ + 'headers' => [ + 'Authorization' => 'Basic ' . base64_encode("{$this->clientId}:{$this->clientSecret}"), + 'Content-Type' => 'application/x-www-form-urlencoded', + ], + 'body' => 'grant_type=client_credentials', + 'http_errors' => false, + ]); + + if ($response->getStatusCode() !== 200) { + throw new \RuntimeException( + "Failed to obtain access token: [{$response->getStatusCode()}] " . (string) $response->getBody() + ); + } + + $body = json_decode((string) $response->getBody(), true); + $this->accessToken = $body['access_token']; + $this->accessTokenExpiration = time() + $body['expires_in']; + + return $this->accessToken; + }; + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey(string $apiKeyIdentifier, string $key): static + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey(string $apiKeyIdentifier): ?string + { + return $this->apiKeys[$apiKeyIdentifier] ?? null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix(string $apiKeyIdentifier): ?string + { + return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken(string $accessToken): static + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * Delegates to the access token getter when set, which may fetch or refresh + * the token (and can therefore perform a network request). Falls back to the + * static access token otherwise. + * + * @return string Access token for OAuth + */ + public function getAccessToken(): string + { + if ($this->accessTokenGetter !== null) { + return ($this->accessTokenGetter)() ?? ''; + } + return $this->accessToken; + } + + /** + * Sets the client ID for OAuth2 client credentials authentication + * + * @param string $clientId Client ID for OAuth2 + * + * @return $this + */ + public function setClientId(string $clientId): static + { + $this->clientId = $clientId; + return $this; + } + + /** + * Gets the client ID for OAuth2 client credentials authentication + * + * @return string Client ID for OAuth2 + */ + public function getClientId(): string + { + return $this->clientId; + } + + /** + * Sets the client secret for OAuth2 client credentials authentication + * + * @param string $clientSecret Client secret for OAuth2 + * + * @return $this + */ + public function setClientSecret(string $clientSecret): static + { + $this->clientSecret = $clientSecret; + return $this; + } + + /** + * Gets the client secret for OAuth2 client credentials authentication + * + * @return string Client secret for OAuth2 + */ + public function getClientSecret(): string + { + return $this->clientSecret; + } + + /** + * Sets the token endpoint used to fetch an OAuth2 access token + * + * @param string $tokenUrl Token endpoint URL + * + * @return $this + */ + public function setTokenUrl(string $tokenUrl): static + { + $this->tokenUrl = $tokenUrl; + return $this; + } + + /** + * Gets the token endpoint used to fetch an OAuth2 access token + * + * @return string Token endpoint URL + */ + public function getTokenUrl(): string + { + return $this->tokenUrl; + } + + /** + * Sets the access token getter. Set to null to use the static access token. + * + * @param \Closure|null $accessTokenGetter Callable returning a valid access token + * + * @return $this + */ + public function setAccessTokenGetter(?\Closure $accessTokenGetter): static + { + $this->accessTokenGetter = $accessTokenGetter; + return $this; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat): static + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername(string $username): static + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername(): string + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword(string $password): static + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword(): string + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost(string $host): static + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost(): string + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws InvalidArgumentException + * @return $this + */ + public function setUserAgent(string $userAgent): static + { + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent(): string + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug(bool $debug): static + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug(): bool + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile(string $debugFile): static + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile(): string + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath(string $tempFolderPath): static + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath(): string + { + return $this->tempFolderPath; + } + + /** + * Sets the ignore operation specific hosts flag + * + * @param bool $ignoreOperationHosts Ignore operation specific hosts flag + * + * @return $this + */ + public function setIgnoreOperationHosts(bool $ignoreOperationHosts): static + { + $this->ignoreOperationHosts = $ignoreOperationHosts; + return $this; + } + + /** + * Gets the ignore operation specific hosts flag + * + * @return bool Ignore operation specific hosts flag + */ + public function getIgnoreOperationHosts(): bool + { + return $this->ignoreOperationHosts; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration(): Configuration + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config): void + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport(): string + { + $report = 'PHP SDK ({{invokerPackage}}) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: {{version}}' . PHP_EOL; + {{#artifactVersion}} + $report .= ' SDK Package Version: {{.}}' . PHP_EOL; + {{/artifactVersion}} + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings(): array + { + return [ + {{#servers}} + [ + "url" => "{{{url}}}", + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + "variables" => [ + {{/-first}} + "{{{name}}}" => [ + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + "default_value" => "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + "enum_values" => [ + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/enumValues}} + ]{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/variables}} + ]{{^-last}},{{/-last}} + {{/servers}} + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, int $hostIndex, ?array $variables = null): string + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings(int $index, ?array $variables = null): string + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/docs/Api/CallsApi.md b/docs/Api/CallsApi.md new file mode 100644 index 0000000..b96b9fe --- /dev/null +++ b/docs/Api/CallsApi.md @@ -0,0 +1,399 @@ +# Bandwidth\CallsApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| 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 | +| [**listCalls()**](CallsApi.md#listCalls) | **GET** /accounts/{accountId}/calls | Get Calls | +| [**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()` + +```php +createCall($account_id, $create_call): \Bandwidth\Model\CreateCallResponse +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +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. Please note: Calls submitted to your queue will be placed approximately in order, but exact ordering is not guaranteed. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\CallsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$create_call = new \Bandwidth\Model\CreateCall(); // \Bandwidth\Model\CreateCall | JSON object containing information to create an outbound call + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->createCall($account_id, $create_call, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CallsApi->createCall: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **create_call** | [**\Bandwidth\Model\CreateCall**](../Model/CreateCall.md)| JSON object containing information to create an outbound call | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CreateCallResponse**](../Model/CreateCallResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getCallState()` + +```php +getCallState($account_id, $call_id): \Bandwidth\Model\CallState +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +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 + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\CallsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getCallState($account_id, $call_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CallsApi->getCallState: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CallState**](../Model/CallState.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listCalls()` + +```php +listCalls($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token): \Bandwidth\Model\CallState[] +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Get Calls + +Returns a max of 10000 calls, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of calls 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 call records. Also, 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 empty array [] in response. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\CallsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$to = %2b19195551234; // string | Filter results by the `to` field. +$from = %2b19195554321; // string | Filter results by the `from` field. +$min_start_time = 2022-06-21T19:13:21Z; // string | Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). +$max_start_time = 2022-06-21T19:13:21Z; // string | Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). +$disconnect_cause = hangup; // string | Filter results to calls with specified call Disconnect Cause. +$page_size = 500; // int | Specifies the max number of calls that will be returned. +$page_token = eyJwYWdlVG9rZW4iOiJ0b2tlbiJ9; // 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. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->listCalls($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CallsApi->listCalls: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **to** | **string**| Filter results by the `to` field. | [optional] | +| **from** | **string**| Filter results by the `from` field. | [optional] | +| **min_start_time** | **string**| Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). | [optional] | +| **max_start_time** | **string**| Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). | [optional] | +| **disconnect_cause** | **string**| Filter results to calls with specified call Disconnect Cause. | [optional] | +| **page_size** | **int**| Specifies the max number of calls that will be returned. | [optional] [default to 1000] | +| **page_token** | **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] | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CallState[]**](../Model/CallState.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateCall()` + +```php +updateCall($account_id, $call_id, $update_call) +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Update Call + +Interrupts and redirects a call to a different URL that should return a BXML document. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\CallsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$update_call = new \Bandwidth\Model\UpdateCall(); // \Bandwidth\Model\UpdateCall | JSON object containing information to redirect an existing call to a new BXML document + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->updateCall($account_id, $call_id, $update_call, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling CallsApi->updateCall: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **update_call** | [**\Bandwidth\Model\UpdateCall**](../Model/UpdateCall.md)| JSON object containing information to redirect an existing call to a new BXML document | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateCallBxml()` + +```php +updateCallBxml($account_id, $call_id, $body) +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Update Call BXML + +Interrupts and replaces an active call's BXML document. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\CallsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$body = + + This is a test sentence. +; // string + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->updateCallBxml($account_id, $call_id, $body, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling CallsApi->updateCallBxml: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **body** | **string**| | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/xml` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/ConferencesApi.md b/docs/Api/ConferencesApi.md new file mode 100644 index 0000000..1d182bd --- /dev/null +++ b/docs/Api/ConferencesApi.md @@ -0,0 +1,704 @@ +# Bandwidth\ConferencesApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| 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()` + +```php +downloadConferenceRecording($account_id, $conference_id, $recording_id): \SplFileObject +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Download Conference Recording + +Downloads the specified recording file. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\ConferencesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID. +$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->downloadConferenceRecording($account_id, $conference_id, $recording_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ConferencesApi->downloadConferenceRecording: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **conference_id** | **string**| Programmable Voice API Conference ID. | | +| **recording_id** | **string**| Programmable Voice API Recording ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +**\SplFileObject** + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `audio/vnd.wave`, `audio/mpeg`, `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getConference()` + +```php +getConference($account_id, $conference_id): \Bandwidth\Model\Conference +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Get Conference Information + +Returns information about the specified conference. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\ConferencesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getConference($account_id, $conference_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ConferencesApi->getConference: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **conference_id** | **string**| Programmable Voice API Conference ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\Conference**](../Model/Conference.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getConferenceMember()` + +```php +getConferenceMember($account_id, $conference_id, $member_id): \Bandwidth\Model\ConferenceMember +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Get Conference Member + +Returns information about the specified conference member. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\ConferencesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID. +$member_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Conference Member ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getConferenceMember($account_id, $conference_id, $member_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ConferencesApi->getConferenceMember: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **conference_id** | **string**| Programmable Voice API Conference ID. | | +| **member_id** | **string**| Programmable Voice API Conference Member ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\ConferenceMember**](../Model/ConferenceMember.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getConferenceRecording()` + +```php +getConferenceRecording($account_id, $conference_id, $recording_id): \Bandwidth\Model\ConferenceRecordingMetadata +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Get Conference Recording Information + +Returns metadata for the specified recording. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\ConferencesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID. +$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getConferenceRecording($account_id, $conference_id, $recording_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ConferencesApi->getConferenceRecording: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **conference_id** | **string**| Programmable Voice API Conference ID. | | +| **recording_id** | **string**| Programmable Voice API Recording ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\ConferenceRecordingMetadata**](../Model/ConferenceRecordingMetadata.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listConferenceRecordings()` + +```php +listConferenceRecordings($account_id, $conference_id): \Bandwidth\Model\ConferenceRecordingMetadata[] +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Get Conference Recordings + +Returns a (potentially empty) list of metadata for the recordings that took place during the specified conference. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\ConferencesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->listConferenceRecordings($account_id, $conference_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ConferencesApi->listConferenceRecordings: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **conference_id** | **string**| Programmable Voice API Conference ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\ConferenceRecordingMetadata[]**](../Model/ConferenceRecordingMetadata.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listConferences()` + +```php +listConferences($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token): \Bandwidth\Model\Conference[] +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +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 + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\ConferencesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$name = my-custom-name; // string | Filter results by the `name` field. +$min_created_time = 2022-06-21T19:13:21Z; // string | Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). +$max_created_time = 2022-06-21T19:13:21Z; // string | Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). +$page_size = 500; // int | Specifies the max number of conferences that will be returned. +$page_token = eyJwYWdlVG9rZW4iOiJ0b2tlbiJ9; // 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. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->listConferences($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ConferencesApi->listConferences: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **name** | **string**| Filter results by the `name` field. | [optional] | +| **min_created_time** | **string**| Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). | [optional] | +| **max_created_time** | **string**| Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). | [optional] | +| **page_size** | **int**| Specifies the max number of conferences that will be returned. | [optional] [default to 1000] | +| **page_token** | **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] | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\Conference[]**](../Model/Conference.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateConference()` + +```php +updateConference($account_id, $conference_id, $update_conference) +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Update Conference + +Update the conference state. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\ConferencesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID. +$update_conference = new \Bandwidth\Model\UpdateConference(); // \Bandwidth\Model\UpdateConference + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->updateConference($account_id, $conference_id, $update_conference, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling ConferencesApi->updateConference: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **conference_id** | **string**| Programmable Voice API Conference ID. | | +| **update_conference** | [**\Bandwidth\Model\UpdateConference**](../Model/UpdateConference.md)| | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateConferenceBxml()` + +```php +updateConferenceBxml($account_id, $conference_id, $body) +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Update Conference BXML + +Update the conference BXML document. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\ConferencesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID. +$body = + + +; // string + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->updateConferenceBxml($account_id, $conference_id, $body, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling ConferencesApi->updateConferenceBxml: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **conference_id** | **string**| Programmable Voice API Conference ID. | | +| **body** | **string**| | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/xml` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateConferenceMember()` + +```php +updateConferenceMember($account_id, $conference_id, $member_id, $update_conference_member) +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Update Conference Member + +Updates settings for a particular conference member. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\ConferencesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$conference_id = conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9; // string | Programmable Voice API Conference ID. +$member_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Conference Member ID. +$update_conference_member = new \Bandwidth\Model\UpdateConferenceMember(); // \Bandwidth\Model\UpdateConferenceMember + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->updateConferenceMember($account_id, $conference_id, $member_id, $update_conference_member, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling ConferencesApi->updateConferenceMember: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **conference_id** | **string**| Programmable Voice API Conference ID. | | +| **member_id** | **string**| Programmable Voice API Conference Member ID. | | +| **update_conference_member** | [**\Bandwidth\Model\UpdateConferenceMember**](../Model/UpdateConferenceMember.md)| | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/EndpointsApi.md b/docs/Api/EndpointsApi.md new file mode 100644 index 0000000..fe416f9 --- /dev/null +++ b/docs/Api/EndpointsApi.md @@ -0,0 +1,388 @@ +# Bandwidth\EndpointsApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createEndpoint()**](EndpointsApi.md#createEndpoint) | **POST** /accounts/{accountId}/endpoints | Create Endpoint | +| [**deleteEndpoint()**](EndpointsApi.md#deleteEndpoint) | **DELETE** /accounts/{accountId}/endpoints/{endpointId} | Delete Endpoint | +| [**getEndpoint()**](EndpointsApi.md#getEndpoint) | **GET** /accounts/{accountId}/endpoints/{endpointId} | Get Endpoint | +| [**listEndpoints()**](EndpointsApi.md#listEndpoints) | **GET** /accounts/{accountId}/endpoints | List Endpoints | +| [**updateEndpointBxml()**](EndpointsApi.md#updateEndpointBxml) | **PUT** /accounts/{accountId}/endpoints/{endpointId}/bxml | Update Endpoint BXML | + + +## `createEndpoint()` + +```php +createEndpoint($account_id, $body): \Bandwidth\Model\CreateEndpointResponse +``` +### URI(s): +- https://api.bandwidth.com/v2 Production +Create Endpoint + +Creates a new Endpoint for the specified account. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\EndpointsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$body = new \Bandwidth\Model\CreateWebRtcConnectionRequest(); // \Bandwidth\Model\CreateWebRtcConnectionRequest + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->createEndpoint($account_id, $body, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EndpointsApi->createEndpoint: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **body** | **\Bandwidth\Model\CreateWebRtcConnectionRequest**| | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CreateEndpointResponse**](../Model/CreateEndpointResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteEndpoint()` + +```php +deleteEndpoint($account_id, $endpoint_id) +``` +### URI(s): +- https://api.bandwidth.com/v2 Production +Delete Endpoint + +Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\EndpointsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$endpoint_id = e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | BRTC Endpoint ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->deleteEndpoint($account_id, $endpoint_id, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling EndpointsApi->deleteEndpoint: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **endpoint_id** | **string**| BRTC Endpoint ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getEndpoint()` + +```php +getEndpoint($account_id, $endpoint_id): \Bandwidth\Model\EndpointResponse +``` +### URI(s): +- https://api.bandwidth.com/v2 Production +Get Endpoint + +Returns information about the specified endpoint. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\EndpointsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$endpoint_id = e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | BRTC Endpoint ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getEndpoint($account_id, $endpoint_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EndpointsApi->getEndpoint: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **endpoint_id** | **string**| BRTC Endpoint ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\EndpointResponse**](../Model/EndpointResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listEndpoints()` + +```php +listEndpoints($account_id, $type, $status, $after_cursor, $limit): \Bandwidth\Model\ListEndpointsResponse +``` +### URI(s): +- https://api.bandwidth.com/v2 Production +List Endpoints + +Returns a list of endpoints associated with the specified account. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\EndpointsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$type = new \Bandwidth\Model\\Bandwidth\Model\EndpointTypeEnum(); // \Bandwidth\Model\EndpointTypeEnum | The type of endpoint. +$status = new \Bandwidth\Model\\Bandwidth\Model\EndpointStatusEnum(); // \Bandwidth\Model\EndpointStatusEnum | The status of the endpoint. +$after_cursor = TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ==; // string | The cursor to use for pagination. This is the value of the `next` link in the previous response. +$limit = 2; // int | The maximum number of endpoints to return in the response. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->listEndpoints($account_id, $type, $status, $after_cursor, $limit, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EndpointsApi->listEndpoints: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **type** | [**\Bandwidth\Model\EndpointTypeEnum**](../Model/.md)| The type of endpoint. | [optional] | +| **status** | [**\Bandwidth\Model\EndpointStatusEnum**](../Model/.md)| The status of the endpoint. | [optional] | +| **after_cursor** | **string**| The cursor to use for pagination. This is the value of the `next` link in the previous response. | [optional] | +| **limit** | **int**| The maximum number of endpoints to return in the response. | [optional] [default to 100] | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\ListEndpointsResponse**](../Model/ListEndpointsResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateEndpointBxml()` + +```php +updateEndpointBxml($account_id, $endpoint_id, $body) +``` +### URI(s): +- https://api.bandwidth.com/v2 Production +Update Endpoint BXML + +Updates the BXML for the specified endpoint. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\EndpointsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$endpoint_id = e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | BRTC Endpoint ID. +$body = 'body_example'; // string + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->updateEndpointBxml($account_id, $endpoint_id, $body, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling EndpointsApi->updateEndpointBxml: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **endpoint_id** | **string**| BRTC Endpoint ID. | | +| **body** | **string**| | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/xml` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/MFAApi.md b/docs/Api/MFAApi.md new file mode 100644 index 0000000..1f4196c --- /dev/null +++ b/docs/Api/MFAApi.md @@ -0,0 +1,232 @@ +# Bandwidth\MFAApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| 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()` + +```php +generateMessagingCode($account_id, $code_request): \Bandwidth\Model\MessagingCodeResponse +``` +### URI(s): +- https://mfa.bandwidth.com/api/v1 Production +Messaging Authentication Code + +Send an MFA code via text message (SMS). + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\MFAApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$code_request = new \Bandwidth\Model\CodeRequest(); // \Bandwidth\Model\CodeRequest | MFA code request body. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->generateMessagingCode($account_id, $code_request, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MFAApi->generateMessagingCode: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **code_request** | [**\Bandwidth\Model\CodeRequest**](../Model/CodeRequest.md)| MFA code request body. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\MessagingCodeResponse**](../Model/MessagingCodeResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `generateVoiceCode()` + +```php +generateVoiceCode($account_id, $code_request): \Bandwidth\Model\VoiceCodeResponse +``` +### URI(s): +- https://mfa.bandwidth.com/api/v1 Production +Voice Authentication Code + +Send an MFA Code via a phone call. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\MFAApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$code_request = new \Bandwidth\Model\CodeRequest(); // \Bandwidth\Model\CodeRequest | MFA code request body. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->generateVoiceCode($account_id, $code_request, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MFAApi->generateVoiceCode: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **code_request** | [**\Bandwidth\Model\CodeRequest**](../Model/CodeRequest.md)| MFA code request body. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\VoiceCodeResponse**](../Model/VoiceCodeResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `verifyCode()` + +```php +verifyCode($account_id, $verify_code_request): \Bandwidth\Model\VerifyCodeResponse +``` +### URI(s): +- https://mfa.bandwidth.com/api/v1 Production +Verify Authentication Code + +Verify a previously sent MFA code. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\MFAApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$verify_code_request = new \Bandwidth\Model\VerifyCodeRequest(); // \Bandwidth\Model\VerifyCodeRequest | MFA code verify request body. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->verifyCode($account_id, $verify_code_request, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MFAApi->verifyCode: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **verify_code_request** | [**\Bandwidth\Model\VerifyCodeRequest**](../Model/VerifyCodeRequest.md)| MFA code verify request body. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\VerifyCodeResponse**](../Model/VerifyCodeResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/MediaApi.md b/docs/Api/MediaApi.md new file mode 100644 index 0000000..55d92a6 --- /dev/null +++ b/docs/Api/MediaApi.md @@ -0,0 +1,311 @@ +# Bandwidth\MediaApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| 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()` + +```php +deleteMedia($account_id, $media_id) +``` +### URI(s): +- https://messaging.bandwidth.com/api/v2 Production +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 + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\MediaApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png; // string | Media ID to retrieve. + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->deleteMedia($account_id, $media_id, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling MediaApi->deleteMedia: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **media_id** | **string**| Media ID to retrieve. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getMedia()` + +```php +getMedia($account_id, $media_id): \SplFileObject +``` +### URI(s): +- https://messaging.bandwidth.com/api/v2 Production +Get Media + +Downloads a media file you previously uploaded. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\MediaApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png; // string | Media ID to retrieve. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getMedia($account_id, $media_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MediaApi->getMedia: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **media_id** | **string**| Media ID to retrieve. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +**\SplFileObject** + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/octet-stream`, `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listMedia()` + +```php +listMedia($account_id, $continuation_token): \Bandwidth\Model\Media[] +``` +### URI(s): +- https://messaging.bandwidth.com/api/v2 Production +List Media + +Gets a list of your media files. No query parameters are supported. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\MediaApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$continuation_token = 1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39; // string | Continuation token used to retrieve subsequent media. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->listMedia($account_id, $continuation_token, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MediaApi->listMedia: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **continuation_token** | **string**| Continuation token used to retrieve subsequent media. | [optional] | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\Media[]**](../Model/Media.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `uploadMedia()` + +```php +uploadMedia($account_id, $media_id, $body, $content_type, $cache_control) +``` +### URI(s): +- https://messaging.bandwidth.com/api/v2 Production +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 at [Bandwidth Support](https://www.bandwidth.com/support/en/articles/12823220-what-mms-file-types-are-supported). + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\MediaApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$media_id = 14762070468292kw2fuqty55yp2b2/0/bw.png; // string | Media ID to retrieve. +$body = '/path/to/file.txt'; // \SplFileObject +$content_type = audio/wav; // string | The media type of the entity-body. +$cache_control = no-cache; // string | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->uploadMedia($account_id, $media_id, $body, $content_type, $cache_control, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling MediaApi->uploadMedia: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **media_id** | **string**| Media ID to retrieve. | | +| **body** | **\SplFileObject****\SplFileObject**| | | +| **content_type** | **string**| The media type of the entity-body. | [optional] | +| **cache_control** | **string**| General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. | [optional] | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### 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/heic`, `image/heif`, `image/jpeg`, `image/pjpeg`, `image/png`, `image/svg+xml`, `image/tiff`, `image/webp`, `image/x-icon`, `text/css`, `text/csv`, `text/calendar`, `text/html`, `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`, `video/x-flv` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/MessagesApi.md b/docs/Api/MessagesApi.md new file mode 100644 index 0000000..6638e37 --- /dev/null +++ b/docs/Api/MessagesApi.md @@ -0,0 +1,209 @@ +# Bandwidth\MessagesApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| 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()` + +```php +createMessage($account_id, $message_request): \Bandwidth\Model\Message +``` +### URI(s): +- https://messaging.bandwidth.com/api/v2 Production +Create Message + +Endpoint for sending text messages and picture messages using V2 messaging. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\MessagesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$message_request = new \Bandwidth\Model\MessageRequest(); // \Bandwidth\Model\MessageRequest + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->createMessage($account_id, $message_request, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MessagesApi->createMessage: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **message_request** | [**\Bandwidth\Model\MessageRequest**](../Model/MessageRequest.md)| | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\Message**](../Model/Message.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listMessages()` + +```php +listMessages($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count): \Bandwidth\Model\MessagesList +``` +### URI(s): +- https://messaging.bandwidth.com/api/v2 Production +List Messages + +Returns a list of messages based on query parameters. **Rate Limit:** This endpoint is rate limited to 3500 requests per 5 minutes per Source IP address. Exceeding the limit returns HTTP 429 with a `Retry-After` header. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\MessagesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$message_id = 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. +$source_tn = %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'). +$destination_tn = %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'). +$message_status = new \Bandwidth\Model\\Bandwidth\Model\MessageStatusEnum(); // \Bandwidth\Model\MessageStatusEnum | The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. +$message_direction = new \Bandwidth\Model\\Bandwidth\Model\ListMessageDirectionEnum(); // \Bandwidth\Model\ListMessageDirectionEnum | The direction of the message. One of INBOUND OUTBOUND. +$carrier_name = 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). +$message_type = new \Bandwidth\Model\\Bandwidth\Model\MessageTypeEnum(); // \Bandwidth\Model\MessageTypeEnum | The type of message. Either sms or mms. +$error_code = 9902; // int | The error code of the message. +$from_date_time = 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. +$to_date_time = 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. +$campaign_id = CJEUMDK; // string | The campaign ID of the message. +$from_bw_latency = 5; // int | The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. +$bw_queued = true; // bool | A boolean value indicating whether the message is queued in the Bandwidth network. +$product = P2P; // \Bandwidth\Model\ProductTypeEnum | Messaging product associated with the message. +$location = 123ABC; // string | Location Id associated with the message. +$carrier_queued = true; // bool | A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. +$from_carrier_latency = 50; // int | The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. +$calling_number_country_a3 = USA; // string | Calling number country in A3 format. +$called_number_country_a3 = USA; // string | Called number country in A3 format. +$from_segment_count = 1; // int | Segment count (start range). +$to_segment_count = 3; // int | Segment count (end range). +$from_message_size = 100; // int | Message size (start range). +$to_message_size = 120; // int | Message size (end range). +$sort = sourceTn:desc; // string | The field and direction to sort by combined with a colon. Direction is either asc or desc. +$page_token = gdEewhcJLQRB5; // string | A base64 encoded value used for pagination of results. +$limit = 50; // int | The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. +$limit_total_count = true; // bool | 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. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->listMessages($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MessagesApi->listMessages: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **message_id** | **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] | +| **source_tn** | **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] | +| **destination_tn** | **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] | +| **message_status** | [**\Bandwidth\Model\MessageStatusEnum**](../Model/.md)| The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. | [optional] | +| **message_direction** | [**\Bandwidth\Model\ListMessageDirectionEnum**](../Model/.md)| The direction of the message. One of INBOUND OUTBOUND. | [optional] | +| **carrier_name** | **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] | +| **message_type** | [**\Bandwidth\Model\MessageTypeEnum**](../Model/.md)| The type of message. Either sms or mms. | [optional] | +| **error_code** | **int**| The error code of the message. | [optional] | +| **from_date_time** | **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] | +| **to_date_time** | **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] | +| **campaign_id** | **string**| The campaign ID of the message. | [optional] | +| **from_bw_latency** | **int**| The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. | [optional] | +| **bw_queued** | **bool**| A boolean value indicating whether the message is queued in the Bandwidth network. | [optional] | +| **product** | [**\Bandwidth\Model\ProductTypeEnum**](../Model/.md)| Messaging product associated with the message. | [optional] | +| **location** | **string**| Location Id associated with the message. | [optional] | +| **carrier_queued** | **bool**| A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. | [optional] | +| **from_carrier_latency** | **int**| The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. | [optional] | +| **calling_number_country_a3** | **string**| Calling number country in A3 format. | [optional] | +| **called_number_country_a3** | **string**| Called number country in A3 format. | [optional] | +| **from_segment_count** | **int**| Segment count (start range). | [optional] | +| **to_segment_count** | **int**| Segment count (end range). | [optional] | +| **from_message_size** | **int**| Message size (start range). | [optional] | +| **to_message_size** | **int**| Message size (end range). | [optional] | +| **sort** | **string**| The field and direction to sort by combined with a colon. Direction is either asc or desc. | [optional] | +| **page_token** | **string**| A base64 encoded value used for pagination of results. | [optional] | +| **limit** | **int**| The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. | [optional] | +| **limit_total_count** | **bool**| 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] | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\MessagesList**](../Model/MessagesList.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/MultiChannelApi.md b/docs/Api/MultiChannelApi.md new file mode 100644 index 0000000..bfeebb5 --- /dev/null +++ b/docs/Api/MultiChannelApi.md @@ -0,0 +1,82 @@ +# Bandwidth\MultiChannelApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createMultiChannelMessage()**](MultiChannelApi.md#createMultiChannelMessage) | **POST** /users/{accountId}/messages/multiChannel | Create Multi-Channel Message | + + +## `createMultiChannelMessage()` + +```php +createMultiChannelMessage($account_id, $multi_channel_message_request): \Bandwidth\Model\CreateMultiChannelMessageResponse +``` +### URI(s): +- https://messaging.bandwidth.com/api/v2 Production +Create Multi-Channel Message + +Endpoint for sending Multi-Channel messages. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\MultiChannelApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$multi_channel_message_request = new \Bandwidth\Model\MultiChannelMessageRequest(); // \Bandwidth\Model\MultiChannelMessageRequest + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->createMultiChannelMessage($account_id, $multi_channel_message_request, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling MultiChannelApi->createMultiChannelMessage: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **multi_channel_message_request** | [**\Bandwidth\Model\MultiChannelMessageRequest**](../Model/MultiChannelMessageRequest.md)| | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CreateMultiChannelMessageResponse**](../Model/CreateMultiChannelMessageResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/PhoneNumberLookupApi.md b/docs/Api/PhoneNumberLookupApi.md new file mode 100644 index 0000000..5eb609c --- /dev/null +++ b/docs/Api/PhoneNumberLookupApi.md @@ -0,0 +1,232 @@ +# Bandwidth\PhoneNumberLookupApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createAsyncBulkLookup()**](PhoneNumberLookupApi.md#createAsyncBulkLookup) | **POST** /accounts/{accountId}/phoneNumberLookup/bulk | Create Asynchronous Bulk Number Lookup | +| [**createSyncLookup()**](PhoneNumberLookupApi.md#createSyncLookup) | **POST** /accounts/{accountId}/phoneNumberLookup | Create Synchronous Number Lookup | +| [**getAsyncBulkLookup()**](PhoneNumberLookupApi.md#getAsyncBulkLookup) | **GET** /accounts/{accountId}/phoneNumberLookup/bulk/{requestId} | Get Asynchronous Bulk Number Lookup | + + +## `createAsyncBulkLookup()` + +```php +createAsyncBulkLookup($account_id, $async_lookup_request): \Bandwidth\Model\CreateAsyncBulkLookupResponse +``` +### URI(s): +- https://api.bandwidth.com/v2 Production +Create Asynchronous Bulk Number Lookup + +Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\PhoneNumberLookupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string +$async_lookup_request = new \Bandwidth\Model\AsyncLookupRequest(); // \Bandwidth\Model\AsyncLookupRequest | Asynchronous bulk phone number lookup request. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->createAsyncBulkLookup($account_id, $async_lookup_request, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PhoneNumberLookupApi->createAsyncBulkLookup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| | | +| **async_lookup_request** | [**\Bandwidth\Model\AsyncLookupRequest**](../Model/AsyncLookupRequest.md)| Asynchronous bulk phone number lookup request. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CreateAsyncBulkLookupResponse**](../Model/CreateAsyncBulkLookupResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createSyncLookup()` + +```php +createSyncLookup($account_id, $sync_lookup_request): \Bandwidth\Model\CreateSyncLookupResponse +``` +### URI(s): +- https://api.bandwidth.com/v2 Production +Create Synchronous Number Lookup + +Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\PhoneNumberLookupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string +$sync_lookup_request = new \Bandwidth\Model\SyncLookupRequest(); // \Bandwidth\Model\SyncLookupRequest | Synchronous phone number lookup request. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->createSyncLookup($account_id, $sync_lookup_request, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PhoneNumberLookupApi->createSyncLookup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| | | +| **sync_lookup_request** | [**\Bandwidth\Model\SyncLookupRequest**](../Model/SyncLookupRequest.md)| Synchronous phone number lookup request. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CreateSyncLookupResponse**](../Model/CreateSyncLookupResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getAsyncBulkLookup()` + +```php +getAsyncBulkLookup($account_id, $request_id): \Bandwidth\Model\GetAsyncBulkLookupResponse +``` +### URI(s): +- https://api.bandwidth.com/v2 Production +Get Asynchronous Bulk Number Lookup + +Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\PhoneNumberLookupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string +$request_id = 004223a0-8b17-41b1-bf81-20732adf5590; // string + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getAsyncBulkLookup($account_id, $request_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PhoneNumberLookupApi->getAsyncBulkLookup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| | | +| **request_id** | **string**| | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\GetAsyncBulkLookupResponse**](../Model/GetAsyncBulkLookupResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/RecordingsApi.md b/docs/Api/RecordingsApi.md new file mode 100644 index 0000000..7a6a4b4 --- /dev/null +++ b/docs/Api/RecordingsApi.md @@ -0,0 +1,776 @@ +# Bandwidth\RecordingsApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**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 | +| [**deleteRecordingTranscription()**](RecordingsApi.md#deleteRecordingTranscription) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Delete Transcription | +| [**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 | +| [**getRecordingTranscription()**](RecordingsApi.md#getRecordingTranscription) | **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 | + + +## `deleteRecording()` + +```php +deleteRecording($account_id, $call_id, $recording_id) +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +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 + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\RecordingsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->deleteRecording($account_id, $call_id, $recording_id, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling RecordingsApi->deleteRecording: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **recording_id** | **string**| Programmable Voice API Recording ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteRecordingMedia()` + +```php +deleteRecordingMedia($account_id, $call_id, $recording_id) +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Delete Recording Media + +Deletes the specified recording's media. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\RecordingsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->deleteRecordingMedia($account_id, $call_id, $recording_id, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling RecordingsApi->deleteRecordingMedia: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **recording_id** | **string**| Programmable Voice API Recording ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteRecordingTranscription()` + +```php +deleteRecordingTranscription($account_id, $call_id, $recording_id) +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +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 + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\RecordingsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->deleteRecordingTranscription($account_id, $call_id, $recording_id, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling RecordingsApi->deleteRecordingTranscription: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **recording_id** | **string**| Programmable Voice API Recording ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `downloadCallRecording()` + +```php +downloadCallRecording($account_id, $call_id, $recording_id): \SplFileObject +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Download Recording + +Downloads the specified recording. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\RecordingsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->downloadCallRecording($account_id, $call_id, $recording_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RecordingsApi->downloadCallRecording: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **recording_id** | **string**| Programmable Voice API Recording ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +**\SplFileObject** + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `audio/vnd.wave`, `audio/mpeg`, `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getCallRecording()` + +```php +getCallRecording($account_id, $call_id, $recording_id): \Bandwidth\Model\CallRecordingMetadata +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Get Call Recording + +Returns metadata for the specified recording. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\RecordingsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getCallRecording($account_id, $call_id, $recording_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RecordingsApi->getCallRecording: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **recording_id** | **string**| Programmable Voice API Recording ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CallRecordingMetadata**](../Model/CallRecordingMetadata.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getRecordingTranscription()` + +```php +getRecordingTranscription($account_id, $call_id, $recording_id): \Bandwidth\Model\RecordingTranscriptions +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Get Transcription + +Downloads the specified transcription. If the 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. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\RecordingsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getRecordingTranscription($account_id, $call_id, $recording_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RecordingsApi->getRecordingTranscription: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **recording_id** | **string**| Programmable Voice API Recording ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\RecordingTranscriptions**](../Model/RecordingTranscriptions.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listAccountCallRecordings()` + +```php +listAccountCallRecordings($account_id, $to, $from, $min_start_time, $max_start_time): \Bandwidth\Model\CallRecordingMetadata[] +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +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 + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\RecordingsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$to = %2b19195551234; // string | Filter results by the `to` field. +$from = %2b19195554321; // string | Filter results by the `from` field. +$min_start_time = 2022-06-21T19:13:21Z; // string | Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). +$max_start_time = 2022-06-21T19:13:21Z; // string | Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->listAccountCallRecordings($account_id, $to, $from, $min_start_time, $max_start_time, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RecordingsApi->listAccountCallRecordings: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **to** | **string**| Filter results by the `to` field. | [optional] | +| **from** | **string**| Filter results by the `from` field. | [optional] | +| **min_start_time** | **string**| Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). | [optional] | +| **max_start_time** | **string**| Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). | [optional] | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CallRecordingMetadata[]**](../Model/CallRecordingMetadata.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listCallRecordings()` + +```php +listCallRecordings($account_id, $call_id): \Bandwidth\Model\CallRecordingMetadata[] +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +List Call Recordings + +Returns a (potentially empty) list of metadata for the recordings that took place during the specified call. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\RecordingsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->listCallRecordings($account_id, $call_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RecordingsApi->listCallRecordings: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CallRecordingMetadata[]**](../Model/CallRecordingMetadata.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `transcribeCallRecording()` + +```php +transcribeCallRecording($account_id, $call_id, $recording_id, $transcribe_recording) +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +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 + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\RecordingsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$recording_id = r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Recording ID. +$transcribe_recording = new \Bandwidth\Model\TranscribeRecording(); // \Bandwidth\Model\TranscribeRecording + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->transcribeCallRecording($account_id, $call_id, $recording_id, $transcribe_recording, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling RecordingsApi->transcribeCallRecording: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **recording_id** | **string**| Programmable Voice API Recording ID. | | +| **transcribe_recording** | [**\Bandwidth\Model\TranscribeRecording**](../Model/TranscribeRecording.md)| | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateCallRecordingState()` + +```php +updateCallRecordingState($account_id, $call_id, $update_call_recording) +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Update Recording + +Pause or resume a recording on an active phone call. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\RecordingsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$update_call_recording = new \Bandwidth\Model\UpdateCallRecording(); // \Bandwidth\Model\UpdateCallRecording + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->updateCallRecordingState($account_id, $call_id, $update_call_recording, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling RecordingsApi->updateCallRecordingState: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **update_call_recording** | [**\Bandwidth\Model\UpdateCallRecording**](../Model/UpdateCallRecording.md)| | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/StatisticsApi.md b/docs/Api/StatisticsApi.md new file mode 100644 index 0000000..91dab58 --- /dev/null +++ b/docs/Api/StatisticsApi.md @@ -0,0 +1,80 @@ +# Bandwidth\StatisticsApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**getStatistics()**](StatisticsApi.md#getStatistics) | **GET** /accounts/{accountId}/statistics | Get Account Statistics | + + +## `getStatistics()` + +```php +getStatistics($account_id): \Bandwidth\Model\AccountStatistics +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Get Account Statistics + +Returns details about the current state of the account. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\StatisticsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getStatistics($account_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling StatisticsApi->getStatistics: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\AccountStatistics**](../Model/AccountStatistics.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/TollFreeVerificationApi.md b/docs/Api/TollFreeVerificationApi.md new file mode 100644 index 0000000..c4ca7f6 --- /dev/null +++ b/docs/Api/TollFreeVerificationApi.md @@ -0,0 +1,675 @@ +# Bandwidth\TollFreeVerificationApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createWebhookSubscription()**](TollFreeVerificationApi.md#createWebhookSubscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription | +| [**deleteVerificationRequest()**](TollFreeVerificationApi.md#deleteVerificationRequest) | **DELETE** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Delete a Toll-Free Verification Submission | +| [**deleteWebhookSubscription()**](TollFreeVerificationApi.md#deleteWebhookSubscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription | +| [**getTollFreeVerificationStatus()**](TollFreeVerificationApi.md#getTollFreeVerificationStatus) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status | +| [**listTollFreeUseCases()**](TollFreeVerificationApi.md#listTollFreeUseCases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases | +| [**listWebhookSubscriptions()**](TollFreeVerificationApi.md#listWebhookSubscriptions) | **GET** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | List Webhook Subscriptions | +| [**requestTollFreeVerification()**](TollFreeVerificationApi.md#requestTollFreeVerification) | **POST** /accounts/{accountId}/tollFreeVerification | Request Toll-Free Verification | +| [**updateTollFreeVerificationRequest()**](TollFreeVerificationApi.md#updateTollFreeVerificationRequest) | **PUT** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Update Toll-Free Verification Request | +| [**updateWebhookSubscription()**](TollFreeVerificationApi.md#updateWebhookSubscription) | **PUT** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Update Webhook Subscription | + + +## `createWebhookSubscription()` + +```php +createWebhookSubscription($account_id, $webhook_subscription_request_schema): \Bandwidth\Model\WebhookSubscription +``` +### URI(s): +- https://api.bandwidth.com/api/v2 Production +Create Webhook Subscription + +Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TollFreeVerificationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$webhook_subscription_request_schema = new \Bandwidth\Model\WebhookSubscriptionRequestSchema(); // \Bandwidth\Model\WebhookSubscriptionRequestSchema | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->createWebhookSubscription($account_id, $webhook_subscription_request_schema, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TollFreeVerificationApi->createWebhookSubscription: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **webhook_subscription_request_schema** | [**\Bandwidth\Model\WebhookSubscriptionRequestSchema**](../Model/WebhookSubscriptionRequestSchema.md)| Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\WebhookSubscription**](../Model/WebhookSubscription.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteVerificationRequest()` + +```php +deleteVerificationRequest($account_id, $phone_number) +``` +### URI(s): +- https://api.bandwidth.com/api/v2 Production +Delete a Toll-Free Verification Submission + +Delete a toll-free verification submission for a toll-free number. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TollFreeVerificationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$phone_number = +18885555555; // string | Valid Toll-Free telephone number in E.164 format. + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->deleteVerificationRequest($account_id, $phone_number, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling TollFreeVerificationApi->deleteVerificationRequest: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **phone_number** | **string**| Valid Toll-Free telephone number in E.164 format. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteWebhookSubscription()` + +```php +deleteWebhookSubscription($account_id, $id) +``` +### URI(s): +- https://api.bandwidth.com/api/v2 Production +Delete Webhook Subscription + +Delete a webhook subscription by ID. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TollFreeVerificationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$id = 7bt57JcsVYJrN9K1OcV1Nu; // string | Webhook subscription ID + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->deleteWebhookSubscription($account_id, $id, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling TollFreeVerificationApi->deleteWebhookSubscription: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **id** | **string**| Webhook subscription ID | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getTollFreeVerificationStatus()` + +```php +getTollFreeVerificationStatus($account_id, $phone_number): \Bandwidth\Model\TfvStatus +``` +### URI(s): +- https://api.bandwidth.com/api/v2 Production +Get Toll-Free Verification Status + +Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TollFreeVerificationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$phone_number = +18885555555; // string | Valid Toll-Free telephone number in E.164 format. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getTollFreeVerificationStatus($account_id, $phone_number, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TollFreeVerificationApi->getTollFreeVerificationStatus: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **phone_number** | **string**| Valid Toll-Free telephone number in E.164 format. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\TfvStatus**](../Model/TfvStatus.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listTollFreeUseCases()` + +```php +listTollFreeUseCases(): string[] +``` +### URI(s): +- https://api.bandwidth.com/api/v2 Production +List Toll-Free Use Cases + +Lists valid toll-free use cases. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TollFreeVerificationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->listTollFreeUseCases($hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TollFreeVerificationApi->listTollFreeUseCases: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +**string[]** + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listWebhookSubscriptions()` + +```php +listWebhookSubscriptions($account_id): \Bandwidth\Model\WebhookSubscriptionsListBody +``` +### URI(s): +- https://api.bandwidth.com/api/v2 Production +List Webhook Subscriptions + +Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null). + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TollFreeVerificationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->listWebhookSubscriptions($account_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TollFreeVerificationApi->listWebhookSubscriptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\WebhookSubscriptionsListBody**](../Model/WebhookSubscriptionsListBody.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `requestTollFreeVerification()` + +```php +requestTollFreeVerification($account_id, $verification_request) +``` +### URI(s): +- https://api.bandwidth.com/api/v2 Production +Request Toll-Free Verification + +Submit a request for verification of a toll-free phone number. + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TollFreeVerificationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$verification_request = new \Bandwidth\Model\VerificationRequest(); // \Bandwidth\Model\VerificationRequest | Request for verification of a toll-free phone number. + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->requestTollFreeVerification($account_id, $verification_request, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling TollFreeVerificationApi->requestTollFreeVerification: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **verification_request** | [**\Bandwidth\Model\VerificationRequest**](../Model/VerificationRequest.md)| Request for verification of a toll-free phone number. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateTollFreeVerificationRequest()` + +```php +updateTollFreeVerificationRequest($account_id, $phone_number, $tfv_submission_wrapper) +``` +### URI(s): +- https://api.bandwidth.com/api/v2 Production +Update Toll-Free Verification Request + +Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true). + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TollFreeVerificationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$phone_number = +18885555555; // string | Valid Toll-Free telephone number in E.164 format. +$tfv_submission_wrapper = new \Bandwidth\Model\TfvSubmissionWrapper(); // \Bandwidth\Model\TfvSubmissionWrapper | Update a request for verification of a toll-free phone number. + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->updateTollFreeVerificationRequest($account_id, $phone_number, $tfv_submission_wrapper, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling TollFreeVerificationApi->updateTollFreeVerificationRequest: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **phone_number** | **string**| Valid Toll-Free telephone number in E.164 format. | | +| **tfv_submission_wrapper** | [**\Bandwidth\Model\TfvSubmissionWrapper**](../Model/TfvSubmissionWrapper.md)| Update a request for verification of a toll-free phone number. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateWebhookSubscription()` + +```php +updateWebhookSubscription($account_id, $id, $webhook_subscription_request_schema): \Bandwidth\Model\WebhookSubscription +``` +### URI(s): +- https://api.bandwidth.com/api/v2 Production +Update Webhook Subscription + +Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TollFreeVerificationApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$id = 7bt57JcsVYJrN9K1OcV1Nu; // string | Webhook subscription ID +$webhook_subscription_request_schema = new \Bandwidth\Model\WebhookSubscriptionRequestSchema(); // \Bandwidth\Model\WebhookSubscriptionRequestSchema | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->updateWebhookSubscription($account_id, $id, $webhook_subscription_request_schema, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TollFreeVerificationApi->updateWebhookSubscription: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **id** | **string**| Webhook subscription ID | | +| **webhook_subscription_request_schema** | [**\Bandwidth\Model\WebhookSubscriptionRequestSchema**](../Model/WebhookSubscriptionRequestSchema.md)| Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\WebhookSubscription**](../Model/WebhookSubscription.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/TranscriptionsApi.md b/docs/Api/TranscriptionsApi.md new file mode 100644 index 0000000..0f10238 --- /dev/null +++ b/docs/Api/TranscriptionsApi.md @@ -0,0 +1,235 @@ +# Bandwidth\TranscriptionsApi + +All URIs are relative to http://localhost, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**deleteRealTimeTranscription()**](TranscriptionsApi.md#deleteRealTimeTranscription) | **DELETE** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Delete Real-time Transcription | +| [**getRealTimeTranscription()**](TranscriptionsApi.md#getRealTimeTranscription) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Get Real-time Transcription | +| [**listRealTimeTranscriptions()**](TranscriptionsApi.md#listRealTimeTranscriptions) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions | List Real-time Transcriptions | + + +## `deleteRealTimeTranscription()` + +```php +deleteRealTimeTranscription($account_id, $call_id, $transcription_id) +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Delete Real-time Transcription + +Delete the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). Note: After the deletion is requested and a `200` 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 + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TranscriptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$transcription_id = t-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Transcription ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $apiInstance->deleteRealTimeTranscription($account_id, $call_id, $transcription_id, $hostIndex, $variables); +} catch (Exception $e) { + echo 'Exception when calling TranscriptionsApi->deleteRealTimeTranscription: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **transcription_id** | **string**| Programmable Voice API Transcription ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `getRealTimeTranscription()` + +```php +getRealTimeTranscription($account_id, $call_id, $transcription_id): \Bandwidth\Model\CallTranscriptionResponse +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +Get Real-time Transcription + +Retrieve the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TranscriptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. +$transcription_id = t-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Transcription ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->getRealTimeTranscription($account_id, $call_id, $transcription_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TranscriptionsApi->getRealTimeTranscription: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| **transcription_id** | **string**| Programmable Voice API Transcription ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CallTranscriptionResponse**](../Model/CallTranscriptionResponse.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `listRealTimeTranscriptions()` + +```php +listRealTimeTranscriptions($account_id, $call_id): \Bandwidth\Model\CallTranscriptionMetadata[] +``` +### URI(s): +- https://voice.bandwidth.com/api/v2 Production +List Real-time Transcriptions + +List the transcriptions created on this call via [startTranscription](/docs/voice/bxml/startTranscription). + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + +// Configure OAuth2 access token for authorization: OAuth2 +$config = Bandwidth\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Bandwidth\Api\TranscriptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$account_id = 9900000; // string | Your Bandwidth Account ID. +$call_id = c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85; // string | Programmable Voice API Call ID. + +$hostIndex = 0; +$variables = [ +]; + +try { + $result = $apiInstance->listRealTimeTranscriptions($account_id, $call_id, $hostIndex, $variables); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TranscriptionsApi->listRealTimeTranscriptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **account_id** | **string**| Your Bandwidth Account ID. | | +| **call_id** | **string**| Programmable Voice API Call ID. | | +| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] | + +### Return type + +[**\Bandwidth\Model\CallTranscriptionMetadata[]**](../Model/CallTranscriptionMetadata.md) + +### Authorization + +[Basic](../../README.md#Basic), [OAuth2](../../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Model/AccountStatistics.md b/docs/Model/AccountStatistics.md new file mode 100644 index 0000000..e3681ab --- /dev/null +++ b/docs/Model/AccountStatistics.md @@ -0,0 +1,10 @@ +# AccountStatistics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**current_call_queue_size** | **int** | The number of calls currently enqueued. | [optional] +**max_call_queue_size** | **int** | The maximum size of the queue before outgoing calls start being rejected. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AdditionalDenialReason.md b/docs/Model/AdditionalDenialReason.md new file mode 100644 index 0000000..f415166 --- /dev/null +++ b/docs/Model/AdditionalDenialReason.md @@ -0,0 +1,11 @@ +# AdditionalDenialReason + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status_code** | **int** | Reason code for denial. | +**reason** | **string** | Explanation for why a verification request was declined. | +**resubmit_allowed** | **bool** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Address.md b/docs/Model/Address.md new file mode 100644 index 0000000..622be5b --- /dev/null +++ b/docs/Model/Address.md @@ -0,0 +1,15 @@ +# Address + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | The name of the business using the toll-free number. | +**addr1** | **string** | The address of the business using the toll-free number. | +**addr2** | **string** | The address of the business using the toll-free number. | [optional] +**city** | **string** | The city of the business using the toll-free number. | +**state** | **string** | The state of the business using the toll-free number. | +**zip** | **string** | The zip of the business using the toll-free number. | +**url** | **string** | The website of the business using the toll-free number. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AnswerCallback.md b/docs/Model/AnswerCallback.md new file mode 100644 index 0000000..3c3bd60 --- /dev/null +++ b/docs/Model/AnswerCallback.md @@ -0,0 +1,22 @@ +# AnswerCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | 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] +**machine_detection_result** | [**\Bandwidth\Model\MachineDetectionResult**](MachineDetectionResult.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/AsyncLookupRequest.md b/docs/Model/AsyncLookupRequest.md new file mode 100644 index 0000000..c3afbb4 --- /dev/null +++ b/docs/Model/AsyncLookupRequest.md @@ -0,0 +1,9 @@ +# AsyncLookupRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phone_numbers** | **string[]** | Telephone numbers in E.164 format. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BlockedWebhook.md b/docs/Model/BlockedWebhook.md new file mode 100644 index 0000000..8e2a9a0 --- /dev/null +++ b/docs/Model/BlockedWebhook.md @@ -0,0 +1,14 @@ +# BlockedWebhook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **string** | User's account ID. | [optional] +**phone_number** | **string** | Toll-free telephone number in E.164 format. | [optional] +**status** | [**\Bandwidth\Model\TfvCallbackStatusEnum**](TfvCallbackStatusEnum.md) | | [optional] +**internal_ticket_number** | **string** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] +**blocked** | **bool** | Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional] +**blocked_reason** | **string** | The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BridgeCompleteCallback.md b/docs/Model/BridgeCompleteCallback.md new file mode 100644 index 0000000..107200d --- /dev/null +++ b/docs/Model/BridgeCompleteCallback.md @@ -0,0 +1,24 @@ +# BridgeCompleteCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | 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] +**error_message** | **string** | Text explaining the reason that caused the call to fail in case of errors. | [optional] +**error_id** | **string** | Bandwidth's internal id that references the error event. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BridgeTargetCompleteCallback.md b/docs/Model/BridgeTargetCompleteCallback.md new file mode 100644 index 0000000..53f2e21 --- /dev/null +++ b/docs/Model/BridgeTargetCompleteCallback.md @@ -0,0 +1,21 @@ +# BridgeTargetCompleteCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | 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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BrtcError.md b/docs/Model/BrtcError.md new file mode 100644 index 0000000..8d504be --- /dev/null +++ b/docs/Model/BrtcError.md @@ -0,0 +1,13 @@ +# BrtcError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier for the error. | [optional] +**type** | **string** | The type of error. | +**description** | **string** | A description of the error. | +**code** | **string** | A code that uniquely identifies the error. | [optional] +**source** | [**\Bandwidth\Model\BrtcErrorSource**](BrtcErrorSource.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BrtcErrorResponse.md b/docs/Model/BrtcErrorResponse.md new file mode 100644 index 0000000..3e8a9cd --- /dev/null +++ b/docs/Model/BrtcErrorResponse.md @@ -0,0 +1,11 @@ +# BrtcErrorResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**\Bandwidth\Model\BrtcLink[]**](BrtcLink.md) | | +**data** | **object** | | +**errors** | [**\Bandwidth\Model\BrtcError[]**](BrtcError.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BrtcErrorSource.md b/docs/Model/BrtcErrorSource.md new file mode 100644 index 0000000..62b8ae5 --- /dev/null +++ b/docs/Model/BrtcErrorSource.md @@ -0,0 +1,12 @@ +# BrtcErrorSource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameter** | **string** | The URI parameter that caused the error. | [optional] +**field** | **string** | The request body field that caused the error. | [optional] +**header** | **string** | The header that caused the error. | [optional] +**reference** | **string** | The resource ID or path to the resource (or non-existent resource) causing the error. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BrtcLink.md b/docs/Model/BrtcLink.md new file mode 100644 index 0000000..50f4249 --- /dev/null +++ b/docs/Model/BrtcLink.md @@ -0,0 +1,11 @@ +# BrtcLink + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **string** | The full URL of the link. | [optional] +**rel** | **string** | The relationship of the link to the current resource. | [optional] +**method** | **string** | The HTTP method to use when making the request. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BusinessEntityTypeEnum.md b/docs/Model/BusinessEntityTypeEnum.md new file mode 100644 index 0000000..f279aee --- /dev/null +++ b/docs/Model/BusinessEntityTypeEnum.md @@ -0,0 +1,8 @@ +# BusinessEntityTypeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BusinessRegistrationTypeEnum.md b/docs/Model/BusinessRegistrationTypeEnum.md new file mode 100644 index 0000000..ee8ba41 --- /dev/null +++ b/docs/Model/BusinessRegistrationTypeEnum.md @@ -0,0 +1,8 @@ +# BusinessRegistrationTypeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CallDirectionEnum.md b/docs/Model/CallDirectionEnum.md new file mode 100644 index 0000000..754d6d7 --- /dev/null +++ b/docs/Model/CallDirectionEnum.md @@ -0,0 +1,8 @@ +# CallDirectionEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CallRecordingMetadata.md b/docs/Model/CallRecordingMetadata.md new file mode 100644 index 0000000..96da31f --- /dev/null +++ b/docs/Model/CallRecordingMetadata.md @@ -0,0 +1,27 @@ +# CallRecordingMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**application_id** | **string** | The id of the application associated with the call. | [optional] +**account_id** | **string** | The user account associated with the call. | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**parent_call_id** | **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] +**recording_id** | **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. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] +**transfer_to** | **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** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**channels** | **int** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional] +**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [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] +**media_url** | **string** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] +**transcription** | [**\Bandwidth\Model\RecordingTranscriptionMetadata**](RecordingTranscriptionMetadata.md) | | [optional] +**recording_name** | **string** | A name to identify this recording. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CallState.md b/docs/Model/CallState.md new file mode 100644 index 0000000..9dc6923 --- /dev/null +++ b/docs/Model/CallState.md @@ -0,0 +1,26 @@ +# CallState + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**application_id** | **string** | The application id associated with the call. | [optional] +**account_id** | **string** | The account id associated with the call. | [optional] +**call_id** | **string** | The programmable voice API call ID. | [optional] +**parent_call_id** | **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** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [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] +**stir_shaken** | **array** | 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-Validation-Passed` or `TN-Validation-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] +**enqueued_time** | **\DateTime** | The time this call was placed in queue. | [optional] +**start_time** | **\DateTime** | The time the call was initiated, in ISO 8601 format. `null` if the call is still in your queue. | [optional] +**answer_time** | **\DateTime** | Populated once the call has been answered, with the time in ISO 8601 format. | [optional] +**end_time** | **\DateTime** | Populated once the call has ended, with the time in ISO 8601 format. | [optional] +**disconnect_cause** | **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] +**error_message** | **string** | Populated only if the call ended with an error, with text explaining the reason. | [optional] +**error_id** | **string** | Populated only if the call ended with an error, with a Bandwidth internal id that references the error event. | [optional] +**last_update** | **\DateTime** | The last time the call had a state update, in ISO 8601 format. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CallStateEnum.md b/docs/Model/CallStateEnum.md new file mode 100644 index 0000000..8d26071 --- /dev/null +++ b/docs/Model/CallStateEnum.md @@ -0,0 +1,8 @@ +# CallStateEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CallTranscription.md b/docs/Model/CallTranscription.md new file mode 100644 index 0000000..b9ad214 --- /dev/null +++ b/docs/Model/CallTranscription.md @@ -0,0 +1,12 @@ +# CallTranscription + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**detected_language** | [**\Bandwidth\Model\CallTranscriptionDetectedLanguageEnum**](CallTranscriptionDetectedLanguageEnum.md) | | [optional] +**track** | [**\Bandwidth\Model\CallTranscriptionTrackEnum**](CallTranscriptionTrackEnum.md) | | [optional] +**transcript** | **string** | The transcription itself. | [optional] +**confidence** | **float** | How confident the transcription engine was in transcribing the associated audio (from `0` to `1`). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CallTranscriptionDetectedLanguageEnum.md b/docs/Model/CallTranscriptionDetectedLanguageEnum.md new file mode 100644 index 0000000..10a2cb7 --- /dev/null +++ b/docs/Model/CallTranscriptionDetectedLanguageEnum.md @@ -0,0 +1,8 @@ +# CallTranscriptionDetectedLanguageEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CallTranscriptionMetadata.md b/docs/Model/CallTranscriptionMetadata.md new file mode 100644 index 0000000..04ae984 --- /dev/null +++ b/docs/Model/CallTranscriptionMetadata.md @@ -0,0 +1,11 @@ +# CallTranscriptionMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**transcription_id** | **string** | The programmable voice API transcription ID. | [optional] +**transcription_name** | **string** | The programmable voice API transcription name. This name could be provided by the user when creating the transcription. | [optional] +**transcription_url** | **string** | A URL that may be used to retrieve the transcription itself. This points to the [Get Call Transcription](/apis/voice-apis/voice/#tag/Transcriptions/operation/getRealTimeTranscription) endpoint. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CallTranscriptionResponse.md b/docs/Model/CallTranscriptionResponse.md new file mode 100644 index 0000000..cf2d9f5 --- /dev/null +++ b/docs/Model/CallTranscriptionResponse.md @@ -0,0 +1,12 @@ +# CallTranscriptionResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **string** | The user account associated with the call. | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**transcription_id** | **string** | The programmable voice API transcription ID. | [optional] +**tracks** | [**\Bandwidth\Model\CallTranscription[]**](CallTranscription.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CallTranscriptionTrackEnum.md b/docs/Model/CallTranscriptionTrackEnum.md new file mode 100644 index 0000000..a2e7f72 --- /dev/null +++ b/docs/Model/CallTranscriptionTrackEnum.md @@ -0,0 +1,8 @@ +# CallTranscriptionTrackEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Callback.md b/docs/Model/Callback.md new file mode 100644 index 0000000..27e4783 --- /dev/null +++ b/docs/Model/Callback.md @@ -0,0 +1,13 @@ +# Callback + +This model is a `oneOf` wrapper: a value is exactly one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## oneOf + +- [**\Bandwidth\Model\StatusCallback**](StatusCallback.md) +- [**\Bandwidth\Model\InboundCallback**](InboundCallback.md) + +The concrete type is selected by the `type` discriminator property. + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CallbackMethodEnum.md b/docs/Model/CallbackMethodEnum.md new file mode 100644 index 0000000..89658f4 --- /dev/null +++ b/docs/Model/CallbackMethodEnum.md @@ -0,0 +1,8 @@ +# CallbackMethodEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CardWidthEnum.md b/docs/Model/CardWidthEnum.md new file mode 100644 index 0000000..9d737ec --- /dev/null +++ b/docs/Model/CardWidthEnum.md @@ -0,0 +1,8 @@ +# CardWidthEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CodeRequest.md b/docs/Model/CodeRequest.md new file mode 100644 index 0000000..40a0a6d --- /dev/null +++ b/docs/Model/CodeRequest.md @@ -0,0 +1,14 @@ +# 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. | +**application_id** | **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** | **int** | The number of digits for your mfa code. The valid number ranges from 2 to 8, inclusively. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CompletedLookupStatusEnum.md b/docs/Model/CompletedLookupStatusEnum.md new file mode 100644 index 0000000..ea04ebf --- /dev/null +++ b/docs/Model/CompletedLookupStatusEnum.md @@ -0,0 +1,8 @@ +# CompletedLookupStatusEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Conference.md b/docs/Model/Conference.md new file mode 100644 index 0000000..6a35def --- /dev/null +++ b/docs/Model/Conference.md @@ -0,0 +1,16 @@ +# 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] +**created_time** | **\DateTime** | The time the conference was initiated, in ISO 8601 format. | [optional] +**completed_time** | **\DateTime** | The time the conference was terminated, in ISO 8601 format. | [optional] +**conference_event_url** | **string** | The URL to send the conference-related events. | [optional] +**conference_event_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional] +**tag** | **string** | The custom string attached to the conference that will be sent with callbacks. | [optional] +**active_members** | [**\Bandwidth\Model\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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConferenceCompletedCallback.md b/docs/Model/ConferenceCompletedCallback.md new file mode 100644 index 0000000..60a60e8 --- /dev/null +++ b/docs/Model/ConferenceCompletedCallback.md @@ -0,0 +1,13 @@ +# ConferenceCompletedCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**conference_id** | **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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConferenceCreatedCallback.md b/docs/Model/ConferenceCreatedCallback.md new file mode 100644 index 0000000..f54696f --- /dev/null +++ b/docs/Model/ConferenceCreatedCallback.md @@ -0,0 +1,13 @@ +# ConferenceCreatedCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**conference_id** | **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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConferenceMember.md b/docs/Model/ConferenceMember.md new file mode 100644 index 0000000..ad6d74f --- /dev/null +++ b/docs/Model/ConferenceMember.md @@ -0,0 +1,14 @@ +# ConferenceMember + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**call_id** | **string** | The call id associated with the event. | [optional] +**conference_id** | **string** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional] +**member_url** | **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-apis/voice/#tag/Conferences/operation/getConferenceMember) endpoint and [Modify Conference Member](/apis/voice-apis/voice/#tag/Conferences/operation/updateConferenceMember) endpoint. | [optional] +**mute** | **bool** | 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** | **bool** | 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] +**call_ids_to_coach** | **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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConferenceMemberExitCallback.md b/docs/Model/ConferenceMemberExitCallback.md new file mode 100644 index 0000000..837a8e0 --- /dev/null +++ b/docs/Model/ConferenceMemberExitCallback.md @@ -0,0 +1,16 @@ +# ConferenceMemberExitCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**conference_id** | **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. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**call_id** | **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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConferenceMemberJoinCallback.md b/docs/Model/ConferenceMemberJoinCallback.md new file mode 100644 index 0000000..f47aea1 --- /dev/null +++ b/docs/Model/ConferenceMemberJoinCallback.md @@ -0,0 +1,16 @@ +# ConferenceMemberJoinCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**conference_id** | **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. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**call_id** | **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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConferenceRecordingAvailableCallback.md b/docs/Model/ConferenceRecordingAvailableCallback.md new file mode 100644 index 0000000..23a8280 --- /dev/null +++ b/docs/Model/ConferenceRecordingAvailableCallback.md @@ -0,0 +1,22 @@ +# ConferenceRecordingAvailableCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**conference_id** | **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] +**account_id** | **string** | The user account associated with the call. | [optional] +**recording_id** | **string** | The unique ID of this recording | [optional] +**channels** | **int** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional] +**duration** | **string** | The duration of the recording in ISO-8601 format | [optional] +**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [optional] +**media_url** | **string** | 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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConferenceRecordingMetadata.md b/docs/Model/ConferenceRecordingMetadata.md new file mode 100644 index 0000000..257aa51 --- /dev/null +++ b/docs/Model/ConferenceRecordingMetadata.md @@ -0,0 +1,20 @@ +# ConferenceRecordingMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **string** | The user account associated with the call. | [optional] +**conference_id** | **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] +**recording_id** | **string** | The unique ID of this recording | [optional] +**duration** | **string** | The duration of the recording in ISO-8601 format | [optional] +**channels** | **int** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional] +**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [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] +**media_url** | **string** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] +**recording_name** | **string** | A name to identify this recording. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConferenceRedirectCallback.md b/docs/Model/ConferenceRedirectCallback.md new file mode 100644 index 0000000..d1bd898 --- /dev/null +++ b/docs/Model/ConferenceRedirectCallback.md @@ -0,0 +1,13 @@ +# ConferenceRedirectCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**conference_id** | **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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConferenceStateEnum.md b/docs/Model/ConferenceStateEnum.md new file mode 100644 index 0000000..e61483b --- /dev/null +++ b/docs/Model/ConferenceStateEnum.md @@ -0,0 +1,8 @@ +# ConferenceStateEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Contact.md b/docs/Model/Contact.md new file mode 100644 index 0000000..e18b6e6 --- /dev/null +++ b/docs/Model/Contact.md @@ -0,0 +1,12 @@ +# Contact + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**first_name** | **string** | The first name of the business contact using the toll-free number. | +**last_name** | **string** | The last name of the business contact using the toll-free number. | +**email** | **string** | | +**phone_number** | **string** | Contact telephone number | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateAsyncBulkLookupResponse.md b/docs/Model/CreateAsyncBulkLookupResponse.md new file mode 100644 index 0000000..1f8241e --- /dev/null +++ b/docs/Model/CreateAsyncBulkLookupResponse.md @@ -0,0 +1,11 @@ +# CreateAsyncBulkLookupResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**\Bandwidth\Model\LinkSchema[]**](LinkSchema.md) | Links for pagination (if applicable) | [optional] +**data** | [**\Bandwidth\Model\CreateAsyncBulkLookupResponseData**](CreateAsyncBulkLookupResponseData.md) | | [optional] +**errors** | [**\Bandwidth\Model\LookupErrorSchema[]**](LookupErrorSchema.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateAsyncBulkLookupResponseData.md b/docs/Model/CreateAsyncBulkLookupResponseData.md new file mode 100644 index 0000000..257952a --- /dev/null +++ b/docs/Model/CreateAsyncBulkLookupResponseData.md @@ -0,0 +1,10 @@ +# CreateAsyncBulkLookupResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_id** | **string** | The phone number lookup request ID from Bandwidth. | [optional] +**status** | [**\Bandwidth\Model\InProgressLookupStatusEnum**](InProgressLookupStatusEnum.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateCall.md b/docs/Model/CreateCall.md new file mode 100644 index 0000000..08fc238 --- /dev/null +++ b/docs/Model/CreateCall.md @@ -0,0 +1,29 @@ +# 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`) even if `privacy` is set to true. | +**privacy** | **bool** | Hide the calling number. The `displayName` field can be used to customize the displayed name. | [optional] +**display_name** | **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. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`. | [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', 'base64' and 'hex' encodings are allowed. The entire value cannot exceed 350 characters, including parameters and separators. | [optional] +**application_id** | **string** | The id of the application associated with the `from` number. | +**answer_url** | **string** | 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`. | +**answer_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional] +**username** | **string** | Basic auth username. | [optional] +**password** | **string** | Basic auth password. | [optional] +**answer_fallback_url** | **string** | 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] +**answer_fallback_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional] +**fallback_username** | **string** | Basic auth username. | [optional] +**fallback_password** | **string** | Basic auth password. | [optional] +**disconnect_url** | **string** | 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] +**disconnect_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional] +**call_timeout** | **float** | 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] [default to 30] +**callback_timeout** | **float** | 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] [default to 15] +**machine_detection** | [**\Bandwidth\Model\MachineDetectionConfiguration**](MachineDetectionConfiguration.md) | | [optional] +**priority** | **int** | 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] [default to 5] +**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 4096 characters. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateCallResponse.md b/docs/Model/CreateCallResponse.md new file mode 100644 index 0000000..9d8b465 --- /dev/null +++ b/docs/Model/CreateCallResponse.md @@ -0,0 +1,29 @@ +# CreateCallResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**application_id** | **string** | The id of the application associated with the `from` number. | +**account_id** | **string** | The bandwidth account ID associated with the call. | +**call_id** | **string** | Programmable Voice API Call ID. | +**to** | **string** | Recipient of the outgoing call. | +**from** | **string** | Phone number that created the outbound call. | +**enqueued_time** | **\DateTime** | The time at which the call was accepted into the queue. | [optional] +**call_url** | **string** | The URL to update this call's state. | +**call_timeout** | **float** | The timeout (in seconds) for the callee to answer the call after it starts ringing. | [optional] +**callback_timeout** | **float** | This is the timeout (in seconds) to use when delivering webhooks for the call. | [optional] +**tag** | **string** | Custom tag value. | [optional] +**answer_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | +**answer_url** | **string** | URL to deliver the `answer` event webhook. | +**answer_fallback_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional] +**answer_fallback_url** | **string** | Fallback URL to deliver the `answer` event webhook. | [optional] +**disconnect_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | +**disconnect_url** | **string** | URL to deliver the `disconnect` event webhook. | [optional] +**username** | **string** | Basic auth username. | [optional] +**password** | **string** | Basic auth password. | [optional] +**fallback_username** | **string** | Basic auth username. | [optional] +**fallback_password** | **string** | Basic auth password. | [optional] +**priority** | **int** | The priority of this call over other calls from your account. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateEndpointRequestBase.md b/docs/Model/CreateEndpointRequestBase.md new file mode 100644 index 0000000..30f9780 --- /dev/null +++ b/docs/Model/CreateEndpointRequestBase.md @@ -0,0 +1,13 @@ +# CreateEndpointRequestBase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | | +**direction** | [**\Bandwidth\Model\EndpointDirectionEnum**](EndpointDirectionEnum.md) | | +**event_callback_url** | **string** | The URL to send event callbacks to. | [optional] +**event_fallback_url** | **string** | The URL to send event fallbacks to. | [optional] +**tag** | **string** | A tag for the endpoint. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateEndpointResponse.md b/docs/Model/CreateEndpointResponse.md new file mode 100644 index 0000000..59464de --- /dev/null +++ b/docs/Model/CreateEndpointResponse.md @@ -0,0 +1,11 @@ +# CreateEndpointResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**\Bandwidth\Model\BrtcLink[]**](BrtcLink.md) | | +**data** | [**\Bandwidth\Model\CreateEndpointResponseData**](CreateEndpointResponseData.md) | | +**errors** | [**\Bandwidth\Model\BrtcError[]**](BrtcError.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateEndpointResponseData.md b/docs/Model/CreateEndpointResponseData.md new file mode 100644 index 0000000..37f3745 --- /dev/null +++ b/docs/Model/CreateEndpointResponseData.md @@ -0,0 +1,16 @@ +# CreateEndpointResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**endpoint_id** | **string** | The unique ID of the endpoint. | +**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | | +**status** | [**\Bandwidth\Model\EndpointStatusEnum**](EndpointStatusEnum.md) | | +**creation_timestamp** | **\DateTime** | The time the endpoint was created. In ISO-8601 format. | +**expiration_timestamp** | **\DateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | +**tag** | **string** | A tag for the endpoint. | [optional] +**devices** | [**\Bandwidth\Model\Device[]**](Device.md) | | [optional] +**token** | **string** | The json web token specific to the endpoint. Used to authenticate the client with the media gateway. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateMessageRequestError.md b/docs/Model/CreateMessageRequestError.md new file mode 100644 index 0000000..f67b8a2 --- /dev/null +++ b/docs/Model/CreateMessageRequestError.md @@ -0,0 +1,11 @@ +# CreateMessageRequestError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | +**description** | **string** | | +**field_errors** | [**\Bandwidth\Model\FieldError[]**](FieldError.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateMultiChannelMessageResponse.md b/docs/Model/CreateMultiChannelMessageResponse.md new file mode 100644 index 0000000..cfcee27 --- /dev/null +++ b/docs/Model/CreateMultiChannelMessageResponse.md @@ -0,0 +1,11 @@ +# CreateMultiChannelMessageResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**\Bandwidth\Model\Link[]**](Link.md) | | [optional] +**data** | [**\Bandwidth\Model\MultiChannelMessageResponseData**](MultiChannelMessageResponseData.md) | | [optional] +**errors** | [**\Bandwidth\Model\ErrorObject[]**](ErrorObject.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSyncLookupResponse.md b/docs/Model/CreateSyncLookupResponse.md new file mode 100644 index 0000000..96ec124 --- /dev/null +++ b/docs/Model/CreateSyncLookupResponse.md @@ -0,0 +1,11 @@ +# CreateSyncLookupResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**\Bandwidth\Model\LinkSchema[]**](LinkSchema.md) | | [optional] +**data** | [**\Bandwidth\Model\CreateSyncLookupResponseData**](CreateSyncLookupResponseData.md) | | [optional] +**errors** | [**\Bandwidth\Model\LookupErrorSchema[]**](LookupErrorSchema.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateSyncLookupResponseData.md b/docs/Model/CreateSyncLookupResponseData.md new file mode 100644 index 0000000..c7be58f --- /dev/null +++ b/docs/Model/CreateSyncLookupResponseData.md @@ -0,0 +1,11 @@ +# CreateSyncLookupResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_id** | **string** | The phone number lookup request ID from Bandwidth. | [optional] +**status** | [**\Bandwidth\Model\CompletedLookupStatusEnum**](CompletedLookupStatusEnum.md) | | [optional] +**results** | [**\Bandwidth\Model\LookupResult[]**](LookupResult.md) | The carrier information results for the specified telephone numbers. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/CreateWebRtcConnectionRequest.md b/docs/Model/CreateWebRtcConnectionRequest.md new file mode 100644 index 0000000..0394e4f --- /dev/null +++ b/docs/Model/CreateWebRtcConnectionRequest.md @@ -0,0 +1,14 @@ +# CreateWebRtcConnectionRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | | +**direction** | [**\Bandwidth\Model\EndpointDirectionEnum**](EndpointDirectionEnum.md) | | +**event_callback_url** | **string** | The URL to send event callbacks to. | [optional] +**event_fallback_url** | **string** | The URL to send event fallbacks to. | [optional] +**tag** | **string** | A tag for the endpoint. | [optional] +**connection_metadata** | **object** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DeactivationEventEnum.md b/docs/Model/DeactivationEventEnum.md new file mode 100644 index 0000000..c8bdf82 --- /dev/null +++ b/docs/Model/DeactivationEventEnum.md @@ -0,0 +1,8 @@ +# DeactivationEventEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Device.md b/docs/Model/Device.md new file mode 100644 index 0000000..48373dd --- /dev/null +++ b/docs/Model/Device.md @@ -0,0 +1,12 @@ +# Device + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**device_id** | **string** | The unique ID of the device. | +**device_name** | **string** | The name of the device. | [optional] +**status** | [**\Bandwidth\Model\DeviceStatusEnum**](DeviceStatusEnum.md) | | +**creation_timestamp** | **\DateTime** | The time the device was created. In ISO-8601 format. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DeviceStatusEnum.md b/docs/Model/DeviceStatusEnum.md new file mode 100644 index 0000000..7bc751c --- /dev/null +++ b/docs/Model/DeviceStatusEnum.md @@ -0,0 +1,8 @@ +# DeviceStatusEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DisconnectCallback.md b/docs/Model/DisconnectCallback.md new file mode 100644 index 0000000..8cf3fc8 --- /dev/null +++ b/docs/Model/DisconnectCallback.md @@ -0,0 +1,25 @@ +# DisconnectCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional] +**end_time** | **\DateTime** | 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] +**error_message** | **string** | Text explaining the reason that caused the call to fail in case of errors. | [optional] +**error_id** | **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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Diversion.md b/docs/Model/Diversion.md new file mode 100644 index 0000000..7bb2d6c --- /dev/null +++ b/docs/Model/Diversion.md @@ -0,0 +1,15 @@ +# 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] +**orig_to** | **string** | Always present. Indicates the last telephone number that the call was diverted from. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DtmfCallback.md b/docs/Model/DtmfCallback.md new file mode 100644 index 0000000..a01d9d0 --- /dev/null +++ b/docs/Model/DtmfCallback.md @@ -0,0 +1,25 @@ +# DtmfCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**digit** | **string** | The digit collected in the call. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional] +**parent_call_id** | **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] +**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] +**transfer_to** | **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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Endpoint.md b/docs/Model/Endpoint.md new file mode 100644 index 0000000..708d4ff --- /dev/null +++ b/docs/Model/Endpoint.md @@ -0,0 +1,15 @@ +# Endpoint + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**endpoint_id** | **string** | The unique ID of the endpoint. | +**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | | +**status** | [**\Bandwidth\Model\EndpointStatusEnum**](EndpointStatusEnum.md) | | +**creation_timestamp** | **\DateTime** | The time the endpoint was created. In ISO-8601 format. | +**expiration_timestamp** | **\DateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | +**tag** | **string** | A tag for the endpoint. | [optional] +**devices** | [**\Bandwidth\Model\Device[]**](Device.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EndpointDirectionEnum.md b/docs/Model/EndpointDirectionEnum.md new file mode 100644 index 0000000..41e4d0f --- /dev/null +++ b/docs/Model/EndpointDirectionEnum.md @@ -0,0 +1,8 @@ +# EndpointDirectionEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EndpointEvent.md b/docs/Model/EndpointEvent.md new file mode 100644 index 0000000..efe57fd --- /dev/null +++ b/docs/Model/EndpointEvent.md @@ -0,0 +1,17 @@ +# EndpointEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**endpoint_id** | **string** | The unique ID of the endpoint. | +**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | | +**status** | [**\Bandwidth\Model\EndpointStatusEnum**](EndpointStatusEnum.md) | | +**creation_timestamp** | **\DateTime** | The time the endpoint was created. In ISO-8601 format. | +**expiration_timestamp** | **\DateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | +**tag** | **string** | A tag for the endpoint. | [optional] +**event_time** | **\DateTime** | The time the event occurred. In ISO-8601 format. | +**event_type** | [**\Bandwidth\Model\EndpointEventTypeEnum**](EndpointEventTypeEnum.md) | | +**device** | [**\Bandwidth\Model\Device**](Device.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EndpointEventTypeEnum.md b/docs/Model/EndpointEventTypeEnum.md new file mode 100644 index 0000000..da95b81 --- /dev/null +++ b/docs/Model/EndpointEventTypeEnum.md @@ -0,0 +1,8 @@ +# EndpointEventTypeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EndpointResponse.md b/docs/Model/EndpointResponse.md new file mode 100644 index 0000000..f0bc49d --- /dev/null +++ b/docs/Model/EndpointResponse.md @@ -0,0 +1,11 @@ +# EndpointResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**\Bandwidth\Model\BrtcLink[]**](BrtcLink.md) | | +**data** | [**\Bandwidth\Model\Endpoint**](Endpoint.md) | | +**errors** | [**\Bandwidth\Model\BrtcError[]**](BrtcError.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EndpointStatusEnum.md b/docs/Model/EndpointStatusEnum.md new file mode 100644 index 0000000..c854291 --- /dev/null +++ b/docs/Model/EndpointStatusEnum.md @@ -0,0 +1,8 @@ +# EndpointStatusEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/EndpointTypeEnum.md b/docs/Model/EndpointTypeEnum.md new file mode 100644 index 0000000..f6014f6 --- /dev/null +++ b/docs/Model/EndpointTypeEnum.md @@ -0,0 +1,8 @@ +# EndpointTypeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Endpoints.md b/docs/Model/Endpoints.md new file mode 100644 index 0000000..4140446 --- /dev/null +++ b/docs/Model/Endpoints.md @@ -0,0 +1,14 @@ +# Endpoints + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**endpoint_id** | **string** | The unique ID of the endpoint. | +**type** | [**\Bandwidth\Model\EndpointTypeEnum**](EndpointTypeEnum.md) | | +**status** | [**\Bandwidth\Model\EndpointStatusEnum**](EndpointStatusEnum.md) | | +**creation_timestamp** | **\DateTime** | The time the endpoint was created. In ISO-8601 format. | +**expiration_timestamp** | **\DateTime** | The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. | +**tag** | **string** | A tag for the endpoint. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorObject.md b/docs/Model/ErrorObject.md new file mode 100644 index 0000000..6a2f6ad --- /dev/null +++ b/docs/Model/ErrorObject.md @@ -0,0 +1,11 @@ +# ErrorObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | A concise summary of the error used for categorization. | +**description** | **string** | A detailed explanation of the error. | +**source** | [**\Bandwidth\Model\ErrorSource**](ErrorSource.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorSource.md b/docs/Model/ErrorSource.md new file mode 100644 index 0000000..6450d7e --- /dev/null +++ b/docs/Model/ErrorSource.md @@ -0,0 +1,12 @@ +# ErrorSource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**parameter** | **string** | The relevant URI query parameter causing the error | [optional] +**field** | **string** | The request body field that led to the error | [optional] +**header** | **string** | The header field that contributed to the error | [optional] +**reference** | **string** | A resource ID or path linked to the error | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FailureWebhook.md b/docs/Model/FailureWebhook.md new file mode 100644 index 0000000..57ff20f --- /dev/null +++ b/docs/Model/FailureWebhook.md @@ -0,0 +1,14 @@ +# FailureWebhook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **string** | User's account ID. | [optional] +**phone_number** | **string** | Toll-free telephone number in E.164 format. | [optional] +**error_code** | **string** | An error code indicating what error was encountered. This code can be interpreted as an HTTP status code in regards to the error that was encountered. | [optional] +**error_message** | **string** | A description of the error that was encountered. | [optional] +**errors** | **string[]** | Details of the errors that were encountered when processing the request. | [optional] +**internal_ticket_number** | **string** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FieldError.md b/docs/Model/FieldError.md new file mode 100644 index 0000000..9bb021f --- /dev/null +++ b/docs/Model/FieldError.md @@ -0,0 +1,10 @@ +# FieldError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**field_name** | **string** | The name of the field that contains the error | [optional] +**description** | **string** | The error associated with the field | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FileFormatEnum.md b/docs/Model/FileFormatEnum.md new file mode 100644 index 0000000..3bfc575 --- /dev/null +++ b/docs/Model/FileFormatEnum.md @@ -0,0 +1,8 @@ +# FileFormatEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GatherCallback.md b/docs/Model/GatherCallback.md new file mode 100644 index 0000000..681db30 --- /dev/null +++ b/docs/Model/GatherCallback.md @@ -0,0 +1,26 @@ +# GatherCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **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] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional] +**parent_call_id** | **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] +**terminating_digit** | **string** | (optional) The digit the user pressed to end the gather. Empty string value if no terminating digit was pressed. | [optional] +**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] +**transfer_to** | **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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAsyncBulkLookupResponse.md b/docs/Model/GetAsyncBulkLookupResponse.md new file mode 100644 index 0000000..d9e45a6 --- /dev/null +++ b/docs/Model/GetAsyncBulkLookupResponse.md @@ -0,0 +1,11 @@ +# GetAsyncBulkLookupResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**\Bandwidth\Model\LinkSchema[]**](LinkSchema.md) | | [optional] +**data** | [**\Bandwidth\Model\GetAsyncBulkLookupResponseData**](GetAsyncBulkLookupResponseData.md) | | [optional] +**errors** | [**\Bandwidth\Model\LookupErrorSchema[]**](LookupErrorSchema.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GetAsyncBulkLookupResponseData.md b/docs/Model/GetAsyncBulkLookupResponseData.md new file mode 100644 index 0000000..f0a4530 --- /dev/null +++ b/docs/Model/GetAsyncBulkLookupResponseData.md @@ -0,0 +1,11 @@ +# GetAsyncBulkLookupResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_id** | **string** | The phone number lookup request ID from Bandwidth. | [optional] +**status** | [**\Bandwidth\Model\InProgressLookupStatusEnum**](InProgressLookupStatusEnum.md) | | [optional] +**results** | [**\Bandwidth\Model\LookupResult[]**](LookupResult.md) | The carrier information results for the specified telephone number. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/InProgressLookupStatusEnum.md b/docs/Model/InProgressLookupStatusEnum.md new file mode 100644 index 0000000..cfbdbde --- /dev/null +++ b/docs/Model/InProgressLookupStatusEnum.md @@ -0,0 +1,8 @@ +# InProgressLookupStatusEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/InboundCallback.md b/docs/Model/InboundCallback.md new file mode 100644 index 0000000..f354409 --- /dev/null +++ b/docs/Model/InboundCallback.md @@ -0,0 +1,14 @@ +# InboundCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time** | **\DateTime** | | +**type** | [**\Bandwidth\Model\InboundCallbackTypeEnum**](InboundCallbackTypeEnum.md) | | +**to** | **string** | The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. | +**description** | **string** | A detailed description of the event described by the callback. | +**message** | [**\Bandwidth\Model\InboundCallbackMessage**](InboundCallbackMessage.md) | | +**carrier_name** | **string** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/InboundCallbackMessage.md b/docs/Model/InboundCallbackMessage.md new file mode 100644 index 0000000..b96d8bf --- /dev/null +++ b/docs/Model/InboundCallbackMessage.md @@ -0,0 +1,24 @@ +# InboundCallbackMessage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier of the message. | +**owner** | **string** | The Bandwidth phone number or alphanumeric identifier associated with the message. | +**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | +**time** | **\DateTime** | | +**segment_count** | **int** | The number of segments the user's message is broken into before sending over carrier networks. | +**direction** | [**\Bandwidth\Model\MessageDirectionEnum**](MessageDirectionEnum.md) | | +**to** | **string[]** | The phone number recipients of the message. | +**from** | **string** | The Bandwidth phone number or alphanumeric identifier the message was sent from. | +**text** | **string** | | [optional] +**tag** | **string** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] +**media** | **string[]** | Optional media, not applicable for sms | [optional] +**priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional] +**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | [optional] +**content** | [**\Bandwidth\Model\MultiChannelMessageContent**](MultiChannelMessageContent.md) | | [optional] +**suggestion_response** | [**\Bandwidth\Model\RbmSuggestionResponse**](RbmSuggestionResponse.md) | | [optional] +**location_response** | [**\Bandwidth\Model\RbmLocationResponse**](RbmLocationResponse.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/InboundCallbackTypeEnum.md b/docs/Model/InboundCallbackTypeEnum.md new file mode 100644 index 0000000..39ed500 --- /dev/null +++ b/docs/Model/InboundCallbackTypeEnum.md @@ -0,0 +1,8 @@ +# InboundCallbackTypeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/InitiateCallback.md b/docs/Model/InitiateCallback.md new file mode 100644 index 0000000..4096e04 --- /dev/null +++ b/docs/Model/InitiateCallback.md @@ -0,0 +1,21 @@ +# InitiateCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**diversion** | [**\Bandwidth\Model\Diversion**](Diversion.md) | | [optional] +**stir_shaken** | [**\Bandwidth\Model\StirShaken**](StirShaken.md) | | [optional] +**uui** | **string** | 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`, `jwt` and `hex` encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LatestMessageDeliveryStatusEnum.md b/docs/Model/LatestMessageDeliveryStatusEnum.md new file mode 100644 index 0000000..1a815b4 --- /dev/null +++ b/docs/Model/LatestMessageDeliveryStatusEnum.md @@ -0,0 +1,8 @@ +# LatestMessageDeliveryStatusEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LineTypeEnum.md b/docs/Model/LineTypeEnum.md new file mode 100644 index 0000000..da9aa1d --- /dev/null +++ b/docs/Model/LineTypeEnum.md @@ -0,0 +1,8 @@ +# LineTypeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Link.md b/docs/Model/Link.md new file mode 100644 index 0000000..3c32c36 --- /dev/null +++ b/docs/Model/Link.md @@ -0,0 +1,10 @@ +# Link + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rel** | **string** | | [optional] +**href** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LinkSchema.md b/docs/Model/LinkSchema.md new file mode 100644 index 0000000..f471ad1 --- /dev/null +++ b/docs/Model/LinkSchema.md @@ -0,0 +1,11 @@ +# LinkSchema + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **string** | URI of the link. | [optional] +**rel** | **string** | Specifies the relationship between this link and the resource. | [optional] +**method** | **string** | HTTP method to be used. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LinksObject.md b/docs/Model/LinksObject.md new file mode 100644 index 0000000..cc059c5 --- /dev/null +++ b/docs/Model/LinksObject.md @@ -0,0 +1,12 @@ +# LinksObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**first** | **string** | The first (or only) page of results matching the query. | [optional] +**next** | **string** | If more results exist than specified by 'size', this link returns the next page of 'size' results. | [optional] +**previous** | **string** | If the results are more than one page, this link returns the previous page of 'size' results. | [optional] +**last** | **string** | If more results exist than specified by 'size', this link return the last page of result. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ListEndpointsResponse.md b/docs/Model/ListEndpointsResponse.md new file mode 100644 index 0000000..f01b1ba --- /dev/null +++ b/docs/Model/ListEndpointsResponse.md @@ -0,0 +1,12 @@ +# ListEndpointsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**\Bandwidth\Model\BrtcLink[]**](BrtcLink.md) | | +**page** | [**\Bandwidth\Model\Page**](Page.md) | | [optional] +**data** | [**\Bandwidth\Model\Endpoints[]**](Endpoints.md) | | +**errors** | [**\Bandwidth\Model\BrtcError[]**](BrtcError.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ListMessageDirectionEnum.md b/docs/Model/ListMessageDirectionEnum.md new file mode 100644 index 0000000..6cffce5 --- /dev/null +++ b/docs/Model/ListMessageDirectionEnum.md @@ -0,0 +1,8 @@ +# ListMessageDirectionEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ListMessageItem.md b/docs/Model/ListMessageItem.md new file mode 100644 index 0000000..bf7b090 --- /dev/null +++ b/docs/Model/ListMessageItem.md @@ -0,0 +1,31 @@ +# ListMessageItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | The message id | [optional] +**account_id** | **string** | The account id associated with this message. | [optional] +**source_tn** | **string** | The source phone number of the message. | [optional] +**destination_tn** | **string** | The recipient phone number of the message. | [optional] +**message_status** | [**\Bandwidth\Model\MessageStatusEnum**](MessageStatusEnum.md) | | [optional] +**message_direction** | [**\Bandwidth\Model\ListMessageDirectionEnum**](ListMessageDirectionEnum.md) | | [optional] +**message_type** | [**\Bandwidth\Model\MessageTypeEnum**](MessageTypeEnum.md) | | [optional] +**segment_count** | **int** | The number of segments the user's message is broken into before sending over carrier networks. | [optional] +**error_code** | **int** | The numeric error code of the message. | [optional] +**receive_time** | **\DateTime** | The ISO 8601 datetime of the message. | [optional] +**carrier_name** | **string** | The name of the carrier. Not currently supported for MMS coming soon. | [optional] +**message_size** | **int** | The size of the message including message content and headers. | [optional] +**message_length** | **int** | The length of the message content. | [optional] +**attachment_count** | **int** | The number of attachments the message has. | [optional] +**recipient_count** | **int** | The number of recipients the message has. | [optional] +**campaign_class** | **string** | The campaign class of the message if it has one. | [optional] +**campaign_id** | **string** | The campaign ID of the message if it has one. | [optional] +**bw_latency** | **int** | The Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. | [optional] +**carrier_latency** | **int** | The carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. | [optional] +**calling_number_country_a3** | **string** | The A3 country code of the calling number. | [optional] +**called_number_country_a3** | **string** | The A3 country code of the called number. | [optional] +**product** | **string** | The messaging product associated with the message. | [optional] +**location** | **string** | The location ID associated with this message. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LookupErrorResponse.md b/docs/Model/LookupErrorResponse.md new file mode 100644 index 0000000..c15beef --- /dev/null +++ b/docs/Model/LookupErrorResponse.md @@ -0,0 +1,11 @@ +# LookupErrorResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**\Bandwidth\Model\LinkSchema[]**](LinkSchema.md) | | [optional] +**data** | **object** | The phone number lookup response data | [optional] +**errors** | [**\Bandwidth\Model\LookupErrorSchema[]**](LookupErrorSchema.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LookupErrorSchema.md b/docs/Model/LookupErrorSchema.md new file mode 100644 index 0000000..b503053 --- /dev/null +++ b/docs/Model/LookupErrorSchema.md @@ -0,0 +1,12 @@ +# LookupErrorSchema + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Validation error code | +**description** | **string** | Description of validation error | +**type** | **string** | Type of validation error | +**meta** | [**\Bandwidth\Model\LookupErrorSchemaMeta**](LookupErrorSchemaMeta.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LookupErrorSchemaMeta.md b/docs/Model/LookupErrorSchemaMeta.md new file mode 100644 index 0000000..5519510 --- /dev/null +++ b/docs/Model/LookupErrorSchemaMeta.md @@ -0,0 +1,11 @@ +# LookupErrorSchemaMeta + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phone_numbers** | **string[]** | | [optional] +**message** | **string** | Message describing the error | [optional] +**code** | **int** | Error code associated with the message | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/LookupResult.md b/docs/Model/LookupResult.md new file mode 100644 index 0000000..0a7c71e --- /dev/null +++ b/docs/Model/LookupResult.md @@ -0,0 +1,20 @@ +# LookupResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phone_number** | **string** | The telephone number in E.164 format. | [optional] +**line_type** | [**\Bandwidth\Model\LineTypeEnum**](LineTypeEnum.md) | | [optional] +**messaging_provider** | **string** | The messaging service provider of the telephone number. | [optional] +**voice_provider** | **string** | The voice service provider of the telephone number. | [optional] +**country_code_a3** | **string** | The country code of the telephone number in ISO 3166-1 alpha-3 format. | [optional] +**deactivation_reporter** | **string** | [DNI-Only](#section/DNI-Only). The carrier that reported a deactivation event for this phone number. | [optional] +**deactivation_date** | **string** | [DNI-Only](#section/DNI-Only). The datetime the carrier reported a deactivation event. | [optional] +**deactivation_event** | [**\Bandwidth\Model\DeactivationEventEnum**](DeactivationEventEnum.md) | | [optional] +**latest_message_delivery_status** | [**\Bandwidth\Model\LatestMessageDeliveryStatusEnum**](LatestMessageDeliveryStatusEnum.md) | | [optional] +**initial_message_delivery_status_date** | **\DateTime** | [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional] +**latest_message_delivery_status_date** | **\DateTime** | [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional] +**rcs_enabled** | **bool** | [RCS-Only](#section/RCS-Only). Indicates whether the phone number is capable of receiving RCS messages. Value will be null if account has RCS, but no value was returned. Absent when account does not have RCS. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MachineDetectionCompleteCallback.md b/docs/Model/MachineDetectionCompleteCallback.md new file mode 100644 index 0000000..8f5ae3a --- /dev/null +++ b/docs/Model/MachineDetectionCompleteCallback.md @@ -0,0 +1,22 @@ +# MachineDetectionCompleteCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | 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] +**machine_detection_result** | [**\Bandwidth\Model\MachineDetectionResult**](MachineDetectionResult.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MachineDetectionConfiguration.md b/docs/Model/MachineDetectionConfiguration.md new file mode 100644 index 0000000..bf1bf0d --- /dev/null +++ b/docs/Model/MachineDetectionConfiguration.md @@ -0,0 +1,23 @@ +# MachineDetectionConfiguration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mode** | [**\Bandwidth\Model\MachineDetectionModeEnum**](MachineDetectionModeEnum.md) | | [optional] +**detection_timeout** | **float** | 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] [default to 15] +**silence_timeout** | **float** | If no speech is detected in this period, a callback with a 'silence' result is sent. | [optional] [default to 10] +**speech_threshold** | **float** | 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] [default to 10] +**speech_end_threshold** | **float** | Amount of silence (in seconds) before assuming the callee has finished speaking. | [optional] [default to 5] +**machine_speech_end_threshold** | **float** | 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] +**delay_result** | **bool** | 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] [default to false] +**callback_url** | **string** | The URL to send the 'machineDetectionComplete' webhook when the detection is completed. Only for 'async' mode. | [optional] +**callback_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional] +**username** | **string** | Basic auth username. | [optional] +**password** | **string** | Basic auth password. | [optional] +**fallback_url** | **string** | A fallback URL which, if provided, will be used to retry the machine detection complete webhook delivery in case `callbackUrl` fails to respond | [optional] +**fallback_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [optional] +**fallback_username** | **string** | Basic auth username. | [optional] +**fallback_password** | **string** | Basic auth password. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MachineDetectionModeEnum.md b/docs/Model/MachineDetectionModeEnum.md new file mode 100644 index 0000000..8d6bdd3 --- /dev/null +++ b/docs/Model/MachineDetectionModeEnum.md @@ -0,0 +1,8 @@ +# MachineDetectionModeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MachineDetectionResult.md b/docs/Model/MachineDetectionResult.md new file mode 100644 index 0000000..d4c241d --- /dev/null +++ b/docs/Model/MachineDetectionResult.md @@ -0,0 +1,10 @@ +# MachineDetectionResult + +## 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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Media.md b/docs/Model/Media.md new file mode 100644 index 0000000..f0e615f --- /dev/null +++ b/docs/Model/Media.md @@ -0,0 +1,11 @@ +# Media + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | **string** | | [optional] +**content_length** | **int** | | [optional] +**media_name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Message.md b/docs/Model/Message.md new file mode 100644 index 0000000..4dd7686 --- /dev/null +++ b/docs/Model/Message.md @@ -0,0 +1,21 @@ +# 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] +**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | [optional] +**time** | **\DateTime** | The datetime stamp of the message in ISO 8601 | [optional] +**segment_count** | **int** | The number of segments the user's message is broken into before sending over carrier networks. | [optional] +**direction** | [**\Bandwidth\Model\MessageDirectionEnum**](MessageDirectionEnum.md) | | [optional] +**to** | **string[]** | The phone number recipients of the message. | [optional] +**from** | **string** | The phone number the message was sent from. | [optional] +**media** | **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** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] +**priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional] +**expiration** | **\DateTime** | 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. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MessageDirectionEnum.md b/docs/Model/MessageDirectionEnum.md new file mode 100644 index 0000000..66ca35e --- /dev/null +++ b/docs/Model/MessageDirectionEnum.md @@ -0,0 +1,8 @@ +# MessageDirectionEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MessageRequest.md b/docs/Model/MessageRequest.md new file mode 100644 index 0000000..391bf4f --- /dev/null +++ b/docs/Model/MessageRequest.md @@ -0,0 +1,16 @@ +# MessageRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | +**to** | **string[]** | The phone number(s) the message should be sent to in E164 format. | +**from** | **string** | Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. | +**text** | **string** | The contents of the text message. Must be 2048 characters or less. | [optional] +**media** | **string[]** | 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** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional] +**expiration** | **\DateTime** | 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. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MessageStatusEnum.md b/docs/Model/MessageStatusEnum.md new file mode 100644 index 0000000..66049bb --- /dev/null +++ b/docs/Model/MessageStatusEnum.md @@ -0,0 +1,8 @@ +# MessageStatusEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MessageTypeEnum.md b/docs/Model/MessageTypeEnum.md new file mode 100644 index 0000000..520484e --- /dev/null +++ b/docs/Model/MessageTypeEnum.md @@ -0,0 +1,8 @@ +# MessageTypeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MessagesList.md b/docs/Model/MessagesList.md new file mode 100644 index 0000000..5422a85 --- /dev/null +++ b/docs/Model/MessagesList.md @@ -0,0 +1,11 @@ +# MessagesList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total_count** | **int** | 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] +**page_info** | [**\Bandwidth\Model\PageInfo**](PageInfo.md) | | [optional] +**messages** | [**\Bandwidth\Model\ListMessageItem[]**](ListMessageItem.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MessagingCodeResponse.md b/docs/Model/MessagingCodeResponse.md new file mode 100644 index 0000000..e53d356 --- /dev/null +++ b/docs/Model/MessagingCodeResponse.md @@ -0,0 +1,9 @@ +# MessagingCodeResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message_id** | **string** | Messaging API Message ID. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MessagingRequestError.md b/docs/Model/MessagingRequestError.md new file mode 100644 index 0000000..7a96a10 --- /dev/null +++ b/docs/Model/MessagingRequestError.md @@ -0,0 +1,10 @@ +# MessagingRequestError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | +**description** | **string** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MfaForbiddenRequestError.md b/docs/Model/MfaForbiddenRequestError.md new file mode 100644 index 0000000..cf5356e --- /dev/null +++ b/docs/Model/MfaForbiddenRequestError.md @@ -0,0 +1,9 @@ +# MfaForbiddenRequestError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | The message containing the reason behind the request being forbidden. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MfaRequestError.md b/docs/Model/MfaRequestError.md new file mode 100644 index 0000000..518e315 --- /dev/null +++ b/docs/Model/MfaRequestError.md @@ -0,0 +1,10 @@ +# MfaRequestError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | A message describing the error with your request. | [optional] +**request_id** | **string** | The associated requestId from AWS. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MfaUnauthorizedRequestError.md b/docs/Model/MfaUnauthorizedRequestError.md new file mode 100644 index 0000000..efd1664 --- /dev/null +++ b/docs/Model/MfaUnauthorizedRequestError.md @@ -0,0 +1,9 @@ +# MfaUnauthorizedRequestError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**message** | **string** | Unauthorized | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MmsMessageContent.md b/docs/Model/MmsMessageContent.md new file mode 100644 index 0000000..c03e1eb --- /dev/null +++ b/docs/Model/MmsMessageContent.md @@ -0,0 +1,10 @@ +# MmsMessageContent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**text** | **string** | The contents of the text message. Must be 2048 characters or less. | [optional] +**media** | [**\Bandwidth\Model\MmsMessageContentFile[]**](MmsMessageContentFile.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MmsMessageContentFile.md b/docs/Model/MmsMessageContentFile.md new file mode 100644 index 0000000..7a5c67c --- /dev/null +++ b/docs/Model/MmsMessageContentFile.md @@ -0,0 +1,9 @@ +# MmsMessageContentFile + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file_url** | **string** | The URL of a media attachment. For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see more at [Bandwidth Support](https://www.bandwidth.com/support/en/articles/12823216-what-are-the-mms-file-size-limits) for more details. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelAction.md b/docs/Model/MultiChannelAction.md new file mode 100644 index 0000000..41741b2 --- /dev/null +++ b/docs/Model/MultiChannelAction.md @@ -0,0 +1,16 @@ +# MultiChannelAction + +This model is an `anyOf` wrapper: a value is at least one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## anyOf + +- [**\Bandwidth\Model\RbmActionBase**](RbmActionBase.md) +- [**\Bandwidth\Model\RbmActionDial**](RbmActionDial.md) +- [**\Bandwidth\Model\RbmActionViewLocation**](RbmActionViewLocation.md) +- [**\Bandwidth\Model\MultiChannelActionCalendarEvent**](MultiChannelActionCalendarEvent.md) +- [**\Bandwidth\Model\RbmActionOpenUrl**](RbmActionOpenUrl.md) + +The concrete type is selected by the `type` discriminator property. + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelActionCalendarEvent.md b/docs/Model/MultiChannelActionCalendarEvent.md new file mode 100644 index 0000000..7a41991 --- /dev/null +++ b/docs/Model/MultiChannelActionCalendarEvent.md @@ -0,0 +1,15 @@ +# MultiChannelActionCalendarEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**\Bandwidth\Model\RbmActionTypeEnum**](RbmActionTypeEnum.md) | | +**text** | **string** | Displayed text for user to click | +**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | +**title** | **string** | The title of the event. | +**start_time** | **\DateTime** | The start time of the event. Must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. | +**end_time** | **\DateTime** | The end time of the event. Must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. | +**description** | **string** | The description of the event. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelChannelListMMSObject.md b/docs/Model/MultiChannelChannelListMMSObject.md new file mode 100644 index 0000000..e1b6dd7 --- /dev/null +++ b/docs/Model/MultiChannelChannelListMMSObject.md @@ -0,0 +1,12 @@ +# MultiChannelChannelListMMSObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. | +**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | +**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | +**content** | [**\Bandwidth\Model\MmsMessageContent**](MmsMessageContent.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelChannelListMMSResponseObject.md b/docs/Model/MultiChannelChannelListMMSResponseObject.md new file mode 100644 index 0000000..cda71d2 --- /dev/null +++ b/docs/Model/MultiChannelChannelListMMSResponseObject.md @@ -0,0 +1,13 @@ +# MultiChannelChannelListMMSResponseObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. | +**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | +**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | +**content** | [**\Bandwidth\Model\MmsMessageContent**](MmsMessageContent.md) | | +**owner** | **string** | The Bandwidth senderId associated with the message. Identical to 'from'. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelChannelListObjectBase.md b/docs/Model/MultiChannelChannelListObjectBase.md new file mode 100644 index 0000000..9539922 --- /dev/null +++ b/docs/Model/MultiChannelChannelListObjectBase.md @@ -0,0 +1,11 @@ +# MultiChannelChannelListObjectBase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. | +**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | +**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelChannelListOwnerObject.md b/docs/Model/MultiChannelChannelListOwnerObject.md new file mode 100644 index 0000000..e44a22d --- /dev/null +++ b/docs/Model/MultiChannelChannelListOwnerObject.md @@ -0,0 +1,9 @@ +# MultiChannelChannelListOwnerObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**owner** | **string** | The Bandwidth senderId associated with the message. Identical to 'from'. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelChannelListRBMObject.md b/docs/Model/MultiChannelChannelListRBMObject.md new file mode 100644 index 0000000..ef0ec8d --- /dev/null +++ b/docs/Model/MultiChannelChannelListRBMObject.md @@ -0,0 +1,12 @@ +# MultiChannelChannelListRBMObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. | +**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | +**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | +**content** | [**\Bandwidth\Model\MultiChannelChannelListRBMObjectAllOfContent**](MultiChannelChannelListRBMObjectAllOfContent.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelChannelListRBMObjectAllOfContent.md b/docs/Model/MultiChannelChannelListRBMObjectAllOfContent.md new file mode 100644 index 0000000..d8e82e4 --- /dev/null +++ b/docs/Model/MultiChannelChannelListRBMObjectAllOfContent.md @@ -0,0 +1,13 @@ +# MultiChannelChannelListRBMObjectAllOfContent + +This model is a `oneOf` wrapper: a value is exactly one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## oneOf + +- [**\Bandwidth\Model\RbmMessageContentText**](RbmMessageContentText.md) +- [**\Bandwidth\Model\RbmMessageMedia**](RbmMessageMedia.md) +- [**\Bandwidth\Model\RbmStandaloneCard**](RbmStandaloneCard.md) +- [**\Bandwidth\Model\RbmMessageCarouselCard**](RbmMessageCarouselCard.md) + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelChannelListRBMResponseObject.md b/docs/Model/MultiChannelChannelListRBMResponseObject.md new file mode 100644 index 0000000..767cab7 --- /dev/null +++ b/docs/Model/MultiChannelChannelListRBMResponseObject.md @@ -0,0 +1,13 @@ +# MultiChannelChannelListRBMResponseObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. | +**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | +**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | +**content** | [**\Bandwidth\Model\MultiChannelChannelListRBMObjectAllOfContent**](MultiChannelChannelListRBMObjectAllOfContent.md) | | +**owner** | **string** | The Bandwidth senderId associated with the message. Identical to 'from'. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelChannelListRequestObject.md b/docs/Model/MultiChannelChannelListRequestObject.md new file mode 100644 index 0000000..bbd1af3 --- /dev/null +++ b/docs/Model/MultiChannelChannelListRequestObject.md @@ -0,0 +1,14 @@ +# MultiChannelChannelListRequestObject + +This model is an `anyOf` wrapper: a value is at least one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## anyOf + +- [**\Bandwidth\Model\MultiChannelChannelListRBMObject**](MultiChannelChannelListRBMObject.md) +- [**\Bandwidth\Model\MultiChannelChannelListSMSObject**](MultiChannelChannelListSMSObject.md) +- [**\Bandwidth\Model\MultiChannelChannelListMMSObject**](MultiChannelChannelListMMSObject.md) + +The concrete type is selected by the `channel` discriminator property. + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelChannelListResponseObject.md b/docs/Model/MultiChannelChannelListResponseObject.md new file mode 100644 index 0000000..aa651d5 --- /dev/null +++ b/docs/Model/MultiChannelChannelListResponseObject.md @@ -0,0 +1,14 @@ +# MultiChannelChannelListResponseObject + +This model is an `anyOf` wrapper: a value is at least one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## anyOf + +- [**\Bandwidth\Model\MultiChannelChannelListRBMResponseObject**](MultiChannelChannelListRBMResponseObject.md) +- [**\Bandwidth\Model\MultiChannelChannelListSMSResponseObject**](MultiChannelChannelListSMSResponseObject.md) +- [**\Bandwidth\Model\MultiChannelChannelListMMSResponseObject**](MultiChannelChannelListMMSResponseObject.md) + +The concrete type is selected by the `channel` discriminator property. + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelChannelListSMSObject.md b/docs/Model/MultiChannelChannelListSMSObject.md new file mode 100644 index 0000000..922b58b --- /dev/null +++ b/docs/Model/MultiChannelChannelListSMSObject.md @@ -0,0 +1,12 @@ +# MultiChannelChannelListSMSObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. | +**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | +**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | +**content** | [**\Bandwidth\Model\SmsMessageContent**](SmsMessageContent.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelChannelListSMSResponseObject.md b/docs/Model/MultiChannelChannelListSMSResponseObject.md new file mode 100644 index 0000000..b48fcc1 --- /dev/null +++ b/docs/Model/MultiChannelChannelListSMSResponseObject.md @@ -0,0 +1,13 @@ +# MultiChannelChannelListSMSResponseObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **string** | The sender ID of the message. This could be an alphanumeric sender ID. | +**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | +**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | +**content** | [**\Bandwidth\Model\SmsMessageContent**](SmsMessageContent.md) | | +**owner** | **string** | The Bandwidth senderId associated with the message. Identical to 'from'. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelError.md b/docs/Model/MultiChannelError.md new file mode 100644 index 0000000..baed1f1 --- /dev/null +++ b/docs/Model/MultiChannelError.md @@ -0,0 +1,11 @@ +# MultiChannelError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**\Bandwidth\Model\Link[]**](Link.md) | | [optional] +**data** | **object** | | [optional] +**errors** | [**\Bandwidth\Model\ErrorObject[]**](ErrorObject.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelMessageChannelEnum.md b/docs/Model/MultiChannelMessageChannelEnum.md new file mode 100644 index 0000000..7a93619 --- /dev/null +++ b/docs/Model/MultiChannelMessageChannelEnum.md @@ -0,0 +1,8 @@ +# MultiChannelMessageChannelEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelMessageContent.md b/docs/Model/MultiChannelMessageContent.md new file mode 100644 index 0000000..9e95b70 --- /dev/null +++ b/docs/Model/MultiChannelMessageContent.md @@ -0,0 +1,10 @@ +# MultiChannelMessageContent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**text** | **string** | | [optional] +**media** | [**\Bandwidth\Model\RbmMessageContentFile**](RbmMessageContentFile.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelMessageRequest.md b/docs/Model/MultiChannelMessageRequest.md new file mode 100644 index 0000000..0a61eaa --- /dev/null +++ b/docs/Model/MultiChannelMessageRequest.md @@ -0,0 +1,13 @@ +# MultiChannelMessageRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**to** | **string** | The phone number the message should be sent to in E164 format. | +**channel_list** | [**\Bandwidth\Model\MultiChannelChannelListRequestObject[]**](MultiChannelChannelListRequestObject.md) | A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored. | +**tag** | **string** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] +**priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional] +**expiration** | **\DateTime** | 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. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MultiChannelMessageResponseData.md b/docs/Model/MultiChannelMessageResponseData.md new file mode 100644 index 0000000..c120148 --- /dev/null +++ b/docs/Model/MultiChannelMessageResponseData.md @@ -0,0 +1,16 @@ +# MultiChannelMessageResponseData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ID of the message. | +**time** | **\DateTime** | The time the message was received by the Bandwidth API. | +**direction** | [**\Bandwidth\Model\MessageDirectionEnum**](MessageDirectionEnum.md) | | +**to** | **string[]** | The destination phone number(s) of the message, in E164 format. | +**channel_list** | [**\Bandwidth\Model\MultiChannelChannelListResponseObject[]**](MultiChannelChannelListResponseObject.md) | A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored. | +**tag** | **string** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] +**priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional] +**expiration** | **\DateTime** | 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. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OptInWorkflow.md b/docs/Model/OptInWorkflow.md new file mode 100644 index 0000000..c9857d3 --- /dev/null +++ b/docs/Model/OptInWorkflow.md @@ -0,0 +1,11 @@ +# OptInWorkflow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **string** | | +**image_urls** | **string[]** | | +**confirmation_response** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Page.md b/docs/Model/Page.md new file mode 100644 index 0000000..7f9263e --- /dev/null +++ b/docs/Model/Page.md @@ -0,0 +1,12 @@ +# Page + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**page_size** | **int** | The number of items per page. | +**total_elements** | **int** | The total number of items. | [optional] +**total_pages** | **int** | The total number of pages. | [optional] +**page_number** | **int** | The current page number. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PageInfo.md b/docs/Model/PageInfo.md new file mode 100644 index 0000000..ed31308 --- /dev/null +++ b/docs/Model/PageInfo.md @@ -0,0 +1,12 @@ +# PageInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**prev_page** | **string** | The link to the previous page for pagination. | [optional] +**next_page** | **string** | The link to the next page for pagination. | [optional] +**prev_page_token** | **string** | The isolated pagination token for the previous page. | [optional] +**next_page_token** | **string** | The isolated pagination token for the next page. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/PriorityEnum.md b/docs/Model/PriorityEnum.md new file mode 100644 index 0000000..c1fe165 --- /dev/null +++ b/docs/Model/PriorityEnum.md @@ -0,0 +1,8 @@ +# PriorityEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ProductTypeEnum.md b/docs/Model/ProductTypeEnum.md new file mode 100644 index 0000000..f02ecf1 --- /dev/null +++ b/docs/Model/ProductTypeEnum.md @@ -0,0 +1,8 @@ +# ProductTypeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmActionBase.md b/docs/Model/RbmActionBase.md new file mode 100644 index 0000000..9e641fe --- /dev/null +++ b/docs/Model/RbmActionBase.md @@ -0,0 +1,11 @@ +# RbmActionBase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**\Bandwidth\Model\RbmActionTypeEnum**](RbmActionTypeEnum.md) | | +**text** | **string** | Displayed text for user to click | +**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmActionDial.md b/docs/Model/RbmActionDial.md new file mode 100644 index 0000000..0744ebd --- /dev/null +++ b/docs/Model/RbmActionDial.md @@ -0,0 +1,12 @@ +# RbmActionDial + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**\Bandwidth\Model\RbmActionTypeEnum**](RbmActionTypeEnum.md) | | +**text** | **string** | Displayed text for user to click | +**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | +**phone_number** | **string** | The phone number to dial. Must be E164 format. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmActionOpenUrl.md b/docs/Model/RbmActionOpenUrl.md new file mode 100644 index 0000000..e3c1631 --- /dev/null +++ b/docs/Model/RbmActionOpenUrl.md @@ -0,0 +1,14 @@ +# RbmActionOpenUrl + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**\Bandwidth\Model\RbmActionTypeEnum**](RbmActionTypeEnum.md) | | +**text** | **string** | Displayed text for user to click | +**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | +**url** | **string** | The URL to open in browser. Must use http:// or https:// scheme. | +**application** | [**\Bandwidth\Model\RbmOpenUrlEnum**](RbmOpenUrlEnum.md) | | [optional] +**webview_view_mode** | [**\Bandwidth\Model\RbmWebViewEnum**](RbmWebViewEnum.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmActionTypeEnum.md b/docs/Model/RbmActionTypeEnum.md new file mode 100644 index 0000000..57bb63e --- /dev/null +++ b/docs/Model/RbmActionTypeEnum.md @@ -0,0 +1,8 @@ +# RbmActionTypeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmActionViewLocation.md b/docs/Model/RbmActionViewLocation.md new file mode 100644 index 0000000..2fb12d5 --- /dev/null +++ b/docs/Model/RbmActionViewLocation.md @@ -0,0 +1,14 @@ +# RbmActionViewLocation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**\Bandwidth\Model\RbmActionTypeEnum**](RbmActionTypeEnum.md) | | +**text** | **string** | Displayed text for user to click | +**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | +**latitude** | **float** | The latitude of the location. Must be in range [-90.000000, 90.000000]. | +**longitude** | **float** | The longitude of the location. Must be in range [-180.000000, 180.000000]. | +**label** | **string** | The label of the location. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmCardContent.md b/docs/Model/RbmCardContent.md new file mode 100644 index 0000000..8405875 --- /dev/null +++ b/docs/Model/RbmCardContent.md @@ -0,0 +1,12 @@ +# RbmCardContent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the card. Must be 200 characters or less. | [optional] +**description** | **string** | The description of the card. Must be 2000 characters or less. | [optional] +**media** | [**\Bandwidth\Model\RbmCardContentMedia**](RbmCardContentMedia.md) | | [optional] +**suggestions** | [**\Bandwidth\Model\MultiChannelAction[]**](MultiChannelAction.md) | An array of suggested actions for the recipient that will be displayed on the rich card. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmCardContentMedia.md b/docs/Model/RbmCardContentMedia.md new file mode 100644 index 0000000..c861823 --- /dev/null +++ b/docs/Model/RbmCardContentMedia.md @@ -0,0 +1,11 @@ +# RbmCardContentMedia + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file_url** | **string** | The URL of the media file. 100MB is the maximum file size. | +**thumbnail_url** | **string** | The URL of the thumbnail image. Applies only to video file media. | [optional] +**height** | [**\Bandwidth\Model\RbmMediaHeightEnum**](RbmMediaHeightEnum.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmLocationResponse.md b/docs/Model/RbmLocationResponse.md new file mode 100644 index 0000000..2538c92 --- /dev/null +++ b/docs/Model/RbmLocationResponse.md @@ -0,0 +1,10 @@ +# RbmLocationResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**latitude** | **float** | The latitude of the client's location. | [optional] +**longitude** | **float** | The longitude of the client's location. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmMediaHeightEnum.md b/docs/Model/RbmMediaHeightEnum.md new file mode 100644 index 0000000..d3634cf --- /dev/null +++ b/docs/Model/RbmMediaHeightEnum.md @@ -0,0 +1,8 @@ +# RbmMediaHeightEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmMessageCarouselCard.md b/docs/Model/RbmMessageCarouselCard.md new file mode 100644 index 0000000..bb27bc3 --- /dev/null +++ b/docs/Model/RbmMessageCarouselCard.md @@ -0,0 +1,11 @@ +# RbmMessageCarouselCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**card_width** | [**\Bandwidth\Model\CardWidthEnum**](CardWidthEnum.md) | | +**card_contents** | [**\Bandwidth\Model\RbmCardContent[]**](RbmCardContent.md) | | +**suggestions** | [**\Bandwidth\Model\MultiChannelAction[]**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmMessageContentFile.md b/docs/Model/RbmMessageContentFile.md new file mode 100644 index 0000000..0c245d7 --- /dev/null +++ b/docs/Model/RbmMessageContentFile.md @@ -0,0 +1,10 @@ +# RbmMessageContentFile + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file_url** | **string** | The URL of the media file. 100MB is the maximum file size. | +**thumbnail_url** | **string** | The URL of the thumbnail image. Applies only to video file media. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmMessageContentRichCard.md b/docs/Model/RbmMessageContentRichCard.md new file mode 100644 index 0000000..56fb0d3 --- /dev/null +++ b/docs/Model/RbmMessageContentRichCard.md @@ -0,0 +1,11 @@ +# RbmMessageContentRichCard + +This model is a `oneOf` wrapper: a value is exactly one of the member types listed below. +It is never instantiated directly — use one of the concrete types. + +## oneOf + +- [**\Bandwidth\Model\RbmStandaloneCard**](RbmStandaloneCard.md) +- [**\Bandwidth\Model\RbmMessageCarouselCard**](RbmMessageCarouselCard.md) + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmMessageContentText.md b/docs/Model/RbmMessageContentText.md new file mode 100644 index 0000000..c0f3a40 --- /dev/null +++ b/docs/Model/RbmMessageContentText.md @@ -0,0 +1,10 @@ +# RbmMessageContentText + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**text** | **string** | The text associated with the message. Must be 3270 characters or less | +**suggestions** | [**\Bandwidth\Model\MultiChannelAction[]**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmMessageMedia.md b/docs/Model/RbmMessageMedia.md new file mode 100644 index 0000000..4d201b0 --- /dev/null +++ b/docs/Model/RbmMessageMedia.md @@ -0,0 +1,10 @@ +# RbmMessageMedia + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**media** | [**\Bandwidth\Model\RbmMessageContentFile[]**](RbmMessageContentFile.md) | | +**suggestions** | [**\Bandwidth\Model\MultiChannelAction[]**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmOpenUrlEnum.md b/docs/Model/RbmOpenUrlEnum.md new file mode 100644 index 0000000..ff4e99d --- /dev/null +++ b/docs/Model/RbmOpenUrlEnum.md @@ -0,0 +1,8 @@ +# RbmOpenUrlEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmStandaloneCard.md b/docs/Model/RbmStandaloneCard.md new file mode 100644 index 0000000..0060133 --- /dev/null +++ b/docs/Model/RbmStandaloneCard.md @@ -0,0 +1,12 @@ +# RbmStandaloneCard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**orientation** | [**\Bandwidth\Model\StandaloneCardOrientationEnum**](StandaloneCardOrientationEnum.md) | | +**thumbnail_image_alignment** | [**\Bandwidth\Model\ThumbnailAlignmentEnum**](ThumbnailAlignmentEnum.md) | | [optional] +**card_content** | [**\Bandwidth\Model\RbmCardContent**](RbmCardContent.md) | | +**suggestions** | [**\Bandwidth\Model\MultiChannelAction[]**](MultiChannelAction.md) | An array of suggested actions for the recipient. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmSuggestionResponse.md b/docs/Model/RbmSuggestionResponse.md new file mode 100644 index 0000000..f446379 --- /dev/null +++ b/docs/Model/RbmSuggestionResponse.md @@ -0,0 +1,11 @@ +# RbmSuggestionResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**text** | **string** | The text associated with the suggestion response. | [optional] +**postback_data** | **string** | Base64 payload the customer receives when the reply is clicked. | [optional] +**paired_message_id** | **string** | Corresponding parent message ID (MT). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RbmWebViewEnum.md b/docs/Model/RbmWebViewEnum.md new file mode 100644 index 0000000..72c6554 --- /dev/null +++ b/docs/Model/RbmWebViewEnum.md @@ -0,0 +1,8 @@ +# RbmWebViewEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RecordingAvailableCallback.md b/docs/Model/RecordingAvailableCallback.md new file mode 100644 index 0000000..cdf0c49 --- /dev/null +++ b/docs/Model/RecordingAvailableCallback.md @@ -0,0 +1,30 @@ +# RecordingAvailableCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**parent_call_id** | **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] +**recording_id** | **string** | The unique ID of this recording | [optional] +**media_url** | **string** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional] +**duration** | **string** | The duration of the recording in ISO-8601 format | [optional] +**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [optional] +**channels** | **int** | 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] +**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] +**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] +**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RecordingCompleteCallback.md b/docs/Model/RecordingCompleteCallback.md new file mode 100644 index 0000000..1d427fd --- /dev/null +++ b/docs/Model/RecordingCompleteCallback.md @@ -0,0 +1,30 @@ +# RecordingCompleteCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**parent_call_id** | **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] +**recording_id** | **string** | The unique ID of this recording | [optional] +**media_url** | **string** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional] +**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional] +**duration** | **string** | The duration of the recording in ISO-8601 format | [optional] +**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [optional] +**channels** | **int** | 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] +**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] +**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RecordingStateEnum.md b/docs/Model/RecordingStateEnum.md new file mode 100644 index 0000000..38d6f5c --- /dev/null +++ b/docs/Model/RecordingStateEnum.md @@ -0,0 +1,8 @@ +# RecordingStateEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RecordingTranscriptionClip.md b/docs/Model/RecordingTranscriptionClip.md new file mode 100644 index 0000000..98cba8e --- /dev/null +++ b/docs/Model/RecordingTranscriptionClip.md @@ -0,0 +1,13 @@ +# RecordingTranscriptionClip + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**speaker** | **int** | Zero-based index identifying the speaker. | [optional] +**text** | **string** | The transcribed text of this clip. | [optional] +**confidence** | **float** | How confident the transcription engine was in transcribing this clip (from `0.0` to `1.0`). | [optional] +**start_time_seconds** | **float** | The start time of this clip within the recording, in seconds. | [optional] +**end_time_seconds** | **float** | The end time of this clip within the recording, in seconds. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RecordingTranscriptionMetadata.md b/docs/Model/RecordingTranscriptionMetadata.md new file mode 100644 index 0000000..aa9a956 --- /dev/null +++ b/docs/Model/RecordingTranscriptionMetadata.md @@ -0,0 +1,12 @@ +# RecordingTranscriptionMetadata + +## 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] +**completed_time** | **\DateTime** | The time that the transcription was completed | [optional] +**url** | **string** | The URL of the [transcription](#operation/getCallTranscription) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RecordingTranscriptions.md b/docs/Model/RecordingTranscriptions.md new file mode 100644 index 0000000..f0bb6cb --- /dev/null +++ b/docs/Model/RecordingTranscriptions.md @@ -0,0 +1,10 @@ +# RecordingTranscriptions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**transcripts** | [**\Bandwidth\Model\Transcription[]**](Transcription.md) | | [optional] +**clips** | [**\Bandwidth\Model\RecordingTranscriptionClip[]**](RecordingTranscriptionClip.md) | A list of individual speech clips with speaker, timing, and confidence information. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedirectCallback.md b/docs/Model/RedirectCallback.md new file mode 100644 index 0000000..e332593 --- /dev/null +++ b/docs/Model/RedirectCallback.md @@ -0,0 +1,24 @@ +# RedirectCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**parent_call_id** | **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] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | 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] +**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] +**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/RedirectMethodEnum.md b/docs/Model/RedirectMethodEnum.md new file mode 100644 index 0000000..bab5206 --- /dev/null +++ b/docs/Model/RedirectMethodEnum.md @@ -0,0 +1,8 @@ +# RedirectMethodEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SipConnectionMetadata.md b/docs/Model/SipConnectionMetadata.md new file mode 100644 index 0000000..4b62196 --- /dev/null +++ b/docs/Model/SipConnectionMetadata.md @@ -0,0 +1,12 @@ +# SipConnectionMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ip_address** | **string** | The IP address of the SIP connection. | [optional] +**port** | **int** | The port of the SIP connection. | [optional] +**credentials** | [**\Bandwidth\Model\SipCredentials**](SipCredentials.md) | | [optional] +**uui_header** | **string** | The User-to-User Information header for the SIP connection. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SipCredentials.md b/docs/Model/SipCredentials.md new file mode 100644 index 0000000..2c1841f --- /dev/null +++ b/docs/Model/SipCredentials.md @@ -0,0 +1,10 @@ +# SipCredentials + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **string** | The username for the SIP connection. | [optional] +**password** | **string** | The password for the SIP connection. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SmsMessageContent.md b/docs/Model/SmsMessageContent.md new file mode 100644 index 0000000..6982f08 --- /dev/null +++ b/docs/Model/SmsMessageContent.md @@ -0,0 +1,9 @@ +# SmsMessageContent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**text** | **string** | The contents of the text message. Must be 2048 characters or less. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StandaloneCardOrientationEnum.md b/docs/Model/StandaloneCardOrientationEnum.md new file mode 100644 index 0000000..965564f --- /dev/null +++ b/docs/Model/StandaloneCardOrientationEnum.md @@ -0,0 +1,8 @@ +# StandaloneCardOrientationEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StatusCallback.md b/docs/Model/StatusCallback.md new file mode 100644 index 0000000..19e6f3c --- /dev/null +++ b/docs/Model/StatusCallback.md @@ -0,0 +1,16 @@ +# StatusCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**time** | **\DateTime** | | +**event_time** | **\DateTime** | Represents the time at which the message was read, for `message-read` callbacks. | [optional] +**type** | [**\Bandwidth\Model\StatusCallbackTypeEnum**](StatusCallbackTypeEnum.md) | | +**to** | **string** | The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number. | +**description** | **string** | A detailed description of the event described by the callback. | +**message** | [**\Bandwidth\Model\StatusCallbackMessage**](StatusCallbackMessage.md) | | +**error_code** | **int** | Optional error code, applicable only when type is `message-failed`. | [optional] +**carrier_name** | **string** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StatusCallbackMessage.md b/docs/Model/StatusCallbackMessage.md new file mode 100644 index 0000000..286542f --- /dev/null +++ b/docs/Model/StatusCallbackMessage.md @@ -0,0 +1,21 @@ +# StatusCallbackMessage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | A unique identifier of the message. | +**owner** | **string** | The Bandwidth phone number or alphanumeric identifier associated with the message. | +**application_id** | **string** | The ID of the Application your from number or senderId is associated with in the Bandwidth App. | +**time** | **\DateTime** | | +**segment_count** | **int** | The number of segments the user's message is broken into before sending over carrier networks. | +**direction** | [**\Bandwidth\Model\MessageDirectionEnum**](MessageDirectionEnum.md) | | +**to** | **string[]** | The phone number recipients of the message. | +**from** | **string** | The Bandwidth phone number or alphanumeric identifier the message was sent from. | +**text** | **string** | | [optional] +**tag** | **string** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] +**media** | **string[]** | Optional media, not applicable for sms | [optional] +**priority** | [**\Bandwidth\Model\PriorityEnum**](PriorityEnum.md) | | [optional] +**channel** | [**\Bandwidth\Model\MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StatusCallbackTypeEnum.md b/docs/Model/StatusCallbackTypeEnum.md new file mode 100644 index 0000000..a16be06 --- /dev/null +++ b/docs/Model/StatusCallbackTypeEnum.md @@ -0,0 +1,8 @@ +# StatusCallbackTypeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StirShaken.md b/docs/Model/StirShaken.md new file mode 100644 index 0000000..1023b2a --- /dev/null +++ b/docs/Model/StirShaken.md @@ -0,0 +1,11 @@ +# StirShaken + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**verstat** | **string** | (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Validation-Passed and TN-Validation-Failed. | [optional] +**attestation_indicator** | **string** | (optional) The attestation level verified by Bandwidth. Possible values are A (full), B (partial) or C (gateway). | [optional] +**originating_id** | **string** | (optional) A unique origination identifier. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SyncLookupRequest.md b/docs/Model/SyncLookupRequest.md new file mode 100644 index 0000000..bb75e91 --- /dev/null +++ b/docs/Model/SyncLookupRequest.md @@ -0,0 +1,10 @@ +# SyncLookupRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phone_numbers** | **string[]** | Telephone numbers in E.164 format. | +**rcs_agent** | **string** | Override the default RCS sender/agent ID used when checking RCS capabilities. When provided, this value is used as the `sender` in the RCS capability-check request instead of the account default. Must be 1–40 characters and contain only letters, digits, underscores, or hyphens. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TelephoneNumber.md b/docs/Model/TelephoneNumber.md new file mode 100644 index 0000000..bb99ce0 --- /dev/null +++ b/docs/Model/TelephoneNumber.md @@ -0,0 +1,9 @@ +# TelephoneNumber + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**telephone_number** | **string** | Simple Telephone Number. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TfvBasicAuthentication.md b/docs/Model/TfvBasicAuthentication.md new file mode 100644 index 0000000..67a462e --- /dev/null +++ b/docs/Model/TfvBasicAuthentication.md @@ -0,0 +1,10 @@ +# TfvBasicAuthentication + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **string** | | +**password** | **string** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TfvCallbackStatusEnum.md b/docs/Model/TfvCallbackStatusEnum.md new file mode 100644 index 0000000..7db3951 --- /dev/null +++ b/docs/Model/TfvCallbackStatusEnum.md @@ -0,0 +1,8 @@ +# TfvCallbackStatusEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TfvError.md b/docs/Model/TfvError.md new file mode 100644 index 0000000..c8b173d --- /dev/null +++ b/docs/Model/TfvError.md @@ -0,0 +1,11 @@ +# TfvError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**description** | **string** | | [optional] +**errors** | **object** | Each key of this errors object refers to a field of the submitted object (using dot notation for nested objects), with the field being a key to an array of one or more errors for that field. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TfvStatus.md b/docs/Model/TfvStatus.md new file mode 100644 index 0000000..1f1f9b6 --- /dev/null +++ b/docs/Model/TfvStatus.md @@ -0,0 +1,21 @@ +# TfvStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phone_number** | **string** | Toll-free telephone number in E.164 format. | [optional] +**status** | [**\Bandwidth\Model\TfvStatusEnum**](TfvStatusEnum.md) | | [optional] +**internal_ticket_number** | **string** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. | [optional] +**decline_reason_description** | **string** | Explanation for why a verification request was declined. | [optional] +**denial_status_code** | **int** | Reason code for denial. | [optional] +**additional_denial_reasons** | [**\Bandwidth\Model\AdditionalDenialReason[]**](AdditionalDenialReason.md) | An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. | [optional] +**resubmit_allowed** | **bool** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional] +**created_date_time** | **\DateTime** | Date and time the verification request was created. | [optional] +**modified_date_time** | **\DateTime** | Date and time the verification request was last modified. | [optional] +**submission** | [**\Bandwidth\Model\TfvSubmissionInfo**](TfvSubmissionInfo.md) | | [optional] +**blocked** | **bool** | Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional] +**blocked_reason** | **string** | The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional] +**cv_token** | **string** | The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TfvStatusEnum.md b/docs/Model/TfvStatusEnum.md new file mode 100644 index 0000000..a7c720d --- /dev/null +++ b/docs/Model/TfvStatusEnum.md @@ -0,0 +1,8 @@ +# TfvStatusEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TfvSubmissionInfo.md b/docs/Model/TfvSubmissionInfo.md new file mode 100644 index 0000000..baa36f2 --- /dev/null +++ b/docs/Model/TfvSubmissionInfo.md @@ -0,0 +1,24 @@ +# TfvSubmissionInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**business_address** | [**\Bandwidth\Model\Address**](Address.md) | | [optional] +**business_contact** | [**\Bandwidth\Model\Contact**](Contact.md) | | [optional] +**message_volume** | **int** | Estimated monthly volume of messages from the toll-free number. | [optional] +**use_case** | **string** | The category of the use case. | [optional] +**use_case_summary** | **string** | A general idea of the use case and customer. | [optional] +**production_message_content** | **string** | Example of message content. | [optional] +**opt_in_workflow** | [**\Bandwidth\Model\OptInWorkflow**](OptInWorkflow.md) | | [optional] +**additional_information** | **string** | Any additional information. | [optional] +**isv_reseller** | **string** | ISV name. | [optional] +**privacy_policy_url** | **string** | The Toll-Free Verification request privacy policy URL. | [optional] +**terms_and_conditions_url** | **string** | The Toll-Free Verification request terms and conditions policy URL. | [optional] +**business_dba** | **string** | The company 'Doing Business As'. | [optional] +**business_registration_number** | **string** | Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.** | [optional] +**business_registration_type** | [**\Bandwidth\Model\BusinessRegistrationTypeEnum**](BusinessRegistrationTypeEnum.md) | | [optional] +**business_registration_issuing_country** | **string** | The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code | | [optional] +**business_entity_type** | [**\Bandwidth\Model\BusinessEntityTypeEnum**](BusinessEntityTypeEnum.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TfvSubmissionWrapper.md b/docs/Model/TfvSubmissionWrapper.md new file mode 100644 index 0000000..e295940 --- /dev/null +++ b/docs/Model/TfvSubmissionWrapper.md @@ -0,0 +1,9 @@ +# TfvSubmissionWrapper + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**submission** | [**\Bandwidth\Model\VerificationUpdateRequest**](VerificationUpdateRequest.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ThumbnailAlignmentEnum.md b/docs/Model/ThumbnailAlignmentEnum.md new file mode 100644 index 0000000..e56d820 --- /dev/null +++ b/docs/Model/ThumbnailAlignmentEnum.md @@ -0,0 +1,8 @@ +# ThumbnailAlignmentEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TranscribeRecording.md b/docs/Model/TranscribeRecording.md new file mode 100644 index 0000000..1018548 --- /dev/null +++ b/docs/Model/TranscribeRecording.md @@ -0,0 +1,15 @@ +# TranscribeRecording + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**callback_url** | **string** | 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] +**callback_method** | [**\Bandwidth\Model\CallbackMethodEnum**](CallbackMethodEnum.md) | | [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] +**callback_timeout** | **float** | 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] [default to 15] +**detect_language** | **bool** | 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] [default to false] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Transcription.md b/docs/Model/Transcription.md new file mode 100644 index 0000000..c341d5d --- /dev/null +++ b/docs/Model/Transcription.md @@ -0,0 +1,11 @@ +# Transcription + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**speaker** | **int** | Zero-based index identifying the speaker. | [optional] +**text** | **string** | The transcribed text | [optional] +**confidence** | **float** | The confidence on the recognized content, ranging from `0.0` to `1.0` with `1.0` being the highest confidence. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TranscriptionAvailableCallback.md b/docs/Model/TranscriptionAvailableCallback.md new file mode 100644 index 0000000..970b971 --- /dev/null +++ b/docs/Model/TranscriptionAvailableCallback.md @@ -0,0 +1,29 @@ +# TranscriptionAvailableCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**media_url** | **string** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] +**parent_call_id** | **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] +**recording_id** | **string** | The unique ID of this recording | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**end_time** | **\DateTime** | The time that the recording ended in ISO-8601 format | [optional] +**duration** | **string** | The duration of the recording in ISO-8601 format | [optional] +**file_format** | [**\Bandwidth\Model\FileFormatEnum**](FileFormatEnum.md) | | [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** | [**\Bandwidth\Model\Transcription**](Transcription.md) | | [optional] +**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] +**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TransferAnswerCallback.md b/docs/Model/TransferAnswerCallback.md new file mode 100644 index 0000000..c90ebdd --- /dev/null +++ b/docs/Model/TransferAnswerCallback.md @@ -0,0 +1,23 @@ +# TransferAnswerCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | 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] +**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] +**transfer_to** | **string** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TransferCompleteCallback.md b/docs/Model/TransferCompleteCallback.md new file mode 100644 index 0000000..826e130 --- /dev/null +++ b/docs/Model/TransferCompleteCallback.md @@ -0,0 +1,26 @@ +# TransferCompleteCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | 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] +**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] +**transfer_to** | **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] +**error_message** | **string** | Text explaining the reason that caused the call to fail in case of errors. | [optional] +**error_id** | **string** | Bandwidth's internal id that references the error event. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TransferDisconnectCallback.md b/docs/Model/TransferDisconnectCallback.md new file mode 100644 index 0000000..92067a2 --- /dev/null +++ b/docs/Model/TransferDisconnectCallback.md @@ -0,0 +1,28 @@ +# TransferDisconnectCallback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_type** | **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] +**event_time** | **\DateTime** | 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] +**account_id** | **string** | The user account associated with the call. | [optional] +**application_id** | **string** | The id of the application associated with the call. | [optional] +**from** | **string** | The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). | [optional] +**to** | **string** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] +**direction** | [**\Bandwidth\Model\CallDirectionEnum**](CallDirectionEnum.md) | | [optional] +**call_id** | **string** | The call id associated with the event. | [optional] +**call_url** | **string** | The URL of the call associated with the event. | [optional] +**parent_call_id** | **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] +**enqueued_time** | **\DateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] +**start_time** | **\DateTime** | Time the call was started, in ISO 8601 format. | [optional] +**answer_time** | **\DateTime** | Time the call was answered, in ISO 8601 format. | [optional] +**end_time** | **\DateTime** | 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] +**transfer_caller_id** | **string** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] +**transfer_to** | **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] +**error_message** | **string** | Text explaining the reason that caused the call to fail in case of errors. | [optional] +**error_id** | **string** | Bandwidth's internal id that references the error event. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateCall.md b/docs/Model/UpdateCall.md new file mode 100644 index 0000000..f3bdf8d --- /dev/null +++ b/docs/Model/UpdateCall.md @@ -0,0 +1,18 @@ +# UpdateCall + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**state** | [**\Bandwidth\Model\CallStateEnum**](CallStateEnum.md) | | [optional] +**redirect_url** | **string** | 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] +**redirect_method** | [**\Bandwidth\Model\RedirectMethodEnum**](RedirectMethodEnum.md) | | [optional] +**username** | **string** | Basic auth username. | [optional] +**password** | **string** | Basic auth password. | [optional] +**redirect_fallback_url** | **string** | A fallback url which, if provided, will be used to retry the redirect callback delivery in case `redirectUrl` fails to respond. | [optional] +**redirect_fallback_method** | [**\Bandwidth\Model\RedirectMethodEnum**](RedirectMethodEnum.md) | | [optional] +**fallback_username** | **string** | Basic auth username. | [optional] +**fallback_password** | **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 4096 characters. Not allowed if `state` is `completed`. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateCallRecording.md b/docs/Model/UpdateCallRecording.md new file mode 100644 index 0000000..e96fa5e --- /dev/null +++ b/docs/Model/UpdateCallRecording.md @@ -0,0 +1,9 @@ +# UpdateCallRecording + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**state** | [**\Bandwidth\Model\RecordingStateEnum**](RecordingStateEnum.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateConference.md b/docs/Model/UpdateConference.md new file mode 100644 index 0000000..3754850 --- /dev/null +++ b/docs/Model/UpdateConference.md @@ -0,0 +1,17 @@ +# UpdateConference + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | [**\Bandwidth\Model\ConferenceStateEnum**](ConferenceStateEnum.md) | | [optional] +**redirect_url** | **string** | 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] +**redirect_method** | [**\Bandwidth\Model\RedirectMethodEnum**](RedirectMethodEnum.md) | | [optional] +**username** | **string** | Basic auth username. | [optional] +**password** | **string** | Basic auth password. | [optional] +**redirect_fallback_url** | **string** | 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] +**redirect_fallback_method** | [**\Bandwidth\Model\RedirectMethodEnum**](RedirectMethodEnum.md) | | [optional] +**fallback_username** | **string** | Basic auth username. | [optional] +**fallback_password** | **string** | Basic auth password. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UpdateConferenceMember.md b/docs/Model/UpdateConferenceMember.md new file mode 100644 index 0000000..a21b003 --- /dev/null +++ b/docs/Model/UpdateConferenceMember.md @@ -0,0 +1,11 @@ +# UpdateConferenceMember + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mute** | **bool** | 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** | **bool** | 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] +**call_ids_to_coach** | **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] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VerificationDenialWebhook.md b/docs/Model/VerificationDenialWebhook.md new file mode 100644 index 0000000..a2dadad --- /dev/null +++ b/docs/Model/VerificationDenialWebhook.md @@ -0,0 +1,18 @@ +# VerificationDenialWebhook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **string** | User's account ID. | [optional] +**additional_denial_reasons** | [**\Bandwidth\Model\AdditionalDenialReason[]**](AdditionalDenialReason.md) | An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. | [optional] +**decline_reason_description** | **string** | Explanation for why a verification request was declined. | [optional] +**denial_status_code** | **int** | Reason code for denial. | [optional] +**internal_ticket_number** | **string** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] +**phone_number** | **string** | Toll-free telephone number in E.164 format. | [optional] +**resubmit_allowed** | **bool** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional] +**status** | **string** | | [optional] [default to 'UNVERIFIED'] +**blocked** | **bool** | Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional] +**blocked_reason** | **string** | The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VerificationRequest.md b/docs/Model/VerificationRequest.md new file mode 100644 index 0000000..cd5dcf6 --- /dev/null +++ b/docs/Model/VerificationRequest.md @@ -0,0 +1,28 @@ +# VerificationRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**business_address** | [**\Bandwidth\Model\Address**](Address.md) | | +**business_contact** | [**\Bandwidth\Model\Contact**](Contact.md) | | +**message_volume** | **int** | Estimated monthly volume of messages from the toll-free number. | +**phone_numbers** | **string[]** | | +**use_case** | **string** | The category of the use case. | +**use_case_summary** | **string** | A general idea of the use case and customer. | +**production_message_content** | **string** | Example of message content. | +**opt_in_workflow** | [**\Bandwidth\Model\OptInWorkflow**](OptInWorkflow.md) | | +**additional_information** | **string** | Any additional information. | [optional] +**isv_reseller** | **string** | ISV name. | [optional] +**privacy_policy_url** | **string** | The Toll-Free Verification request privacy policy URL. | [optional] +**terms_and_conditions_url** | **string** | The Toll-Free Verification request terms and conditions policy URL. | [optional] +**business_dba** | **string** | The company 'Doing Business As'. | [optional] +**business_registration_number** | **string** | Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.** | [optional] +**business_registration_type** | [**\Bandwidth\Model\BusinessRegistrationTypeEnum**](BusinessRegistrationTypeEnum.md) | | [optional] +**business_registration_issuing_country** | **string** | The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code | | [optional] +**business_entity_type** | [**\Bandwidth\Model\BusinessEntityTypeEnum**](BusinessEntityTypeEnum.md) | | +**help_message_response** | **string** | A message that gets sent to users requesting help. | [optional] +**age_gated_content** | **bool** | Indicates whether the content is age-gated. | [optional] +**cv_token** | **string** | The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VerificationUpdateRequest.md b/docs/Model/VerificationUpdateRequest.md new file mode 100644 index 0000000..1d891fc --- /dev/null +++ b/docs/Model/VerificationUpdateRequest.md @@ -0,0 +1,27 @@ +# VerificationUpdateRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**business_address** | [**\Bandwidth\Model\Address**](Address.md) | | +**business_contact** | [**\Bandwidth\Model\Contact**](Contact.md) | | +**message_volume** | **int** | Estimated monthly volume of messages from the toll-free number. | +**use_case** | **string** | The category of the use case. | +**use_case_summary** | **string** | A general idea of the use case and customer. | +**production_message_content** | **string** | Example of message content. | +**opt_in_workflow** | [**\Bandwidth\Model\OptInWorkflow**](OptInWorkflow.md) | | +**additional_information** | **string** | Any additional information. | [optional] +**isv_reseller** | **string** | ISV name. | [optional] +**privacy_policy_url** | **string** | The Toll-Free Verification request privacy policy URL. | [optional] +**terms_and_conditions_url** | **string** | The Toll-Free Verification request terms and conditions policy URL. | [optional] +**business_dba** | **string** | The company 'Doing Business As'. | [optional] +**business_registration_number** | **string** | Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.** | [optional] +**business_registration_type** | [**\Bandwidth\Model\BusinessRegistrationTypeEnum**](BusinessRegistrationTypeEnum.md) | | [optional] +**business_entity_type** | [**\Bandwidth\Model\BusinessEntityTypeEnum**](BusinessEntityTypeEnum.md) | | [optional] +**business_registration_issuing_country** | **string** | The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code | | [optional] +**help_message_response** | **string** | A message that gets sent to users requesting help. | [optional] +**age_gated_content** | **bool** | Indicates whether the content is age-gated. | [optional] +**cv_token** | **string** | The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VerificationWebhook.md b/docs/Model/VerificationWebhook.md new file mode 100644 index 0000000..1707174 --- /dev/null +++ b/docs/Model/VerificationWebhook.md @@ -0,0 +1,12 @@ +# VerificationWebhook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **string** | User's account ID. | [optional] +**phone_number** | **string** | Toll-free telephone number in E.164 format. | [optional] +**status** | [**\Bandwidth\Model\TfvCallbackStatusEnum**](TfvCallbackStatusEnum.md) | | [optional] +**internal_ticket_number** | **string** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VerifyCodeRequest.md b/docs/Model/VerifyCodeRequest.md new file mode 100644 index 0000000..5c70f91 --- /dev/null +++ b/docs/Model/VerifyCodeRequest.md @@ -0,0 +1,12 @@ +# 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] +**expiration_time_in_minutes** | **float** | 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. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VerifyCodeResponse.md b/docs/Model/VerifyCodeResponse.md new file mode 100644 index 0000000..9bd4f40 --- /dev/null +++ b/docs/Model/VerifyCodeResponse.md @@ -0,0 +1,9 @@ +# VerifyCodeResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**valid** | **bool** | Whether or not the supplied code is valid. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoiceApiError.md b/docs/Model/VoiceApiError.md new file mode 100644 index 0000000..68457be --- /dev/null +++ b/docs/Model/VoiceApiError.md @@ -0,0 +1,11 @@ +# VoiceApiError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | | [optional] +**description** | **string** | | [optional] +**id** | **string** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VoiceCodeResponse.md b/docs/Model/VoiceCodeResponse.md new file mode 100644 index 0000000..7810c41 --- /dev/null +++ b/docs/Model/VoiceCodeResponse.md @@ -0,0 +1,9 @@ +# VoiceCodeResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**call_id** | **string** | Programmable Voice API Call ID. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WebhookSubscription.md b/docs/Model/WebhookSubscription.md new file mode 100644 index 0000000..73d9a1f --- /dev/null +++ b/docs/Model/WebhookSubscription.md @@ -0,0 +1,15 @@ +# WebhookSubscription + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**account_id** | **string** | | [optional] +**callback_url** | **string** | Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. | +**type** | [**\Bandwidth\Model\WebhookSubscriptionTypeEnum**](WebhookSubscriptionTypeEnum.md) | | [optional] +**basic_authentication** | [**\Bandwidth\Model\WebhookSubscriptionBasicAuthentication**](WebhookSubscriptionBasicAuthentication.md) | | [optional] +**created_date** | **\DateTime** | | [optional] +**modified_date** | **\DateTime** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WebhookSubscriptionBasicAuthentication.md b/docs/Model/WebhookSubscriptionBasicAuthentication.md new file mode 100644 index 0000000..da07487 --- /dev/null +++ b/docs/Model/WebhookSubscriptionBasicAuthentication.md @@ -0,0 +1,10 @@ +# WebhookSubscriptionBasicAuthentication + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **string** | | +**password** | **string** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WebhookSubscriptionError.md b/docs/Model/WebhookSubscriptionError.md new file mode 100644 index 0000000..7879abc --- /dev/null +++ b/docs/Model/WebhookSubscriptionError.md @@ -0,0 +1,11 @@ +# WebhookSubscriptionError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**description** | **string** | | [optional] +**telephone_numbers** | [**\Bandwidth\Model\TelephoneNumber[]**](TelephoneNumber.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WebhookSubscriptionRequestSchema.md b/docs/Model/WebhookSubscriptionRequestSchema.md new file mode 100644 index 0000000..075d329 --- /dev/null +++ b/docs/Model/WebhookSubscriptionRequestSchema.md @@ -0,0 +1,11 @@ +# WebhookSubscriptionRequestSchema + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**basic_authentication** | [**\Bandwidth\Model\TfvBasicAuthentication**](TfvBasicAuthentication.md) | | [optional] +**callback_url** | **string** | Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. | +**shared_secret_key** | **string** | An ASCII string submitted by the user as a shared secret key for generating an HMAC header for callbacks. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WebhookSubscriptionTypeEnum.md b/docs/Model/WebhookSubscriptionTypeEnum.md new file mode 100644 index 0000000..5faaf40 --- /dev/null +++ b/docs/Model/WebhookSubscriptionTypeEnum.md @@ -0,0 +1,8 @@ +# WebhookSubscriptionTypeEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WebhookSubscriptionsListBody.md b/docs/Model/WebhookSubscriptionsListBody.md new file mode 100644 index 0000000..d7c4f52 --- /dev/null +++ b/docs/Model/WebhookSubscriptionsListBody.md @@ -0,0 +1,11 @@ +# WebhookSubscriptionsListBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**\Bandwidth\Model\LinksObject**](LinksObject.md) | | [optional] +**errors** | [**\Bandwidth\Model\WebhookSubscriptionError[]**](WebhookSubscriptionError.md) | | [optional] +**data** | [**\Bandwidth\Model\WebhookSubscription[]**](WebhookSubscription.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..b15db01 --- /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="bandwidth" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="php-sdk" + 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/openapi-config.yml b/openapi-config.yml new file mode 100644 index 0000000..b566853 --- /dev/null +++ b/openapi-config.yml @@ -0,0 +1,6 @@ +packageName: Bandwidth SDK +composerPackageName: bandwidth/sdk +invokerPackage: Bandwidth +gitUserId: bandwidth +gitRepoId: php-sdk +templateDir: custom_templates diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 0000000..f3237ad --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.23.0" + } +} diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 5bdcd15..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - ./tests - - - diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..1135449 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./src/Api + ./src/Model + + + + + ./tests/Api + ./tests/Model + + + + + + diff --git a/src/APIException.php b/src/APIException.php index 55ae203..9de7508 100644 --- a/src/APIException.php +++ b/src/APIException.php @@ -1,86 +1,119 @@ getResponse()->getStatusCode()); - $this->context = $context; - $this->errorMessage = $reason; - - if (static::class !== 'BandwidthLib\APIException') { - $this->unbox(); - } - - } + protected mixed $responseObject = null; /** - * Unbox response into this exception class + * Constructor + * + * @param string $message Error message + * @param int $code HTTP status code + * @param string[][]|null $responseHeaders HTTP response header + * @param stdClass|string|null $responseBody HTTP decoded body of the server response either as stdClass or string */ - public function unbox() + public function __construct(string $message = "", int $code = 0, ?array $responseHeaders = [], stdClass|string|null $responseBody = null) { + parent::__construct($message, $code); + $this->responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; } /** - * The HTTP context from the API request - * @return \BandwidthLib\Http\HttpContext + * Gets the HTTP response header + * + * @return string[][]|null HTTP response header */ - public function getContext() + public function getResponseHeaders(): ?array { - return $this->context; + return $this->responseHeaders; } /** - * The HTTP response code from the API request - * @return int + * Gets the HTTP body of the server response either as Json or string + * + * @return stdClass|string|null HTTP body of the server response either as \stdClass or string */ - public function getResponseCode() + public function getResponseBody(): stdClass|string|null { - return $this->context->getResponse()->getStatusCode(); + return $this->responseBody; } /** - * The HTTP response body from the API request - * @return mixed + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void */ - public function getResponseBody() + public function setResponseObject(mixed $obj): void { - return $this->context->getResponse()->getRawBody(); + $this->responseObject = $obj; } /** - * The reason for raising an exception - * @return string + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object */ - public function getReason() + public function getResponseObject(): mixed { - return $this->message; + return $this->responseObject; } } diff --git a/src/APIHelper.php b/src/APIHelper.php deleted file mode 100644 index debe766..0000000 --- a/src/APIHelper.php +++ /dev/null @@ -1,172 +0,0 @@ - $value) { - $replaceValue = ''; - - //load parameter value - if (is_null($value)) { - $replaceValue = ''; - } elseif (is_array($value)) { - $replaceValue = implode("/", array_map("urlencode", $value)); - } else { - $val = strval($value); - $replaceValue = $encode ? urlencode($val) : $val; - } - - //find the template parameter and replace it with its value - $url = str_replace('{' . strval($key) . '}', $replaceValue, $url); - } - - return $url; - } - - /** - * Appends the given set of parameters to the given query string - * @param string $queryBuilder The query url string to append the parameters - * @param array $parameters The parameters to append - * @return void - */ - public static function appendUrlWithQueryParameters(string &$queryBuilder, array $parameters) - { - //perform parameter validation - if (is_null($queryBuilder) || !is_string($queryBuilder)) { - throw new InvalidArgumentException('Given value for parameter "queryBuilder" is invalid.'); - } - if (is_null($parameters)) { - return; - } - //does the query string already has parameters - $hasParams = (strrpos($queryBuilder, '?') > 0); - - //if already has parameters, use the & to append new parameters - $queryBuilder = $queryBuilder . (($hasParams) ? '&' : '?'); - - //append parameters - $queryBuilder = $queryBuilder . http_build_query($parameters); - } - - /** - * Validates and processes the given Url - * @param string $url The given Url to process - * @return string Pre-processed Url as string */ - public static function cleanUrl(string $url): string - { - //perform parameter validation - if (is_null($url) || !is_string($url)) { - throw new InvalidArgumentException('Invalid Url.'); - } - //ensure that the urls are absolute - $matchCount = preg_match("#^(https?://[^/]+)#", $url, $matches); - if ($matchCount == 0) { - throw new InvalidArgumentException('Invalid Url format.'); - } - //get the http protocol match - $protocol = $matches[1]; - - //remove redundant forward slashes - $query = substr($url, strlen($protocol)); - $query = preg_replace("#//+#", "/", $query); - - //return process url - return $protocol.$query; - } - - /** - * Deserialize a Json string - * @param string $json A valid Json string - * @param mixed $instance Instance of an object to map the json into - * @param boolean $isArray Is the Json an object array? - * @return mixed Decoded Json - */ - public static function deserialize(string $json, $instance = null, bool $isArray = false) - { - if ($instance == null) { - return json_decode($json, true); - } else { - $mapper = new \apimatic\jsonmapper\JsonMapper(); - if ($isArray) { - return $mapper->mapArray(json_decode($json), array(), $instance); - } else { - return $mapper->map(json_decode($json), $instance); - } - } - } - - /** - * Check if an array isAssociative (has string keys) - * @param array $arr A valid array - * @return boolean True if the array is Associative, false if it is Indexed - */ - private static function isAssociative(array $arr): bool - { - foreach ($arr as $key => $value) { - if (is_string($key)) { - return true; - } - } - - return false; - } - - /** - * Prepare a model for form encoding - * @param JsonSerializable $model A valid instance of JsonSerializable - * @return array The model as a map of key value pairs - */ - public static function prepareFormFields(JsonSerializable $model) - { - if (!$model instanceof JsonSerializable) { - return $model; - } - - $arr = $model->jsonSerialize(); - - foreach ($arr as $key => $value) { - if ($value instanceof JsonSerializable) { - $arr[$key] = static::prepareFormFields($value); - } elseif (is_array($value) && !empty($value) && !static::isAssociative($value) && - $value[0] instanceof JsonSerializable) { - $temp = array(); - foreach ($value as $k => $v) { - $temp[$k] = static::prepareFormFields($v); - } - $arr[$key] = $temp; - } - } - - return $arr; - } -} diff --git a/src/Api/CallsApi.php b/src/Api/CallsApi.php new file mode 100644 index 0000000..c1ffdfd --- /dev/null +++ b/src/Api/CallsApi.php @@ -0,0 +1,2593 @@ + $contentTypes **/ + public const contentTypes = [ + 'createCall' => [ + 'application/json', + ], + 'getCallState' => [ + 'application/json', + ], + 'listCalls' => [ + 'application/json', + ], + 'updateCall' => [ + 'application/json', + ], + 'updateCallBxml' => [ + 'application/xml', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation createCall + * + * Create Call + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CreateCall $create_call JSON object containing information to create an outbound call (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCall'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CreateCallResponse|\Bandwidth\Model\VoiceApiError + */ + public function createCall( + string $account_id, + \Bandwidth\Model\CreateCall $create_call, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createCall'][0] + ): \Bandwidth\Model\CreateCallResponse|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->createCallWithHttpInfo($account_id, $create_call, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation createCallWithHttpInfo + * + * Create Call + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CreateCall $create_call JSON object containing information to create an outbound call (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCall'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CreateCallResponse|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createCallWithHttpInfo( + string $account_id, + \Bandwidth\Model\CreateCall $create_call, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createCall'][0] + ): array + { + $request = $this->createCallRequest($account_id, $create_call, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CreateCallResponse', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CreateCallResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CreateCallResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createCallAsync + * + * Create Call + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CreateCall $create_call JSON object containing information to create an outbound call (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCall'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createCallAsync( + string $account_id, + \Bandwidth\Model\CreateCall $create_call, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createCall'][0] + ): PromiseInterface + { + return $this->createCallAsyncWithHttpInfo($account_id, $create_call, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createCallAsyncWithHttpInfo + * + * Create Call + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CreateCall $create_call JSON object containing information to create an outbound call (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCall'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createCallAsyncWithHttpInfo( + string $account_id, + \Bandwidth\Model\CreateCall $create_call, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createCall'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CreateCallResponse'; + $request = $this->createCallRequest($account_id, $create_call, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createCall' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CreateCall $create_call JSON object containing information to create an outbound call (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createCall'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createCallRequest( + string $account_id, + \Bandwidth\Model\CreateCall $create_call, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createCall'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling createCall' + ); + } + // verify the required parameter 'create_call' is set + if ($create_call === null || (is_array($create_call) && count($create_call) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $create_call when calling createCall' + ); + } + + $resourcePath = '/accounts/{accountId}/calls'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($create_call)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($create_call)); + } else { + $httpBody = $create_call; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForcreateCall(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation createCall + * + * @return array an array of host settings + */ + protected function getHostSettingsForcreateCall(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation getCallState + * + * Get Call State Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallState'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CallState|\Bandwidth\Model\VoiceApiError + */ + public function getCallState( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getCallState'][0] + ): \Bandwidth\Model\CallState|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->getCallStateWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getCallStateWithHttpInfo + * + * Get Call State Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallState'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CallState|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getCallStateWithHttpInfo( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getCallState'][0] + ): array + { + $request = $this->getCallStateRequest($account_id, $call_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallState', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallState', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CallState', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getCallStateAsync + * + * Get Call State Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallState'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getCallStateAsync( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getCallState'][0] + ): PromiseInterface + { + return $this->getCallStateAsyncWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getCallStateAsyncWithHttpInfo + * + * Get Call State Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallState'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getCallStateAsyncWithHttpInfo( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getCallState'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CallState'; + $request = $this->getCallStateRequest($account_id, $call_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getCallState' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallState'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getCallStateRequest( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getCallState'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getCallState' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling getCallState' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetCallState(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getCallState + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetCallState(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation listCalls + * + * Get Calls + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $to Filter results by the `to` field. (optional) + * @param string|null $from Filter results by the `from` field. (optional) + * @param string|null $min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param string|null $max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). (optional) + * @param string|null $disconnect_cause Filter results to calls with specified call Disconnect Cause. (optional) + * @param int|null $page_size Specifies the max number of calls that will be returned. (optional, default to 1000) + * @param string|null $page_token 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCalls'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CallState[]|\Bandwidth\Model\VoiceApiError + */ + public function listCalls( + string $account_id, + ?string $to = null, + ?string $from = null, + ?string $min_start_time = null, + ?string $max_start_time = null, + ?string $disconnect_cause = null, + ?int $page_size = 1000, + ?string $page_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listCalls'][0] + ): array|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->listCallsWithHttpInfo($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation listCallsWithHttpInfo + * + * Get Calls + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $to Filter results by the `to` field. (optional) + * @param string|null $from Filter results by the `from` field. (optional) + * @param string|null $min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param string|null $max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). (optional) + * @param string|null $disconnect_cause Filter results to calls with specified call Disconnect Cause. (optional) + * @param int|null $page_size Specifies the max number of calls that will be returned. (optional, default to 1000) + * @param string|null $page_token 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCalls'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CallState[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listCallsWithHttpInfo( + string $account_id, + ?string $to = null, + ?string $from = null, + ?string $min_start_time = null, + ?string $max_start_time = null, + ?string $disconnect_cause = null, + ?int $page_size = 1000, + ?string $page_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listCalls'][0] + ): array + { + $request = $this->listCallsRequest($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallState[]', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallState[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CallState[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listCallsAsync + * + * Get Calls + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $to Filter results by the `to` field. (optional) + * @param string|null $from Filter results by the `from` field. (optional) + * @param string|null $min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param string|null $max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). (optional) + * @param string|null $disconnect_cause Filter results to calls with specified call Disconnect Cause. (optional) + * @param int|null $page_size Specifies the max number of calls that will be returned. (optional, default to 1000) + * @param string|null $page_token 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCalls'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listCallsAsync( + string $account_id, + ?string $to = null, + ?string $from = null, + ?string $min_start_time = null, + ?string $max_start_time = null, + ?string $disconnect_cause = null, + ?int $page_size = 1000, + ?string $page_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listCalls'][0] + ): PromiseInterface + { + return $this->listCallsAsyncWithHttpInfo($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCallsAsyncWithHttpInfo + * + * Get Calls + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $to Filter results by the `to` field. (optional) + * @param string|null $from Filter results by the `from` field. (optional) + * @param string|null $min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param string|null $max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). (optional) + * @param string|null $disconnect_cause Filter results to calls with specified call Disconnect Cause. (optional) + * @param int|null $page_size Specifies the max number of calls that will be returned. (optional, default to 1000) + * @param string|null $page_token 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCalls'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listCallsAsyncWithHttpInfo( + string $account_id, + ?string $to = null, + ?string $from = null, + ?string $min_start_time = null, + ?string $max_start_time = null, + ?string $disconnect_cause = null, + ?int $page_size = 1000, + ?string $page_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listCalls'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CallState[]'; + $request = $this->listCallsRequest($account_id, $to, $from, $min_start_time, $max_start_time, $disconnect_cause, $page_size, $page_token, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listCalls' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $to Filter results by the `to` field. (optional) + * @param string|null $from Filter results by the `from` field. (optional) + * @param string|null $min_start_time Filter results to calls which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param string|null $max_start_time Filter results to calls which have a `startTime` before or including `maxStartTime` (in ISO8601 format). (optional) + * @param string|null $disconnect_cause Filter results to calls with specified call Disconnect Cause. (optional) + * @param int|null $page_size Specifies the max number of calls that will be returned. (optional, default to 1000) + * @param string|null $page_token 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCalls'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listCallsRequest( + string $account_id, + ?string $to = null, + ?string $from = null, + ?string $min_start_time = null, + ?string $max_start_time = null, + ?string $disconnect_cause = null, + ?int $page_size = 1000, + ?string $page_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listCalls'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling listCalls' + ); + } + if ($page_size !== null && $page_size > 10000) { + throw new InvalidArgumentException('invalid value for "$page_size" when calling CallsApi.listCalls, must be smaller than or equal to 10000.'); + } + if ($page_size !== null && $page_size < 1) { + throw new InvalidArgumentException('invalid value for "$page_size" when calling CallsApi.listCalls, must be bigger than or equal to 1.'); + } + + $resourcePath = '/accounts/{accountId}/calls'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to, + 'to', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from, + 'from', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $min_start_time, + 'minStartTime', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $max_start_time, + 'maxStartTime', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $disconnect_cause, + 'disconnectCause', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'pageSize', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_token, + 'pageToken', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForlistCalls(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation listCalls + * + * @return array an array of host settings + */ + protected function getHostSettingsForlistCalls(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation updateCall + * + * Update Call + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param \Bandwidth\Model\UpdateCall $update_call JSON object containing information to redirect an existing call to a new BXML document (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCall'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceApiError|null + */ + public function updateCall( + string $account_id, + string $call_id, + \Bandwidth\Model\UpdateCall $update_call, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCall'][0] + ): ?\Bandwidth\Model\VoiceApiError + { + list($response) = $this->updateCallWithHttpInfo($account_id, $call_id, $update_call, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation updateCallWithHttpInfo + * + * Update Call + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param \Bandwidth\Model\UpdateCall $update_call JSON object containing information to redirect an existing call to a new BXML document (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCall'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateCallWithHttpInfo( + string $account_id, + string $call_id, + \Bandwidth\Model\UpdateCall $update_call, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCall'][0] + ): array + { + $request = $this->updateCallRequest($account_id, $call_id, $update_call, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateCallAsync + * + * Update Call + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param \Bandwidth\Model\UpdateCall $update_call JSON object containing information to redirect an existing call to a new BXML document (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCall'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateCallAsync( + string $account_id, + string $call_id, + \Bandwidth\Model\UpdateCall $update_call, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCall'][0] + ): PromiseInterface + { + return $this->updateCallAsyncWithHttpInfo($account_id, $call_id, $update_call, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateCallAsyncWithHttpInfo + * + * Update Call + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param \Bandwidth\Model\UpdateCall $update_call JSON object containing information to redirect an existing call to a new BXML document (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCall'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateCallAsyncWithHttpInfo( + string $account_id, + string $call_id, + \Bandwidth\Model\UpdateCall $update_call, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCall'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->updateCallRequest($account_id, $call_id, $update_call, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateCall' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param \Bandwidth\Model\UpdateCall $update_call JSON object containing information to redirect an existing call to a new BXML document (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCall'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateCallRequest( + string $account_id, + string $call_id, + \Bandwidth\Model\UpdateCall $update_call, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCall'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling updateCall' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling updateCall' + ); + } + // verify the required parameter 'update_call' is set + if ($update_call === null || (is_array($update_call) && count($update_call) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $update_call when calling updateCall' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($update_call)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_call)); + } else { + $httpBody = $update_call; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForupdateCall(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation updateCall + * + * @return array an array of host settings + */ + protected function getHostSettingsForupdateCall(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation updateCallBxml + * + * Update Call BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $body body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallBxml'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceApiError|null + */ + public function updateCallBxml( + string $account_id, + string $call_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCallBxml'][0] + ): ?\Bandwidth\Model\VoiceApiError + { + list($response) = $this->updateCallBxmlWithHttpInfo($account_id, $call_id, $body, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation updateCallBxmlWithHttpInfo + * + * Update Call BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallBxml'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateCallBxmlWithHttpInfo( + string $account_id, + string $call_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCallBxml'][0] + ): array + { + $request = $this->updateCallBxmlRequest($account_id, $call_id, $body, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateCallBxmlAsync + * + * Update Call BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallBxml'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateCallBxmlAsync( + string $account_id, + string $call_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCallBxml'][0] + ): PromiseInterface + { + return $this->updateCallBxmlAsyncWithHttpInfo($account_id, $call_id, $body, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateCallBxmlAsyncWithHttpInfo + * + * Update Call BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallBxml'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateCallBxmlAsyncWithHttpInfo( + string $account_id, + string $call_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCallBxml'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->updateCallBxmlRequest($account_id, $call_id, $body, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateCallBxml' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallBxml'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateCallBxmlRequest( + string $account_id, + string $call_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCallBxml'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling updateCallBxml' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling updateCallBxml' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling updateCallBxml' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/bxml'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForupdateCallBxml(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation updateCallBxml + * + * @return array an array of host settings + */ + protected function getHostSettingsForupdateCallBxml(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/ConferencesApi.php b/src/Api/ConferencesApi.php new file mode 100644 index 0000000..b90c9fe --- /dev/null +++ b/src/Api/ConferencesApi.php @@ -0,0 +1,4441 @@ + $contentTypes **/ + public const contentTypes = [ + 'downloadConferenceRecording' => [ + 'application/json', + ], + 'getConference' => [ + 'application/json', + ], + 'getConferenceMember' => [ + 'application/json', + ], + 'getConferenceRecording' => [ + 'application/json', + ], + 'listConferenceRecordings' => [ + 'application/json', + ], + 'listConferences' => [ + 'application/json', + ], + 'updateConference' => [ + 'application/json', + ], + 'updateConferenceBxml' => [ + 'application/xml', + ], + 'updateConferenceMember' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation downloadConferenceRecording + * + * Download Conference Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadConferenceRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \SplFileObject|\Bandwidth\Model\VoiceApiError + */ + public function downloadConferenceRecording( + string $account_id, + string $conference_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['downloadConferenceRecording'][0] + ): \SplFileObject|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->downloadConferenceRecordingWithHttpInfo($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation downloadConferenceRecordingWithHttpInfo + * + * Download Conference Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadConferenceRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \SplFileObject|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function downloadConferenceRecordingWithHttpInfo( + string $account_id, + string $conference_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['downloadConferenceRecording'][0] + ): array + { + $request = $this->downloadConferenceRecordingRequest($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation downloadConferenceRecordingAsync + * + * Download Conference Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadConferenceRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function downloadConferenceRecordingAsync( + string $account_id, + string $conference_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['downloadConferenceRecording'][0] + ): PromiseInterface + { + return $this->downloadConferenceRecordingAsyncWithHttpInfo($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation downloadConferenceRecordingAsyncWithHttpInfo + * + * Download Conference Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadConferenceRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function downloadConferenceRecordingAsyncWithHttpInfo( + string $account_id, + string $conference_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['downloadConferenceRecording'][0] + ): PromiseInterface + { + $returnType = '\SplFileObject'; + $request = $this->downloadConferenceRecordingRequest($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'downloadConferenceRecording' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadConferenceRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function downloadConferenceRecordingRequest( + string $account_id, + string $conference_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['downloadConferenceRecording'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling downloadConferenceRecording' + ); + } + // verify the required parameter 'conference_id' is set + if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conference_id when calling downloadConferenceRecording' + ); + } + // verify the required parameter 'recording_id' is set + if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $recording_id when calling downloadConferenceRecording' + ); + } + + $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($conference_id !== null) { + $resourcePath = str_replace( + '{conferenceId}', + ObjectSerializer::toPathValue($conference_id), + $resourcePath + ); + } + // path params + if ($recording_id !== null) { + $resourcePath = str_replace( + '{recordingId}', + ObjectSerializer::toPathValue($recording_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['audio/vnd.wave', 'audio/mpeg', 'application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFordownloadConferenceRecording(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation downloadConferenceRecording + * + * @return array an array of host settings + */ + protected function getHostSettingsFordownloadConferenceRecording(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation getConference + * + * Get Conference Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConference'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\Conference|\Bandwidth\Model\VoiceApiError + */ + public function getConference( + string $account_id, + string $conference_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConference'][0] + ): \Bandwidth\Model\Conference|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->getConferenceWithHttpInfo($account_id, $conference_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getConferenceWithHttpInfo + * + * Get Conference Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConference'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\Conference|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getConferenceWithHttpInfo( + string $account_id, + string $conference_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConference'][0] + ): array + { + $request = $this->getConferenceRequest($account_id, $conference_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\Conference', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\Conference', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\Conference', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getConferenceAsync + * + * Get Conference Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConference'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getConferenceAsync( + string $account_id, + string $conference_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConference'][0] + ): PromiseInterface + { + return $this->getConferenceAsyncWithHttpInfo($account_id, $conference_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getConferenceAsyncWithHttpInfo + * + * Get Conference Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConference'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getConferenceAsyncWithHttpInfo( + string $account_id, + string $conference_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConference'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\Conference'; + $request = $this->getConferenceRequest($account_id, $conference_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getConference' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConference'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getConferenceRequest( + string $account_id, + string $conference_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConference'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getConference' + ); + } + // verify the required parameter 'conference_id' is set + if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conference_id when calling getConference' + ); + } + + $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($conference_id !== null) { + $resourcePath = str_replace( + '{conferenceId}', + ObjectSerializer::toPathValue($conference_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetConference(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getConference + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetConference(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation getConferenceMember + * + * Get Conference Member + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $member_id Programmable Voice API Conference Member ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceMember'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\ConferenceMember|\Bandwidth\Model\VoiceApiError + */ + public function getConferenceMember( + string $account_id, + string $conference_id, + string $member_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConferenceMember'][0] + ): \Bandwidth\Model\ConferenceMember|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->getConferenceMemberWithHttpInfo($account_id, $conference_id, $member_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getConferenceMemberWithHttpInfo + * + * Get Conference Member + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $member_id Programmable Voice API Conference Member ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceMember'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\ConferenceMember|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getConferenceMemberWithHttpInfo( + string $account_id, + string $conference_id, + string $member_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConferenceMember'][0] + ): array + { + $request = $this->getConferenceMemberRequest($account_id, $conference_id, $member_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\ConferenceMember', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\ConferenceMember', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\ConferenceMember', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getConferenceMemberAsync + * + * Get Conference Member + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $member_id Programmable Voice API Conference Member ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceMember'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getConferenceMemberAsync( + string $account_id, + string $conference_id, + string $member_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConferenceMember'][0] + ): PromiseInterface + { + return $this->getConferenceMemberAsyncWithHttpInfo($account_id, $conference_id, $member_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getConferenceMemberAsyncWithHttpInfo + * + * Get Conference Member + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $member_id Programmable Voice API Conference Member ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceMember'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getConferenceMemberAsyncWithHttpInfo( + string $account_id, + string $conference_id, + string $member_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConferenceMember'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\ConferenceMember'; + $request = $this->getConferenceMemberRequest($account_id, $conference_id, $member_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getConferenceMember' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $member_id Programmable Voice API Conference Member ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceMember'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getConferenceMemberRequest( + string $account_id, + string $conference_id, + string $member_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConferenceMember'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getConferenceMember' + ); + } + // verify the required parameter 'conference_id' is set + if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conference_id when calling getConferenceMember' + ); + } + // verify the required parameter 'member_id' is set + if ($member_id === null || (is_array($member_id) && count($member_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $member_id when calling getConferenceMember' + ); + } + + $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($conference_id !== null) { + $resourcePath = str_replace( + '{conferenceId}', + ObjectSerializer::toPathValue($conference_id), + $resourcePath + ); + } + // path params + if ($member_id !== null) { + $resourcePath = str_replace( + '{memberId}', + ObjectSerializer::toPathValue($member_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetConferenceMember(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getConferenceMember + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetConferenceMember(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation getConferenceRecording + * + * Get Conference Recording Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\ConferenceRecordingMetadata|\Bandwidth\Model\VoiceApiError + */ + public function getConferenceRecording( + string $account_id, + string $conference_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConferenceRecording'][0] + ): \Bandwidth\Model\ConferenceRecordingMetadata|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->getConferenceRecordingWithHttpInfo($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getConferenceRecordingWithHttpInfo + * + * Get Conference Recording Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\ConferenceRecordingMetadata|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getConferenceRecordingWithHttpInfo( + string $account_id, + string $conference_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConferenceRecording'][0] + ): array + { + $request = $this->getConferenceRecordingRequest($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\ConferenceRecordingMetadata', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\ConferenceRecordingMetadata', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\ConferenceRecordingMetadata', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getConferenceRecordingAsync + * + * Get Conference Recording Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getConferenceRecordingAsync( + string $account_id, + string $conference_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConferenceRecording'][0] + ): PromiseInterface + { + return $this->getConferenceRecordingAsyncWithHttpInfo($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getConferenceRecordingAsyncWithHttpInfo + * + * Get Conference Recording Information + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getConferenceRecordingAsyncWithHttpInfo( + string $account_id, + string $conference_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConferenceRecording'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\ConferenceRecordingMetadata'; + $request = $this->getConferenceRecordingRequest($account_id, $conference_id, $recording_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getConferenceRecording' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConferenceRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getConferenceRecordingRequest( + string $account_id, + string $conference_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getConferenceRecording'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getConferenceRecording' + ); + } + // verify the required parameter 'conference_id' is set + if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conference_id when calling getConferenceRecording' + ); + } + // verify the required parameter 'recording_id' is set + if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $recording_id when calling getConferenceRecording' + ); + } + + $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($conference_id !== null) { + $resourcePath = str_replace( + '{conferenceId}', + ObjectSerializer::toPathValue($conference_id), + $resourcePath + ); + } + // path params + if ($recording_id !== null) { + $resourcePath = str_replace( + '{recordingId}', + ObjectSerializer::toPathValue($recording_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetConferenceRecording(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getConferenceRecording + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetConferenceRecording(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation listConferenceRecordings + * + * Get Conference Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferenceRecordings'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\ConferenceRecordingMetadata[]|\Bandwidth\Model\VoiceApiError + */ + public function listConferenceRecordings( + string $account_id, + string $conference_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listConferenceRecordings'][0] + ): array|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->listConferenceRecordingsWithHttpInfo($account_id, $conference_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation listConferenceRecordingsWithHttpInfo + * + * Get Conference Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferenceRecordings'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\ConferenceRecordingMetadata[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listConferenceRecordingsWithHttpInfo( + string $account_id, + string $conference_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listConferenceRecordings'][0] + ): array + { + $request = $this->listConferenceRecordingsRequest($account_id, $conference_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\ConferenceRecordingMetadata[]', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\ConferenceRecordingMetadata[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\ConferenceRecordingMetadata[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listConferenceRecordingsAsync + * + * Get Conference Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferenceRecordings'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listConferenceRecordingsAsync( + string $account_id, + string $conference_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listConferenceRecordings'][0] + ): PromiseInterface + { + return $this->listConferenceRecordingsAsyncWithHttpInfo($account_id, $conference_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listConferenceRecordingsAsyncWithHttpInfo + * + * Get Conference Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferenceRecordings'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listConferenceRecordingsAsyncWithHttpInfo( + string $account_id, + string $conference_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listConferenceRecordings'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\ConferenceRecordingMetadata[]'; + $request = $this->listConferenceRecordingsRequest($account_id, $conference_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listConferenceRecordings' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferenceRecordings'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listConferenceRecordingsRequest( + string $account_id, + string $conference_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listConferenceRecordings'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling listConferenceRecordings' + ); + } + // verify the required parameter 'conference_id' is set + if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conference_id when calling listConferenceRecordings' + ); + } + + $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/recordings'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($conference_id !== null) { + $resourcePath = str_replace( + '{conferenceId}', + ObjectSerializer::toPathValue($conference_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForlistConferenceRecordings(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation listConferenceRecordings + * + * @return array an array of host settings + */ + protected function getHostSettingsForlistConferenceRecordings(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation listConferences + * + * Get Conferences + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $name Filter results by the `name` field. (optional) + * @param string|null $min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional) + * @param string|null $max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional) + * @param int|null $page_size Specifies the max number of conferences that will be returned. (optional, default to 1000) + * @param string|null $page_token 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferences'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\Conference[]|\Bandwidth\Model\VoiceApiError + */ + public function listConferences( + string $account_id, + ?string $name = null, + ?string $min_created_time = null, + ?string $max_created_time = null, + ?int $page_size = 1000, + ?string $page_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listConferences'][0] + ): array|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->listConferencesWithHttpInfo($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation listConferencesWithHttpInfo + * + * Get Conferences + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $name Filter results by the `name` field. (optional) + * @param string|null $min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional) + * @param string|null $max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional) + * @param int|null $page_size Specifies the max number of conferences that will be returned. (optional, default to 1000) + * @param string|null $page_token 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferences'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\Conference[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listConferencesWithHttpInfo( + string $account_id, + ?string $name = null, + ?string $min_created_time = null, + ?string $max_created_time = null, + ?int $page_size = 1000, + ?string $page_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listConferences'][0] + ): array + { + $request = $this->listConferencesRequest($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\Conference[]', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\Conference[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\Conference[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listConferencesAsync + * + * Get Conferences + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $name Filter results by the `name` field. (optional) + * @param string|null $min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional) + * @param string|null $max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional) + * @param int|null $page_size Specifies the max number of conferences that will be returned. (optional, default to 1000) + * @param string|null $page_token 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferences'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listConferencesAsync( + string $account_id, + ?string $name = null, + ?string $min_created_time = null, + ?string $max_created_time = null, + ?int $page_size = 1000, + ?string $page_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listConferences'][0] + ): PromiseInterface + { + return $this->listConferencesAsyncWithHttpInfo($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listConferencesAsyncWithHttpInfo + * + * Get Conferences + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $name Filter results by the `name` field. (optional) + * @param string|null $min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional) + * @param string|null $max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional) + * @param int|null $page_size Specifies the max number of conferences that will be returned. (optional, default to 1000) + * @param string|null $page_token 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferences'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listConferencesAsyncWithHttpInfo( + string $account_id, + ?string $name = null, + ?string $min_created_time = null, + ?string $max_created_time = null, + ?int $page_size = 1000, + ?string $page_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listConferences'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\Conference[]'; + $request = $this->listConferencesRequest($account_id, $name, $min_created_time, $max_created_time, $page_size, $page_token, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listConferences' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $name Filter results by the `name` field. (optional) + * @param string|null $min_created_time Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional) + * @param string|null $max_created_time Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional) + * @param int|null $page_size Specifies the max number of conferences that will be returned. (optional, default to 1000) + * @param string|null $page_token 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listConferences'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listConferencesRequest( + string $account_id, + ?string $name = null, + ?string $min_created_time = null, + ?string $max_created_time = null, + ?int $page_size = 1000, + ?string $page_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listConferences'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling listConferences' + ); + } + if ($page_size !== null && $page_size > 1000) { + throw new InvalidArgumentException('invalid value for "$page_size" when calling ConferencesApi.listConferences, must be smaller than or equal to 1000.'); + } + if ($page_size !== null && $page_size < 1) { + throw new InvalidArgumentException('invalid value for "$page_size" when calling ConferencesApi.listConferences, must be bigger than or equal to 1.'); + } + + $resourcePath = '/accounts/{accountId}/conferences'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $name, + 'name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $min_created_time, + 'minCreatedTime', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $max_created_time, + 'maxCreatedTime', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'pageSize', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_token, + 'pageToken', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForlistConferences(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation listConferences + * + * @return array an array of host settings + */ + protected function getHostSettingsForlistConferences(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation updateConference + * + * Update Conference + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param \Bandwidth\Model\UpdateConference $update_conference update_conference (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConference'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceApiError|null + */ + public function updateConference( + string $account_id, + string $conference_id, + \Bandwidth\Model\UpdateConference $update_conference, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConference'][0] + ): ?\Bandwidth\Model\VoiceApiError + { + list($response) = $this->updateConferenceWithHttpInfo($account_id, $conference_id, $update_conference, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation updateConferenceWithHttpInfo + * + * Update Conference + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param \Bandwidth\Model\UpdateConference $update_conference (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConference'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateConferenceWithHttpInfo( + string $account_id, + string $conference_id, + \Bandwidth\Model\UpdateConference $update_conference, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConference'][0] + ): array + { + $request = $this->updateConferenceRequest($account_id, $conference_id, $update_conference, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateConferenceAsync + * + * Update Conference + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param \Bandwidth\Model\UpdateConference $update_conference (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConference'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateConferenceAsync( + string $account_id, + string $conference_id, + \Bandwidth\Model\UpdateConference $update_conference, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConference'][0] + ): PromiseInterface + { + return $this->updateConferenceAsyncWithHttpInfo($account_id, $conference_id, $update_conference, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateConferenceAsyncWithHttpInfo + * + * Update Conference + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param \Bandwidth\Model\UpdateConference $update_conference (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConference'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateConferenceAsyncWithHttpInfo( + string $account_id, + string $conference_id, + \Bandwidth\Model\UpdateConference $update_conference, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConference'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->updateConferenceRequest($account_id, $conference_id, $update_conference, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateConference' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param \Bandwidth\Model\UpdateConference $update_conference (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConference'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateConferenceRequest( + string $account_id, + string $conference_id, + \Bandwidth\Model\UpdateConference $update_conference, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConference'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling updateConference' + ); + } + // verify the required parameter 'conference_id' is set + if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conference_id when calling updateConference' + ); + } + // verify the required parameter 'update_conference' is set + if ($update_conference === null || (is_array($update_conference) && count($update_conference) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $update_conference when calling updateConference' + ); + } + + $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($conference_id !== null) { + $resourcePath = str_replace( + '{conferenceId}', + ObjectSerializer::toPathValue($conference_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($update_conference)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_conference)); + } else { + $httpBody = $update_conference; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForupdateConference(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation updateConference + * + * @return array an array of host settings + */ + protected function getHostSettingsForupdateConference(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation updateConferenceBxml + * + * Update Conference BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $body body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceBxml'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceApiError|null + */ + public function updateConferenceBxml( + string $account_id, + string $conference_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConferenceBxml'][0] + ): ?\Bandwidth\Model\VoiceApiError + { + list($response) = $this->updateConferenceBxmlWithHttpInfo($account_id, $conference_id, $body, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation updateConferenceBxmlWithHttpInfo + * + * Update Conference BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceBxml'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateConferenceBxmlWithHttpInfo( + string $account_id, + string $conference_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConferenceBxml'][0] + ): array + { + $request = $this->updateConferenceBxmlRequest($account_id, $conference_id, $body, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateConferenceBxmlAsync + * + * Update Conference BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceBxml'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateConferenceBxmlAsync( + string $account_id, + string $conference_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConferenceBxml'][0] + ): PromiseInterface + { + return $this->updateConferenceBxmlAsyncWithHttpInfo($account_id, $conference_id, $body, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateConferenceBxmlAsyncWithHttpInfo + * + * Update Conference BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceBxml'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateConferenceBxmlAsyncWithHttpInfo( + string $account_id, + string $conference_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConferenceBxml'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->updateConferenceBxmlRequest($account_id, $conference_id, $body, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateConferenceBxml' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceBxml'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateConferenceBxmlRequest( + string $account_id, + string $conference_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConferenceBxml'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling updateConferenceBxml' + ); + } + // verify the required parameter 'conference_id' is set + if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conference_id when calling updateConferenceBxml' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling updateConferenceBxml' + ); + } + + $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/bxml'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($conference_id !== null) { + $resourcePath = str_replace( + '{conferenceId}', + ObjectSerializer::toPathValue($conference_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForupdateConferenceBxml(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation updateConferenceBxml + * + * @return array an array of host settings + */ + protected function getHostSettingsForupdateConferenceBxml(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation updateConferenceMember + * + * Update Conference Member + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $member_id Programmable Voice API Conference Member ID. (required) + * @param \Bandwidth\Model\UpdateConferenceMember $update_conference_member update_conference_member (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceMember'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceApiError|null + */ + public function updateConferenceMember( + string $account_id, + string $conference_id, + string $member_id, + \Bandwidth\Model\UpdateConferenceMember $update_conference_member, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConferenceMember'][0] + ): ?\Bandwidth\Model\VoiceApiError + { + list($response) = $this->updateConferenceMemberWithHttpInfo($account_id, $conference_id, $member_id, $update_conference_member, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation updateConferenceMemberWithHttpInfo + * + * Update Conference Member + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $member_id Programmable Voice API Conference Member ID. (required) + * @param \Bandwidth\Model\UpdateConferenceMember $update_conference_member (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceMember'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateConferenceMemberWithHttpInfo( + string $account_id, + string $conference_id, + string $member_id, + \Bandwidth\Model\UpdateConferenceMember $update_conference_member, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConferenceMember'][0] + ): array + { + $request = $this->updateConferenceMemberRequest($account_id, $conference_id, $member_id, $update_conference_member, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateConferenceMemberAsync + * + * Update Conference Member + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $member_id Programmable Voice API Conference Member ID. (required) + * @param \Bandwidth\Model\UpdateConferenceMember $update_conference_member (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceMember'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateConferenceMemberAsync( + string $account_id, + string $conference_id, + string $member_id, + \Bandwidth\Model\UpdateConferenceMember $update_conference_member, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConferenceMember'][0] + ): PromiseInterface + { + return $this->updateConferenceMemberAsyncWithHttpInfo($account_id, $conference_id, $member_id, $update_conference_member, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateConferenceMemberAsyncWithHttpInfo + * + * Update Conference Member + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $member_id Programmable Voice API Conference Member ID. (required) + * @param \Bandwidth\Model\UpdateConferenceMember $update_conference_member (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceMember'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateConferenceMemberAsyncWithHttpInfo( + string $account_id, + string $conference_id, + string $member_id, + \Bandwidth\Model\UpdateConferenceMember $update_conference_member, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConferenceMember'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->updateConferenceMemberRequest($account_id, $conference_id, $member_id, $update_conference_member, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateConferenceMember' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $conference_id Programmable Voice API Conference ID. (required) + * @param string $member_id Programmable Voice API Conference Member ID. (required) + * @param \Bandwidth\Model\UpdateConferenceMember $update_conference_member (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateConferenceMember'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateConferenceMemberRequest( + string $account_id, + string $conference_id, + string $member_id, + \Bandwidth\Model\UpdateConferenceMember $update_conference_member, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateConferenceMember'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling updateConferenceMember' + ); + } + // verify the required parameter 'conference_id' is set + if ($conference_id === null || (is_array($conference_id) && count($conference_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $conference_id when calling updateConferenceMember' + ); + } + // verify the required parameter 'member_id' is set + if ($member_id === null || (is_array($member_id) && count($member_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $member_id when calling updateConferenceMember' + ); + } + // verify the required parameter 'update_conference_member' is set + if ($update_conference_member === null || (is_array($update_conference_member) && count($update_conference_member) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $update_conference_member when calling updateConferenceMember' + ); + } + + $resourcePath = '/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($conference_id !== null) { + $resourcePath = str_replace( + '{conferenceId}', + ObjectSerializer::toPathValue($conference_id), + $resourcePath + ); + } + // path params + if ($member_id !== null) { + $resourcePath = str_replace( + '{memberId}', + ObjectSerializer::toPathValue($member_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($update_conference_member)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_conference_member)); + } else { + $httpBody = $update_conference_member; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForupdateConferenceMember(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation updateConferenceMember + * + * @return array an array of host settings + */ + protected function getHostSettingsForupdateConferenceMember(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/EndpointsApi.php b/src/Api/EndpointsApi.php new file mode 100644 index 0000000..30ee44c --- /dev/null +++ b/src/Api/EndpointsApi.php @@ -0,0 +1,2472 @@ + $contentTypes **/ + public const contentTypes = [ + 'createEndpoint' => [ + 'application/json', + ], + 'deleteEndpoint' => [ + 'application/json', + ], + 'getEndpoint' => [ + 'application/json', + ], + 'listEndpoints' => [ + 'application/json', + ], + 'updateEndpointBxml' => [ + 'application/xml', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation createEndpoint + * + * Create Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CreateWebRtcConnectionRequest $body body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CreateEndpointResponse|\Bandwidth\Model\BrtcErrorResponse + */ + public function createEndpoint( + string $account_id, + \Bandwidth\Model\CreateWebRtcConnectionRequest $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createEndpoint'][0] + ): \Bandwidth\Model\CreateEndpointResponse|\Bandwidth\Model\BrtcErrorResponse + { + list($response) = $this->createEndpointWithHttpInfo($account_id, $body, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation createEndpointWithHttpInfo + * + * Create Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CreateWebRtcConnectionRequest $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CreateEndpointResponse|\Bandwidth\Model\BrtcErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createEndpointWithHttpInfo( + string $account_id, + \Bandwidth\Model\CreateWebRtcConnectionRequest $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createEndpoint'][0] + ): array + { + $request = $this->createEndpointRequest($account_id, $body, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CreateEndpointResponse', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CreateEndpointResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CreateEndpointResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createEndpointAsync + * + * Create Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CreateWebRtcConnectionRequest $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createEndpointAsync( + string $account_id, + \Bandwidth\Model\CreateWebRtcConnectionRequest $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createEndpoint'][0] + ): PromiseInterface + { + return $this->createEndpointAsyncWithHttpInfo($account_id, $body, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createEndpointAsyncWithHttpInfo + * + * Create Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CreateWebRtcConnectionRequest $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createEndpointAsyncWithHttpInfo( + string $account_id, + \Bandwidth\Model\CreateWebRtcConnectionRequest $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createEndpoint'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CreateEndpointResponse'; + $request = $this->createEndpointRequest($account_id, $body, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createEndpoint' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CreateWebRtcConnectionRequest $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createEndpoint'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createEndpointRequest( + string $account_id, + \Bandwidth\Model\CreateWebRtcConnectionRequest $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createEndpoint'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling createEndpoint' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling createEndpoint' + ); + } + + $resourcePath = '/accounts/{accountId}/endpoints'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForcreateEndpoint(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation createEndpoint + * + * @return array an array of host settings + */ + protected function getHostSettingsForcreateEndpoint(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation deleteEndpoint + * + * Delete Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\BrtcErrorResponse|null + */ + public function deleteEndpoint( + string $account_id, + string $endpoint_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteEndpoint'][0] + ): ?\Bandwidth\Model\BrtcErrorResponse + { + list($response) = $this->deleteEndpointWithHttpInfo($account_id, $endpoint_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation deleteEndpointWithHttpInfo + * + * Delete Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteEndpointWithHttpInfo( + string $account_id, + string $endpoint_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteEndpoint'][0] + ): array + { + $request = $this->deleteEndpointRequest($account_id, $endpoint_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteEndpointAsync + * + * Delete Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteEndpointAsync( + string $account_id, + string $endpoint_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteEndpoint'][0] + ): PromiseInterface + { + return $this->deleteEndpointAsyncWithHttpInfo($account_id, $endpoint_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteEndpointAsyncWithHttpInfo + * + * Delete Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteEndpointAsyncWithHttpInfo( + string $account_id, + string $endpoint_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteEndpoint'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteEndpointRequest($account_id, $endpoint_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteEndpoint' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteEndpoint'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteEndpointRequest( + string $account_id, + string $endpoint_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteEndpoint'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling deleteEndpoint' + ); + } + // verify the required parameter 'endpoint_id' is set + if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $endpoint_id when calling deleteEndpoint' + ); + } + + $resourcePath = '/accounts/{accountId}/endpoints/{endpointId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($endpoint_id !== null) { + $resourcePath = str_replace( + '{endpointId}', + ObjectSerializer::toPathValue($endpoint_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFordeleteEndpoint(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation deleteEndpoint + * + * @return array an array of host settings + */ + protected function getHostSettingsFordeleteEndpoint(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation getEndpoint + * + * Get Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\EndpointResponse|\Bandwidth\Model\BrtcErrorResponse + */ + public function getEndpoint( + string $account_id, + string $endpoint_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getEndpoint'][0] + ): \Bandwidth\Model\EndpointResponse|\Bandwidth\Model\BrtcErrorResponse + { + list($response) = $this->getEndpointWithHttpInfo($account_id, $endpoint_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getEndpointWithHttpInfo + * + * Get Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\EndpointResponse|\Bandwidth\Model\BrtcErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getEndpointWithHttpInfo( + string $account_id, + string $endpoint_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getEndpoint'][0] + ): array + { + $request = $this->getEndpointRequest($account_id, $endpoint_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\EndpointResponse', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\EndpointResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\EndpointResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getEndpointAsync + * + * Get Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getEndpointAsync( + string $account_id, + string $endpoint_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getEndpoint'][0] + ): PromiseInterface + { + return $this->getEndpointAsyncWithHttpInfo($account_id, $endpoint_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getEndpointAsyncWithHttpInfo + * + * Get Endpoint + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getEndpointAsyncWithHttpInfo( + string $account_id, + string $endpoint_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getEndpoint'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\EndpointResponse'; + $request = $this->getEndpointRequest($account_id, $endpoint_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getEndpoint' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getEndpoint'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getEndpointRequest( + string $account_id, + string $endpoint_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getEndpoint'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getEndpoint' + ); + } + // verify the required parameter 'endpoint_id' is set + if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $endpoint_id when calling getEndpoint' + ); + } + + $resourcePath = '/accounts/{accountId}/endpoints/{endpointId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($endpoint_id !== null) { + $resourcePath = str_replace( + '{endpointId}', + ObjectSerializer::toPathValue($endpoint_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetEndpoint(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getEndpoint + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetEndpoint(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation listEndpoints + * + * List Endpoints + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\EndpointTypeEnum|null $type The type of endpoint. (optional) + * @param \Bandwidth\Model\EndpointStatusEnum|null $status The status of the endpoint. (optional) + * @param string|null $after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + * @param int|null $limit The maximum number of endpoints to return in the response. (optional, default to 100) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEndpoints'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\ListEndpointsResponse|\Bandwidth\Model\BrtcErrorResponse + */ + public function listEndpoints( + string $account_id, + ?\Bandwidth\Model\EndpointTypeEnum $type = null, + ?\Bandwidth\Model\EndpointStatusEnum $status = null, + ?string $after_cursor = null, + ?int $limit = 100, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listEndpoints'][0] + ): \Bandwidth\Model\ListEndpointsResponse|\Bandwidth\Model\BrtcErrorResponse + { + list($response) = $this->listEndpointsWithHttpInfo($account_id, $type, $status, $after_cursor, $limit, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation listEndpointsWithHttpInfo + * + * List Endpoints + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\EndpointTypeEnum|null $type The type of endpoint. (optional) + * @param \Bandwidth\Model\EndpointStatusEnum|null $status The status of the endpoint. (optional) + * @param string|null $after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + * @param int|null $limit The maximum number of endpoints to return in the response. (optional, default to 100) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEndpoints'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\ListEndpointsResponse|\Bandwidth\Model\BrtcErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listEndpointsWithHttpInfo( + string $account_id, + ?\Bandwidth\Model\EndpointTypeEnum $type = null, + ?\Bandwidth\Model\EndpointStatusEnum $status = null, + ?string $after_cursor = null, + ?int $limit = 100, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listEndpoints'][0] + ): array + { + $request = $this->listEndpointsRequest($account_id, $type, $status, $after_cursor, $limit, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\ListEndpointsResponse', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\BrtcErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\ListEndpointsResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\ListEndpointsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listEndpointsAsync + * + * List Endpoints + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\EndpointTypeEnum|null $type The type of endpoint. (optional) + * @param \Bandwidth\Model\EndpointStatusEnum|null $status The status of the endpoint. (optional) + * @param string|null $after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + * @param int|null $limit The maximum number of endpoints to return in the response. (optional, default to 100) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEndpoints'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listEndpointsAsync( + string $account_id, + ?\Bandwidth\Model\EndpointTypeEnum $type = null, + ?\Bandwidth\Model\EndpointStatusEnum $status = null, + ?string $after_cursor = null, + ?int $limit = 100, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listEndpoints'][0] + ): PromiseInterface + { + return $this->listEndpointsAsyncWithHttpInfo($account_id, $type, $status, $after_cursor, $limit, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listEndpointsAsyncWithHttpInfo + * + * List Endpoints + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\EndpointTypeEnum|null $type The type of endpoint. (optional) + * @param \Bandwidth\Model\EndpointStatusEnum|null $status The status of the endpoint. (optional) + * @param string|null $after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + * @param int|null $limit The maximum number of endpoints to return in the response. (optional, default to 100) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEndpoints'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listEndpointsAsyncWithHttpInfo( + string $account_id, + ?\Bandwidth\Model\EndpointTypeEnum $type = null, + ?\Bandwidth\Model\EndpointStatusEnum $status = null, + ?string $after_cursor = null, + ?int $limit = 100, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listEndpoints'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\ListEndpointsResponse'; + $request = $this->listEndpointsRequest($account_id, $type, $status, $after_cursor, $limit, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listEndpoints' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\EndpointTypeEnum|null $type The type of endpoint. (optional) + * @param \Bandwidth\Model\EndpointStatusEnum|null $status The status of the endpoint. (optional) + * @param string|null $after_cursor The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + * @param int|null $limit The maximum number of endpoints to return in the response. (optional, default to 100) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listEndpoints'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listEndpointsRequest( + string $account_id, + ?\Bandwidth\Model\EndpointTypeEnum $type = null, + ?\Bandwidth\Model\EndpointStatusEnum $status = null, + ?string $after_cursor = null, + ?int $limit = 100, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listEndpoints'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling listEndpoints' + ); + } + if ($limit !== null && $limit > 1000) { + throw new InvalidArgumentException('invalid value for "$limit" when calling EndpointsApi.listEndpoints, must be smaller than or equal to 1000.'); + } + if ($limit !== null && $limit < 1) { + throw new InvalidArgumentException('invalid value for "$limit" when calling EndpointsApi.listEndpoints, must be bigger than or equal to 1.'); + } + + $resourcePath = '/accounts/{accountId}/endpoints'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type?->value, + 'type', // param base name + 'EndpointTypeEnum', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $status?->value, + 'status', // param base name + 'EndpointStatusEnum', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $after_cursor, + 'afterCursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForlistEndpoints(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation listEndpoints + * + * @return array an array of host settings + */ + protected function getHostSettingsForlistEndpoints(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation updateEndpointBxml + * + * Update Endpoint BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param string $body body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpointBxml'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\BrtcErrorResponse|null + */ + public function updateEndpointBxml( + string $account_id, + string $endpoint_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateEndpointBxml'][0] + ): ?\Bandwidth\Model\BrtcErrorResponse + { + list($response) = $this->updateEndpointBxmlWithHttpInfo($account_id, $endpoint_id, $body, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation updateEndpointBxmlWithHttpInfo + * + * Update Endpoint BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpointBxml'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateEndpointBxmlWithHttpInfo( + string $account_id, + string $endpoint_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateEndpointBxml'][0] + ): array + { + $request = $this->updateEndpointBxmlRequest($account_id, $endpoint_id, $body, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\BrtcErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateEndpointBxmlAsync + * + * Update Endpoint BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpointBxml'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateEndpointBxmlAsync( + string $account_id, + string $endpoint_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateEndpointBxml'][0] + ): PromiseInterface + { + return $this->updateEndpointBxmlAsyncWithHttpInfo($account_id, $endpoint_id, $body, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateEndpointBxmlAsyncWithHttpInfo + * + * Update Endpoint BXML + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpointBxml'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateEndpointBxmlAsyncWithHttpInfo( + string $account_id, + string $endpoint_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateEndpointBxml'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->updateEndpointBxmlRequest($account_id, $endpoint_id, $body, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateEndpointBxml' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $endpoint_id BRTC Endpoint ID. (required) + * @param string $body (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateEndpointBxml'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateEndpointBxmlRequest( + string $account_id, + string $endpoint_id, + string $body, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateEndpointBxml'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling updateEndpointBxml' + ); + } + // verify the required parameter 'endpoint_id' is set + if ($endpoint_id === null || (is_array($endpoint_id) && count($endpoint_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $endpoint_id when calling updateEndpointBxml' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling updateEndpointBxml' + ); + } + + $resourcePath = '/accounts/{accountId}/endpoints/{endpointId}/bxml'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($endpoint_id !== null) { + $resourcePath = str_replace( + '{endpointId}', + ObjectSerializer::toPathValue($endpoint_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForupdateEndpointBxml(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation updateEndpointBxml + * + * @return array an array of host settings + */ + protected function getHostSettingsForupdateEndpointBxml(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/v2", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/MFAApi.php b/src/Api/MFAApi.php new file mode 100644 index 0000000..52947ec --- /dev/null +++ b/src/Api/MFAApi.php @@ -0,0 +1,1510 @@ + $contentTypes **/ + public const contentTypes = [ + 'generateMessagingCode' => [ + 'application/json', + ], + 'generateVoiceCode' => [ + 'application/json', + ], + 'verifyCode' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation generateMessagingCode + * + * Messaging Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMessagingCode'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\MessagingCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError + */ + public function generateMessagingCode( + string $account_id, + \Bandwidth\Model\CodeRequest $code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['generateMessagingCode'][0] + ): \Bandwidth\Model\MessagingCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError + { + list($response) = $this->generateMessagingCodeWithHttpInfo($account_id, $code_request, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation generateMessagingCodeWithHttpInfo + * + * Messaging Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMessagingCode'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\MessagingCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function generateMessagingCodeWithHttpInfo( + string $account_id, + \Bandwidth\Model\CodeRequest $code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['generateMessagingCode'][0] + ): array + { + $request = $this->generateMessagingCodeRequest($account_id, $code_request, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingCodeResponse', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaRequestError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaUnauthorizedRequestError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaForbiddenRequestError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaRequestError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingCodeResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingCodeResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaUnauthorizedRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaForbiddenRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation generateMessagingCodeAsync + * + * Messaging Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMessagingCode'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function generateMessagingCodeAsync( + string $account_id, + \Bandwidth\Model\CodeRequest $code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['generateMessagingCode'][0] + ): PromiseInterface + { + return $this->generateMessagingCodeAsyncWithHttpInfo($account_id, $code_request, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation generateMessagingCodeAsyncWithHttpInfo + * + * Messaging Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMessagingCode'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function generateMessagingCodeAsyncWithHttpInfo( + string $account_id, + \Bandwidth\Model\CodeRequest $code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['generateMessagingCode'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\MessagingCodeResponse'; + $request = $this->generateMessagingCodeRequest($account_id, $code_request, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'generateMessagingCode' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateMessagingCode'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function generateMessagingCodeRequest( + string $account_id, + \Bandwidth\Model\CodeRequest $code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['generateMessagingCode'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling generateMessagingCode' + ); + } + // verify the required parameter 'code_request' is set + if ($code_request === null || (is_array($code_request) && count($code_request) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $code_request when calling generateMessagingCode' + ); + } + + $resourcePath = '/accounts/{accountId}/code/messaging'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($code_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($code_request)); + } else { + $httpBody = $code_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgenerateMessagingCode(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation generateMessagingCode + * + * @return array an array of host settings + */ + protected function getHostSettingsForgenerateMessagingCode(): array + { + return [ + [ + "url" => "https://mfa.bandwidth.com/api/v1", + "description" => "Production", + ] + ]; + } + + /** + * Operation generateVoiceCode + * + * Voice Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateVoiceCode'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError + */ + public function generateVoiceCode( + string $account_id, + \Bandwidth\Model\CodeRequest $code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['generateVoiceCode'][0] + ): \Bandwidth\Model\VoiceCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError + { + list($response) = $this->generateVoiceCodeWithHttpInfo($account_id, $code_request, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation generateVoiceCodeWithHttpInfo + * + * Voice Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateVoiceCode'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\VoiceCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function generateVoiceCodeWithHttpInfo( + string $account_id, + \Bandwidth\Model\CodeRequest $code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['generateVoiceCode'][0] + ): array + { + $request = $this->generateVoiceCodeRequest($account_id, $code_request, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceCodeResponse', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaRequestError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaUnauthorizedRequestError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaForbiddenRequestError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaRequestError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceCodeResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceCodeResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaUnauthorizedRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaForbiddenRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation generateVoiceCodeAsync + * + * Voice Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateVoiceCode'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function generateVoiceCodeAsync( + string $account_id, + \Bandwidth\Model\CodeRequest $code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['generateVoiceCode'][0] + ): PromiseInterface + { + return $this->generateVoiceCodeAsyncWithHttpInfo($account_id, $code_request, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation generateVoiceCodeAsyncWithHttpInfo + * + * Voice Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateVoiceCode'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function generateVoiceCodeAsyncWithHttpInfo( + string $account_id, + \Bandwidth\Model\CodeRequest $code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['generateVoiceCode'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\VoiceCodeResponse'; + $request = $this->generateVoiceCodeRequest($account_id, $code_request, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'generateVoiceCode' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\CodeRequest $code_request MFA code request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['generateVoiceCode'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function generateVoiceCodeRequest( + string $account_id, + \Bandwidth\Model\CodeRequest $code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['generateVoiceCode'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling generateVoiceCode' + ); + } + // verify the required parameter 'code_request' is set + if ($code_request === null || (is_array($code_request) && count($code_request) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $code_request when calling generateVoiceCode' + ); + } + + $resourcePath = '/accounts/{accountId}/code/voice'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($code_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($code_request)); + } else { + $httpBody = $code_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgenerateVoiceCode(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation generateVoiceCode + * + * @return array an array of host settings + */ + protected function getHostSettingsForgenerateVoiceCode(): array + { + return [ + [ + "url" => "https://mfa.bandwidth.com/api/v1", + "description" => "Production", + ] + ]; + } + + /** + * Operation verifyCode + * + * Verify Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\VerifyCodeRequest $verify_code_request MFA code verify request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyCode'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VerifyCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError + */ + public function verifyCode( + string $account_id, + \Bandwidth\Model\VerifyCodeRequest $verify_code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['verifyCode'][0] + ): \Bandwidth\Model\VerifyCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError + { + list($response) = $this->verifyCodeWithHttpInfo($account_id, $verify_code_request, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation verifyCodeWithHttpInfo + * + * Verify Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\VerifyCodeRequest $verify_code_request MFA code verify request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyCode'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\VerifyCodeResponse|\Bandwidth\Model\MfaRequestError|\Bandwidth\Model\MfaUnauthorizedRequestError|\Bandwidth\Model\MfaForbiddenRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function verifyCodeWithHttpInfo( + string $account_id, + \Bandwidth\Model\VerifyCodeRequest $verify_code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['verifyCode'][0] + ): array + { + $request = $this->verifyCodeRequest($account_id, $verify_code_request, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VerifyCodeResponse', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaRequestError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaUnauthorizedRequestError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaForbiddenRequestError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaRequestError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MfaRequestError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VerifyCodeResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VerifyCodeResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaUnauthorizedRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaForbiddenRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MfaRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation verifyCodeAsync + * + * Verify Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\VerifyCodeRequest $verify_code_request MFA code verify request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyCode'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function verifyCodeAsync( + string $account_id, + \Bandwidth\Model\VerifyCodeRequest $verify_code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['verifyCode'][0] + ): PromiseInterface + { + return $this->verifyCodeAsyncWithHttpInfo($account_id, $verify_code_request, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation verifyCodeAsyncWithHttpInfo + * + * Verify Authentication Code + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\VerifyCodeRequest $verify_code_request MFA code verify request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyCode'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function verifyCodeAsyncWithHttpInfo( + string $account_id, + \Bandwidth\Model\VerifyCodeRequest $verify_code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['verifyCode'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\VerifyCodeResponse'; + $request = $this->verifyCodeRequest($account_id, $verify_code_request, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'verifyCode' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://mfa.bandwidth.com/api/v1 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\VerifyCodeRequest $verify_code_request MFA code verify request body. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['verifyCode'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function verifyCodeRequest( + string $account_id, + \Bandwidth\Model\VerifyCodeRequest $verify_code_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['verifyCode'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling verifyCode' + ); + } + // verify the required parameter 'verify_code_request' is set + if ($verify_code_request === null || (is_array($verify_code_request) && count($verify_code_request) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $verify_code_request when calling verifyCode' + ); + } + + $resourcePath = '/accounts/{accountId}/code/verify'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($verify_code_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($verify_code_request)); + } else { + $httpBody = $verify_code_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForverifyCode(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation verifyCode + * + * @return array an array of host settings + */ + protected function getHostSettingsForverifyCode(): array + { + return [ + [ + "url" => "https://mfa.bandwidth.com/api/v1", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/MediaApi.php b/src/Api/MediaApi.php new file mode 100644 index 0000000..2bfc4dd --- /dev/null +++ b/src/Api/MediaApi.php @@ -0,0 +1,1986 @@ + $contentTypes **/ + public const contentTypes = [ + 'deleteMedia' => [ + 'application/json', + ], + 'getMedia' => [ + 'application/json', + ], + 'listMedia' => [ + 'application/json', + ], + 'uploadMedia' => [ + '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/heic', + 'image/heif', + 'image/jpeg', + 'image/pjpeg', + 'image/png', + 'image/svg+xml', + 'image/tiff', + 'image/webp', + 'image/x-icon', + 'text/css', + 'text/csv', + 'text/calendar', + 'text/html', + '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', + 'video/x-flv', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation deleteMedia + * + * Delete Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMedia'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\MessagingRequestError|null + */ + public function deleteMedia( + string $account_id, + string $media_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteMedia'][0] + ): ?\Bandwidth\Model\MessagingRequestError + { + list($response) = $this->deleteMediaWithHttpInfo($account_id, $media_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation deleteMediaWithHttpInfo + * + * Delete Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMedia'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteMediaWithHttpInfo( + string $account_id, + string $media_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteMedia'][0] + ): array + { + $request = $this->deleteMediaRequest($account_id, $media_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 406: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteMediaAsync + * + * Delete Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteMediaAsync( + string $account_id, + string $media_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteMedia'][0] + ): PromiseInterface + { + return $this->deleteMediaAsyncWithHttpInfo($account_id, $media_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteMediaAsyncWithHttpInfo + * + * Delete Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteMediaAsyncWithHttpInfo( + string $account_id, + string $media_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteMedia'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteMediaRequest($account_id, $media_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteMedia' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteMediaRequest( + string $account_id, + string $media_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteMedia'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling deleteMedia' + ); + } + // verify the required parameter 'media_id' is set + if ($media_id === null || (is_array($media_id) && count($media_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $media_id when calling deleteMedia' + ); + } + + $resourcePath = '/users/{accountId}/media/{mediaId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($media_id !== null) { + $resourcePath = str_replace( + '{mediaId}', + ObjectSerializer::toPathValue($media_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFordeleteMedia(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation deleteMedia + * + * @return array an array of host settings + */ + protected function getHostSettingsFordeleteMedia(): array + { + return [ + [ + "url" => "https://messaging.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation getMedia + * + * Get Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMedia'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \SplFileObject|\Bandwidth\Model\MessagingRequestError + */ + public function getMedia( + string $account_id, + string $media_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getMedia'][0] + ): \SplFileObject|\Bandwidth\Model\MessagingRequestError + { + list($response) = $this->getMediaWithHttpInfo($account_id, $media_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getMediaWithHttpInfo + * + * Get Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMedia'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \SplFileObject|\Bandwidth\Model\MessagingRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getMediaWithHttpInfo( + string $account_id, + string $media_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getMedia'][0] + ): array + { + $request = $this->getMediaRequest($account_id, $media_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 406: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 406: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getMediaAsync + * + * Get Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getMediaAsync( + string $account_id, + string $media_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getMedia'][0] + ): PromiseInterface + { + return $this->getMediaAsyncWithHttpInfo($account_id, $media_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getMediaAsyncWithHttpInfo + * + * Get Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getMediaAsyncWithHttpInfo( + string $account_id, + string $media_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getMedia'][0] + ): PromiseInterface + { + $returnType = '\SplFileObject'; + $request = $this->getMediaRequest($account_id, $media_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getMedia' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getMediaRequest( + string $account_id, + string $media_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getMedia'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getMedia' + ); + } + // verify the required parameter 'media_id' is set + if ($media_id === null || (is_array($media_id) && count($media_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $media_id when calling getMedia' + ); + } + + $resourcePath = '/users/{accountId}/media/{mediaId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($media_id !== null) { + $resourcePath = str_replace( + '{mediaId}', + ObjectSerializer::toPathValue($media_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/octet-stream', 'application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetMedia(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getMedia + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetMedia(): array + { + return [ + [ + "url" => "https://messaging.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation listMedia + * + * List Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $continuation_token Continuation token used to retrieve subsequent media. (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMedia'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\Media[]|\Bandwidth\Model\MessagingRequestError + */ + public function listMedia( + string $account_id, + ?string $continuation_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listMedia'][0] + ): array|\Bandwidth\Model\MessagingRequestError + { + list($response) = $this->listMediaWithHttpInfo($account_id, $continuation_token, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation listMediaWithHttpInfo + * + * List Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $continuation_token Continuation token used to retrieve subsequent media. (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMedia'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\Media[]|\Bandwidth\Model\MessagingRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listMediaWithHttpInfo( + string $account_id, + ?string $continuation_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listMedia'][0] + ): array + { + $request = $this->listMediaRequest($account_id, $continuation_token, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\Media[]', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 406: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\Media[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\Media[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 406: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listMediaAsync + * + * List Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $continuation_token Continuation token used to retrieve subsequent media. (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listMediaAsync( + string $account_id, + ?string $continuation_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listMedia'][0] + ): PromiseInterface + { + return $this->listMediaAsyncWithHttpInfo($account_id, $continuation_token, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listMediaAsyncWithHttpInfo + * + * List Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $continuation_token Continuation token used to retrieve subsequent media. (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listMediaAsyncWithHttpInfo( + string $account_id, + ?string $continuation_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listMedia'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\Media[]'; + $request = $this->listMediaRequest($account_id, $continuation_token, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listMedia' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $continuation_token Continuation token used to retrieve subsequent media. (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listMediaRequest( + string $account_id, + ?string $continuation_token = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listMedia'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling listMedia' + ); + } + + $resourcePath = '/users/{accountId}/media'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($continuation_token !== null) { + $headerParams['Continuation-Token'] = ObjectSerializer::toHeaderValue($continuation_token); + } + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForlistMedia(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation listMedia + * + * @return array an array of host settings + */ + protected function getHostSettingsForlistMedia(): array + { + return [ + [ + "url" => "https://messaging.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation uploadMedia + * + * Upload Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param \SplFileObject $body body (required) + * @param string|null $content_type The media type of the entity-body. (optional) + * @param string|null $cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMedia'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\MessagingRequestError|null + */ + public function uploadMedia( + string $account_id, + string $media_id, + \SplFileObject $body, + ?string $content_type = null, + ?string $cache_control = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['uploadMedia'][0] + ): ?\Bandwidth\Model\MessagingRequestError + { + list($response) = $this->uploadMediaWithHttpInfo($account_id, $media_id, $body, $content_type, $cache_control, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation uploadMediaWithHttpInfo + * + * Upload Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param \SplFileObject $body (required) + * @param string|null $content_type The media type of the entity-body. (optional) + * @param string|null $cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMedia'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function uploadMediaWithHttpInfo( + string $account_id, + string $media_id, + \SplFileObject $body, + ?string $content_type = null, + ?string $cache_control = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['uploadMedia'][0] + ): array + { + $request = $this->uploadMediaRequest($account_id, $media_id, $body, $content_type, $cache_control, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 406: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation uploadMediaAsync + * + * Upload Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param \SplFileObject $body (required) + * @param string|null $content_type The media type of the entity-body. (optional) + * @param string|null $cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function uploadMediaAsync( + string $account_id, + string $media_id, + \SplFileObject $body, + ?string $content_type = null, + ?string $cache_control = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['uploadMedia'][0] + ): PromiseInterface + { + return $this->uploadMediaAsyncWithHttpInfo($account_id, $media_id, $body, $content_type, $cache_control, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation uploadMediaAsyncWithHttpInfo + * + * Upload Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param \SplFileObject $body (required) + * @param string|null $content_type The media type of the entity-body. (optional) + * @param string|null $cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function uploadMediaAsyncWithHttpInfo( + string $account_id, + string $media_id, + \SplFileObject $body, + ?string $content_type = null, + ?string $cache_control = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['uploadMedia'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->uploadMediaRequest($account_id, $media_id, $body, $content_type, $cache_control, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'uploadMedia' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $media_id Media ID to retrieve. (required) + * @param \SplFileObject $body (required) + * @param string|null $content_type The media type of the entity-body. (optional) + * @param string|null $cache_control General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['uploadMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function uploadMediaRequest( + string $account_id, + string $media_id, + \SplFileObject $body, + ?string $content_type = null, + ?string $cache_control = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['uploadMedia'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling uploadMedia' + ); + } + // verify the required parameter 'media_id' is set + if ($media_id === null || (is_array($media_id) && count($media_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $media_id when calling uploadMedia' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $body when calling uploadMedia' + ); + } + + $resourcePath = '/users/{accountId}/media/{mediaId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + // header params + if ($content_type !== null) { + $headerParams['Content-Type'] = ObjectSerializer::toHeaderValue($content_type); + } + // header params + if ($cache_control !== null) { + $headerParams['Cache-Control'] = ObjectSerializer::toHeaderValue($cache_control); + } + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($media_id !== null) { + $resourcePath = str_replace( + '{mediaId}', + ObjectSerializer::toPathValue($media_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); + } else { + $httpBody = $body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForuploadMedia(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation uploadMedia + * + * @return array an array of host settings + */ + protected function getHostSettingsForuploadMedia(): array + { + return [ + [ + "url" => "https://messaging.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/MessagesApi.php b/src/Api/MessagesApi.php new file mode 100644 index 0000000..bab49b3 --- /dev/null +++ b/src/Api/MessagesApi.php @@ -0,0 +1,1650 @@ + $contentTypes **/ + public const contentTypes = [ + 'createMessage' => [ + 'application/json', + ], + 'listMessages' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation createMessage + * + * Create Message + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\MessageRequest $message_request message_request (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMessage'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\Message|\Bandwidth\Model\CreateMessageRequestError|\Bandwidth\Model\MessagingRequestError + */ + public function createMessage( + string $account_id, + \Bandwidth\Model\MessageRequest $message_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createMessage'][0] + ): \Bandwidth\Model\Message|\Bandwidth\Model\CreateMessageRequestError|\Bandwidth\Model\MessagingRequestError + { + list($response) = $this->createMessageWithHttpInfo($account_id, $message_request, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation createMessageWithHttpInfo + * + * Create Message + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\MessageRequest $message_request (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMessage'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\Message|\Bandwidth\Model\CreateMessageRequestError|\Bandwidth\Model\MessagingRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createMessageWithHttpInfo( + string $account_id, + \Bandwidth\Model\MessageRequest $message_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createMessage'][0] + ): array + { + $request = $this->createMessageRequest($account_id, $message_request, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 202: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\Message', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CreateMessageRequestError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 406: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\Message', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\Message', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CreateMessageRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 406: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createMessageAsync + * + * Create Message + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\MessageRequest $message_request (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMessage'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createMessageAsync( + string $account_id, + \Bandwidth\Model\MessageRequest $message_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createMessage'][0] + ): PromiseInterface + { + return $this->createMessageAsyncWithHttpInfo($account_id, $message_request, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createMessageAsyncWithHttpInfo + * + * Create Message + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\MessageRequest $message_request (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMessage'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createMessageAsyncWithHttpInfo( + string $account_id, + \Bandwidth\Model\MessageRequest $message_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createMessage'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\Message'; + $request = $this->createMessageRequest($account_id, $message_request, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createMessage' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\MessageRequest $message_request (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMessage'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createMessageRequest( + string $account_id, + \Bandwidth\Model\MessageRequest $message_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createMessage'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling createMessage' + ); + } + // verify the required parameter 'message_request' is set + if ($message_request === null || (is_array($message_request) && count($message_request) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $message_request when calling createMessage' + ); + } + + $resourcePath = '/users/{accountId}/messages'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($message_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($message_request)); + } else { + $httpBody = $message_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForcreateMessage(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation createMessage + * + * @return array an array of host settings + */ + protected function getHostSettingsForcreateMessage(): array + { + return [ + [ + "url" => "https://messaging.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation listMessages + * + * List Messages + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $message_id 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 string|null $source_tn 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 string|null $destination_tn 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 \Bandwidth\Model\MessageStatusEnum|null $message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param \Bandwidth\Model\ListMessageDirectionEnum|null $message_direction The direction of the message. One of INBOUND OUTBOUND. (optional) + * @param string|null $carrier_name 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 \Bandwidth\Model\MessageTypeEnum|null $message_type The type of message. Either sms or mms. (optional) + * @param int|null $error_code The error code of the message. (optional) + * @param string|null $from_date_time 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 string|null $to_date_time 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 string|null $campaign_id The campaign ID of the message. (optional) + * @param int|null $from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param bool|null $bw_queued A boolean value indicating whether the message is queued in the Bandwidth network. (optional) + * @param \Bandwidth\Model\ProductTypeEnum|null $product Messaging product associated with the message. (optional) + * @param string|null $location Location Id associated with the message. (optional) + * @param bool|null $carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param int|null $from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param string|null $calling_number_country_a3 Calling number country in A3 format. (optional) + * @param string|null $called_number_country_a3 Called number country in A3 format. (optional) + * @param int|null $from_segment_count Segment count (start range). (optional) + * @param int|null $to_segment_count Segment count (end range). (optional) + * @param int|null $from_message_size Message size (start range). (optional) + * @param int|null $to_message_size Message size (end range). (optional) + * @param string|null $sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) + * @param string|null $page_token A base64 encoded value used for pagination of results. (optional) + * @param int|null $limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param bool|null $limit_total_count 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMessages'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\MessagesList|\Bandwidth\Model\MessagingRequestError + */ + public function listMessages( + string $account_id, + ?string $message_id = null, + ?string $source_tn = null, + ?string $destination_tn = null, + ?\Bandwidth\Model\MessageStatusEnum $message_status = null, + ?\Bandwidth\Model\ListMessageDirectionEnum $message_direction = null, + ?string $carrier_name = null, + ?\Bandwidth\Model\MessageTypeEnum $message_type = null, + ?int $error_code = null, + ?string $from_date_time = null, + ?string $to_date_time = null, + ?string $campaign_id = null, + ?int $from_bw_latency = null, + ?bool $bw_queued = null, + ?\Bandwidth\Model\ProductTypeEnum $product = null, + ?string $location = null, + ?bool $carrier_queued = null, + ?int $from_carrier_latency = null, + ?string $calling_number_country_a3 = null, + ?string $called_number_country_a3 = null, + ?int $from_segment_count = null, + ?int $to_segment_count = null, + ?int $from_message_size = null, + ?int $to_message_size = null, + ?string $sort = null, + ?string $page_token = null, + ?int $limit = null, + ?bool $limit_total_count = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listMessages'][0] + ): \Bandwidth\Model\MessagesList|\Bandwidth\Model\MessagingRequestError + { + list($response) = $this->listMessagesWithHttpInfo($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation listMessagesWithHttpInfo + * + * List Messages + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $message_id 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 string|null $source_tn 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 string|null $destination_tn 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 \Bandwidth\Model\MessageStatusEnum|null $message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param \Bandwidth\Model\ListMessageDirectionEnum|null $message_direction The direction of the message. One of INBOUND OUTBOUND. (optional) + * @param string|null $carrier_name 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 \Bandwidth\Model\MessageTypeEnum|null $message_type The type of message. Either sms or mms. (optional) + * @param int|null $error_code The error code of the message. (optional) + * @param string|null $from_date_time 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 string|null $to_date_time 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 string|null $campaign_id The campaign ID of the message. (optional) + * @param int|null $from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param bool|null $bw_queued A boolean value indicating whether the message is queued in the Bandwidth network. (optional) + * @param \Bandwidth\Model\ProductTypeEnum|null $product Messaging product associated with the message. (optional) + * @param string|null $location Location Id associated with the message. (optional) + * @param bool|null $carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param int|null $from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param string|null $calling_number_country_a3 Calling number country in A3 format. (optional) + * @param string|null $called_number_country_a3 Called number country in A3 format. (optional) + * @param int|null $from_segment_count Segment count (start range). (optional) + * @param int|null $to_segment_count Segment count (end range). (optional) + * @param int|null $from_message_size Message size (start range). (optional) + * @param int|null $to_message_size Message size (end range). (optional) + * @param string|null $sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) + * @param string|null $page_token A base64 encoded value used for pagination of results. (optional) + * @param int|null $limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param bool|null $limit_total_count 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMessages'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\MessagesList|\Bandwidth\Model\MessagingRequestError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listMessagesWithHttpInfo( + string $account_id, + ?string $message_id = null, + ?string $source_tn = null, + ?string $destination_tn = null, + ?\Bandwidth\Model\MessageStatusEnum $message_status = null, + ?\Bandwidth\Model\ListMessageDirectionEnum $message_direction = null, + ?string $carrier_name = null, + ?\Bandwidth\Model\MessageTypeEnum $message_type = null, + ?int $error_code = null, + ?string $from_date_time = null, + ?string $to_date_time = null, + ?string $campaign_id = null, + ?int $from_bw_latency = null, + ?bool $bw_queued = null, + ?\Bandwidth\Model\ProductTypeEnum $product = null, + ?string $location = null, + ?bool $carrier_queued = null, + ?int $from_carrier_latency = null, + ?string $calling_number_country_a3 = null, + ?string $called_number_country_a3 = null, + ?int $from_segment_count = null, + ?int $to_segment_count = null, + ?int $from_message_size = null, + ?int $to_message_size = null, + ?string $sort = null, + ?string $page_token = null, + ?int $limit = null, + ?bool $limit_total_count = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listMessages'][0] + ): array + { + $request = $this->listMessagesRequest($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagesList', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagingRequestError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MessagesList', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagesList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MessagingRequestError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listMessagesAsync + * + * List Messages + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $message_id 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 string|null $source_tn 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 string|null $destination_tn 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 \Bandwidth\Model\MessageStatusEnum|null $message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param \Bandwidth\Model\ListMessageDirectionEnum|null $message_direction The direction of the message. One of INBOUND OUTBOUND. (optional) + * @param string|null $carrier_name 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 \Bandwidth\Model\MessageTypeEnum|null $message_type The type of message. Either sms or mms. (optional) + * @param int|null $error_code The error code of the message. (optional) + * @param string|null $from_date_time 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 string|null $to_date_time 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 string|null $campaign_id The campaign ID of the message. (optional) + * @param int|null $from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param bool|null $bw_queued A boolean value indicating whether the message is queued in the Bandwidth network. (optional) + * @param \Bandwidth\Model\ProductTypeEnum|null $product Messaging product associated with the message. (optional) + * @param string|null $location Location Id associated with the message. (optional) + * @param bool|null $carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param int|null $from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param string|null $calling_number_country_a3 Calling number country in A3 format. (optional) + * @param string|null $called_number_country_a3 Called number country in A3 format. (optional) + * @param int|null $from_segment_count Segment count (start range). (optional) + * @param int|null $to_segment_count Segment count (end range). (optional) + * @param int|null $from_message_size Message size (start range). (optional) + * @param int|null $to_message_size Message size (end range). (optional) + * @param string|null $sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) + * @param string|null $page_token A base64 encoded value used for pagination of results. (optional) + * @param int|null $limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param bool|null $limit_total_count 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMessages'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listMessagesAsync( + string $account_id, + ?string $message_id = null, + ?string $source_tn = null, + ?string $destination_tn = null, + ?\Bandwidth\Model\MessageStatusEnum $message_status = null, + ?\Bandwidth\Model\ListMessageDirectionEnum $message_direction = null, + ?string $carrier_name = null, + ?\Bandwidth\Model\MessageTypeEnum $message_type = null, + ?int $error_code = null, + ?string $from_date_time = null, + ?string $to_date_time = null, + ?string $campaign_id = null, + ?int $from_bw_latency = null, + ?bool $bw_queued = null, + ?\Bandwidth\Model\ProductTypeEnum $product = null, + ?string $location = null, + ?bool $carrier_queued = null, + ?int $from_carrier_latency = null, + ?string $calling_number_country_a3 = null, + ?string $called_number_country_a3 = null, + ?int $from_segment_count = null, + ?int $to_segment_count = null, + ?int $from_message_size = null, + ?int $to_message_size = null, + ?string $sort = null, + ?string $page_token = null, + ?int $limit = null, + ?bool $limit_total_count = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listMessages'][0] + ): PromiseInterface + { + return $this->listMessagesAsyncWithHttpInfo($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listMessagesAsyncWithHttpInfo + * + * List Messages + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $message_id 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 string|null $source_tn 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 string|null $destination_tn 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 \Bandwidth\Model\MessageStatusEnum|null $message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param \Bandwidth\Model\ListMessageDirectionEnum|null $message_direction The direction of the message. One of INBOUND OUTBOUND. (optional) + * @param string|null $carrier_name 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 \Bandwidth\Model\MessageTypeEnum|null $message_type The type of message. Either sms or mms. (optional) + * @param int|null $error_code The error code of the message. (optional) + * @param string|null $from_date_time 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 string|null $to_date_time 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 string|null $campaign_id The campaign ID of the message. (optional) + * @param int|null $from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param bool|null $bw_queued A boolean value indicating whether the message is queued in the Bandwidth network. (optional) + * @param \Bandwidth\Model\ProductTypeEnum|null $product Messaging product associated with the message. (optional) + * @param string|null $location Location Id associated with the message. (optional) + * @param bool|null $carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param int|null $from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param string|null $calling_number_country_a3 Calling number country in A3 format. (optional) + * @param string|null $called_number_country_a3 Called number country in A3 format. (optional) + * @param int|null $from_segment_count Segment count (start range). (optional) + * @param int|null $to_segment_count Segment count (end range). (optional) + * @param int|null $from_message_size Message size (start range). (optional) + * @param int|null $to_message_size Message size (end range). (optional) + * @param string|null $sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) + * @param string|null $page_token A base64 encoded value used for pagination of results. (optional) + * @param int|null $limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param bool|null $limit_total_count 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMessages'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listMessagesAsyncWithHttpInfo( + string $account_id, + ?string $message_id = null, + ?string $source_tn = null, + ?string $destination_tn = null, + ?\Bandwidth\Model\MessageStatusEnum $message_status = null, + ?\Bandwidth\Model\ListMessageDirectionEnum $message_direction = null, + ?string $carrier_name = null, + ?\Bandwidth\Model\MessageTypeEnum $message_type = null, + ?int $error_code = null, + ?string $from_date_time = null, + ?string $to_date_time = null, + ?string $campaign_id = null, + ?int $from_bw_latency = null, + ?bool $bw_queued = null, + ?\Bandwidth\Model\ProductTypeEnum $product = null, + ?string $location = null, + ?bool $carrier_queued = null, + ?int $from_carrier_latency = null, + ?string $calling_number_country_a3 = null, + ?string $called_number_country_a3 = null, + ?int $from_segment_count = null, + ?int $to_segment_count = null, + ?int $from_message_size = null, + ?int $to_message_size = null, + ?string $sort = null, + ?string $page_token = null, + ?int $limit = null, + ?bool $limit_total_count = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listMessages'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\MessagesList'; + $request = $this->listMessagesRequest($account_id, $message_id, $source_tn, $destination_tn, $message_status, $message_direction, $carrier_name, $message_type, $error_code, $from_date_time, $to_date_time, $campaign_id, $from_bw_latency, $bw_queued, $product, $location, $carrier_queued, $from_carrier_latency, $calling_number_country_a3, $called_number_country_a3, $from_segment_count, $to_segment_count, $from_message_size, $to_message_size, $sort, $page_token, $limit, $limit_total_count, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listMessages' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $message_id 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 string|null $source_tn 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 string|null $destination_tn 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 \Bandwidth\Model\MessageStatusEnum|null $message_status The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param \Bandwidth\Model\ListMessageDirectionEnum|null $message_direction The direction of the message. One of INBOUND OUTBOUND. (optional) + * @param string|null $carrier_name 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 \Bandwidth\Model\MessageTypeEnum|null $message_type The type of message. Either sms or mms. (optional) + * @param int|null $error_code The error code of the message. (optional) + * @param string|null $from_date_time 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 string|null $to_date_time 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 string|null $campaign_id The campaign ID of the message. (optional) + * @param int|null $from_bw_latency The minimum Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param bool|null $bw_queued A boolean value indicating whether the message is queued in the Bandwidth network. (optional) + * @param \Bandwidth\Model\ProductTypeEnum|null $product Messaging product associated with the message. (optional) + * @param string|null $location Location Id associated with the message. (optional) + * @param bool|null $carrier_queued A boolean value indicating whether the message is queued in the carrier network. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param int|null $from_carrier_latency The minimum carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. (optional) + * @param string|null $calling_number_country_a3 Calling number country in A3 format. (optional) + * @param string|null $called_number_country_a3 Called number country in A3 format. (optional) + * @param int|null $from_segment_count Segment count (start range). (optional) + * @param int|null $to_segment_count Segment count (end range). (optional) + * @param int|null $from_message_size Message size (start range). (optional) + * @param int|null $to_message_size Message size (end range). (optional) + * @param string|null $sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) + * @param string|null $page_token A base64 encoded value used for pagination of results. (optional) + * @param int|null $limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param bool|null $limit_total_count 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 null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listMessages'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listMessagesRequest( + string $account_id, + ?string $message_id = null, + ?string $source_tn = null, + ?string $destination_tn = null, + ?\Bandwidth\Model\MessageStatusEnum $message_status = null, + ?\Bandwidth\Model\ListMessageDirectionEnum $message_direction = null, + ?string $carrier_name = null, + ?\Bandwidth\Model\MessageTypeEnum $message_type = null, + ?int $error_code = null, + ?string $from_date_time = null, + ?string $to_date_time = null, + ?string $campaign_id = null, + ?int $from_bw_latency = null, + ?bool $bw_queued = null, + ?\Bandwidth\Model\ProductTypeEnum $product = null, + ?string $location = null, + ?bool $carrier_queued = null, + ?int $from_carrier_latency = null, + ?string $calling_number_country_a3 = null, + ?string $called_number_country_a3 = null, + ?int $from_segment_count = null, + ?int $to_segment_count = null, + ?int $from_message_size = null, + ?int $to_message_size = null, + ?string $sort = null, + ?string $page_token = null, + ?int $limit = null, + ?bool $limit_total_count = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listMessages'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling listMessages' + ); + } + + $resourcePath = '/users/{accountId}/messages'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $message_id, + 'messageId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $source_tn, + 'sourceTn', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $destination_tn, + 'destinationTn', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $message_status?->value, + 'messageStatus', // param base name + 'MessageStatusEnum', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $message_direction?->value, + 'messageDirection', // param base name + 'ListMessageDirectionEnum', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $carrier_name, + 'carrierName', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $message_type?->value, + 'messageType', // param base name + 'MessageTypeEnum', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $error_code, + 'errorCode', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_date_time, + 'fromDateTime', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to_date_time, + 'toDateTime', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $campaign_id, + 'campaignId', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_bw_latency, + 'fromBwLatency', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $bw_queued, + 'bwQueued', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $product?->value, + 'product', // param base name + 'ProductTypeEnum', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $location, + 'location', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $carrier_queued, + 'carrierQueued', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_carrier_latency, + 'fromCarrierLatency', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $calling_number_country_a3, + 'callingNumberCountryA3', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $called_number_country_a3, + 'calledNumberCountryA3', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_segment_count, + 'fromSegmentCount', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to_segment_count, + 'toSegmentCount', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from_message_size, + 'fromMessageSize', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to_message_size, + 'toMessageSize', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $sort, + 'sort', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_token, + 'pageToken', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit_total_count, + 'limitTotalCount', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForlistMessages(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation listMessages + * + * @return array an array of host settings + */ + protected function getHostSettingsForlistMessages(): array + { + return [ + [ + "url" => "https://messaging.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/MultiChannelApi.php b/src/Api/MultiChannelApi.php new file mode 100644 index 0000000..46f9214 --- /dev/null +++ b/src/Api/MultiChannelApi.php @@ -0,0 +1,678 @@ + $contentTypes **/ + public const contentTypes = [ + 'createMultiChannelMessage' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation createMultiChannelMessage + * + * Create Multi-Channel Message + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request multi_channel_message_request (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMultiChannelMessage'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CreateMultiChannelMessageResponse|\Bandwidth\Model\MultiChannelError + */ + public function createMultiChannelMessage( + string $account_id, + \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createMultiChannelMessage'][0] + ): \Bandwidth\Model\CreateMultiChannelMessageResponse|\Bandwidth\Model\MultiChannelError + { + list($response) = $this->createMultiChannelMessageWithHttpInfo($account_id, $multi_channel_message_request, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation createMultiChannelMessageWithHttpInfo + * + * Create Multi-Channel Message + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMultiChannelMessage'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CreateMultiChannelMessageResponse|\Bandwidth\Model\MultiChannelError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createMultiChannelMessageWithHttpInfo( + string $account_id, + \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createMultiChannelMessage'][0] + ): array + { + $request = $this->createMultiChannelMessageRequest($account_id, $multi_channel_message_request, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 202: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CreateMultiChannelMessageResponse', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MultiChannelError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MultiChannelError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MultiChannelError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MultiChannelError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MultiChannelError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MultiChannelError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MultiChannelError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\MultiChannelError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CreateMultiChannelMessageResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CreateMultiChannelMessageResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MultiChannelError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MultiChannelError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MultiChannelError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MultiChannelError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MultiChannelError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MultiChannelError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MultiChannelError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\MultiChannelError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createMultiChannelMessageAsync + * + * Create Multi-Channel Message + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMultiChannelMessage'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createMultiChannelMessageAsync( + string $account_id, + \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createMultiChannelMessage'][0] + ): PromiseInterface + { + return $this->createMultiChannelMessageAsyncWithHttpInfo($account_id, $multi_channel_message_request, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createMultiChannelMessageAsyncWithHttpInfo + * + * Create Multi-Channel Message + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMultiChannelMessage'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createMultiChannelMessageAsyncWithHttpInfo( + string $account_id, + \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createMultiChannelMessage'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CreateMultiChannelMessageResponse'; + $request = $this->createMultiChannelMessageRequest($account_id, $multi_channel_message_request, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createMultiChannelMessage' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://messaging.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createMultiChannelMessage'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createMultiChannelMessageRequest( + string $account_id, + \Bandwidth\Model\MultiChannelMessageRequest $multi_channel_message_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createMultiChannelMessage'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling createMultiChannelMessage' + ); + } + // verify the required parameter 'multi_channel_message_request' is set + if ($multi_channel_message_request === null || (is_array($multi_channel_message_request) && count($multi_channel_message_request) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $multi_channel_message_request when calling createMultiChannelMessage' + ); + } + + $resourcePath = '/users/{accountId}/messages/multiChannel'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($multi_channel_message_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($multi_channel_message_request)); + } else { + $httpBody = $multi_channel_message_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForcreateMultiChannelMessage(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation createMultiChannelMessage + * + * @return array an array of host settings + */ + protected function getHostSettingsForcreateMultiChannelMessage(): array + { + return [ + [ + "url" => "https://messaging.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/PhoneNumberLookupApi.php b/src/Api/PhoneNumberLookupApi.php new file mode 100644 index 0000000..845ee9c --- /dev/null +++ b/src/Api/PhoneNumberLookupApi.php @@ -0,0 +1,1346 @@ + $contentTypes **/ + public const contentTypes = [ + 'createAsyncBulkLookup' => [ + 'application/json', + ], + 'createSyncLookup' => [ + 'application/json', + ], + 'getAsyncBulkLookup' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation createAsyncBulkLookup + * + * Create Asynchronous Bulk Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id account_id (required) + * @param \Bandwidth\Model\AsyncLookupRequest $async_lookup_request Asynchronous bulk phone number lookup request. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAsyncBulkLookup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CreateAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse + */ + public function createAsyncBulkLookup( + string $account_id, + \Bandwidth\Model\AsyncLookupRequest $async_lookup_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createAsyncBulkLookup'][0] + ): \Bandwidth\Model\CreateAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse + { + list($response) = $this->createAsyncBulkLookupWithHttpInfo($account_id, $async_lookup_request, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation createAsyncBulkLookupWithHttpInfo + * + * Create Asynchronous Bulk Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param \Bandwidth\Model\AsyncLookupRequest $async_lookup_request Asynchronous bulk phone number lookup request. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAsyncBulkLookup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CreateAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createAsyncBulkLookupWithHttpInfo( + string $account_id, + \Bandwidth\Model\AsyncLookupRequest $async_lookup_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createAsyncBulkLookup'][0] + ): array + { + $request = $this->createAsyncBulkLookupRequest($account_id, $async_lookup_request, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 202: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CreateAsyncBulkLookupResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\LookupErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CreateAsyncBulkLookupResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CreateAsyncBulkLookupResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\LookupErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createAsyncBulkLookupAsync + * + * Create Asynchronous Bulk Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param \Bandwidth\Model\AsyncLookupRequest $async_lookup_request Asynchronous bulk phone number lookup request. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAsyncBulkLookup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createAsyncBulkLookupAsync( + string $account_id, + \Bandwidth\Model\AsyncLookupRequest $async_lookup_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createAsyncBulkLookup'][0] + ): PromiseInterface + { + return $this->createAsyncBulkLookupAsyncWithHttpInfo($account_id, $async_lookup_request, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncBulkLookupAsyncWithHttpInfo + * + * Create Asynchronous Bulk Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param \Bandwidth\Model\AsyncLookupRequest $async_lookup_request Asynchronous bulk phone number lookup request. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAsyncBulkLookup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createAsyncBulkLookupAsyncWithHttpInfo( + string $account_id, + \Bandwidth\Model\AsyncLookupRequest $async_lookup_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createAsyncBulkLookup'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CreateAsyncBulkLookupResponse'; + $request = $this->createAsyncBulkLookupRequest($account_id, $async_lookup_request, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createAsyncBulkLookup' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param \Bandwidth\Model\AsyncLookupRequest $async_lookup_request Asynchronous bulk phone number lookup request. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createAsyncBulkLookup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createAsyncBulkLookupRequest( + string $account_id, + \Bandwidth\Model\AsyncLookupRequest $async_lookup_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createAsyncBulkLookup'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling createAsyncBulkLookup' + ); + } + // verify the required parameter 'async_lookup_request' is set + if ($async_lookup_request === null || (is_array($async_lookup_request) && count($async_lookup_request) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $async_lookup_request when calling createAsyncBulkLookup' + ); + } + + $resourcePath = '/accounts/{accountId}/phoneNumberLookup/bulk'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($async_lookup_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($async_lookup_request)); + } else { + $httpBody = $async_lookup_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForcreateAsyncBulkLookup(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation createAsyncBulkLookup + * + * @return array an array of host settings + */ + protected function getHostSettingsForcreateAsyncBulkLookup(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation createSyncLookup + * + * Create Synchronous Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id account_id (required) + * @param \Bandwidth\Model\SyncLookupRequest $sync_lookup_request Synchronous phone number lookup request. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSyncLookup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CreateSyncLookupResponse|\Bandwidth\Model\LookupErrorResponse + */ + public function createSyncLookup( + string $account_id, + \Bandwidth\Model\SyncLookupRequest $sync_lookup_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createSyncLookup'][0] + ): \Bandwidth\Model\CreateSyncLookupResponse|\Bandwidth\Model\LookupErrorResponse + { + list($response) = $this->createSyncLookupWithHttpInfo($account_id, $sync_lookup_request, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation createSyncLookupWithHttpInfo + * + * Create Synchronous Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param \Bandwidth\Model\SyncLookupRequest $sync_lookup_request Synchronous phone number lookup request. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSyncLookup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CreateSyncLookupResponse|\Bandwidth\Model\LookupErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createSyncLookupWithHttpInfo( + string $account_id, + \Bandwidth\Model\SyncLookupRequest $sync_lookup_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createSyncLookup'][0] + ): array + { + $request = $this->createSyncLookupRequest($account_id, $sync_lookup_request, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CreateSyncLookupResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\LookupErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CreateSyncLookupResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CreateSyncLookupResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\LookupErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createSyncLookupAsync + * + * Create Synchronous Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param \Bandwidth\Model\SyncLookupRequest $sync_lookup_request Synchronous phone number lookup request. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSyncLookup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createSyncLookupAsync( + string $account_id, + \Bandwidth\Model\SyncLookupRequest $sync_lookup_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createSyncLookup'][0] + ): PromiseInterface + { + return $this->createSyncLookupAsyncWithHttpInfo($account_id, $sync_lookup_request, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createSyncLookupAsyncWithHttpInfo + * + * Create Synchronous Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param \Bandwidth\Model\SyncLookupRequest $sync_lookup_request Synchronous phone number lookup request. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSyncLookup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createSyncLookupAsyncWithHttpInfo( + string $account_id, + \Bandwidth\Model\SyncLookupRequest $sync_lookup_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createSyncLookup'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CreateSyncLookupResponse'; + $request = $this->createSyncLookupRequest($account_id, $sync_lookup_request, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createSyncLookup' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param \Bandwidth\Model\SyncLookupRequest $sync_lookup_request Synchronous phone number lookup request. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createSyncLookup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createSyncLookupRequest( + string $account_id, + \Bandwidth\Model\SyncLookupRequest $sync_lookup_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createSyncLookup'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling createSyncLookup' + ); + } + // verify the required parameter 'sync_lookup_request' is set + if ($sync_lookup_request === null || (is_array($sync_lookup_request) && count($sync_lookup_request) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $sync_lookup_request when calling createSyncLookup' + ); + } + + $resourcePath = '/accounts/{accountId}/phoneNumberLookup'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($sync_lookup_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sync_lookup_request)); + } else { + $httpBody = $sync_lookup_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForcreateSyncLookup(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation createSyncLookup + * + * @return array an array of host settings + */ + protected function getHostSettingsForcreateSyncLookup(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation getAsyncBulkLookup + * + * Get Asynchronous Bulk Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id account_id (required) + * @param string $request_id request_id (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncBulkLookup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\GetAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse + */ + public function getAsyncBulkLookup( + string $account_id, + string $request_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getAsyncBulkLookup'][0] + ): \Bandwidth\Model\GetAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse + { + list($response) = $this->getAsyncBulkLookupWithHttpInfo($account_id, $request_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getAsyncBulkLookupWithHttpInfo + * + * Get Asynchronous Bulk Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param string $request_id (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncBulkLookup'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\GetAsyncBulkLookupResponse|\Bandwidth\Model\LookupErrorResponse, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getAsyncBulkLookupWithHttpInfo( + string $account_id, + string $request_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getAsyncBulkLookup'][0] + ): array + { + $request = $this->getAsyncBulkLookupRequest($account_id, $request_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\GetAsyncBulkLookupResponse', + $request, + $response, + ); + default: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\LookupErrorResponse', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\GetAsyncBulkLookupResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\GetAsyncBulkLookupResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\LookupErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getAsyncBulkLookupAsync + * + * Get Asynchronous Bulk Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param string $request_id (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncBulkLookup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getAsyncBulkLookupAsync( + string $account_id, + string $request_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getAsyncBulkLookup'][0] + ): PromiseInterface + { + return $this->getAsyncBulkLookupAsyncWithHttpInfo($account_id, $request_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getAsyncBulkLookupAsyncWithHttpInfo + * + * Get Asynchronous Bulk Number Lookup + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param string $request_id (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncBulkLookup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getAsyncBulkLookupAsyncWithHttpInfo( + string $account_id, + string $request_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getAsyncBulkLookup'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\GetAsyncBulkLookupResponse'; + $request = $this->getAsyncBulkLookupRequest($account_id, $request_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getAsyncBulkLookup' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/v2 + * + * @param string $account_id (required) + * @param string $request_id (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAsyncBulkLookup'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getAsyncBulkLookupRequest( + string $account_id, + string $request_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getAsyncBulkLookup'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getAsyncBulkLookup' + ); + } + // verify the required parameter 'request_id' is set + if ($request_id === null || (is_array($request_id) && count($request_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $request_id when calling getAsyncBulkLookup' + ); + } + + $resourcePath = '/accounts/{accountId}/phoneNumberLookup/bulk/{requestId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($request_id !== null) { + $resourcePath = str_replace( + '{requestId}', + ObjectSerializer::toPathValue($request_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetAsyncBulkLookup(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getAsyncBulkLookup + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetAsyncBulkLookup(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/v2", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/RecordingsApi.php b/src/Api/RecordingsApi.php new file mode 100644 index 0000000..e7ebef6 --- /dev/null +++ b/src/Api/RecordingsApi.php @@ -0,0 +1,4721 @@ + $contentTypes **/ + public const contentTypes = [ + 'deleteRecording' => [ + 'application/json', + ], + 'deleteRecordingMedia' => [ + 'application/json', + ], + 'deleteRecordingTranscription' => [ + 'application/json', + ], + 'downloadCallRecording' => [ + 'application/json', + ], + 'getCallRecording' => [ + 'application/json', + ], + 'getRecordingTranscription' => [ + 'application/json', + ], + 'listAccountCallRecordings' => [ + 'application/json', + ], + 'listCallRecordings' => [ + 'application/json', + ], + 'transcribeCallRecording' => [ + 'application/json', + ], + 'updateCallRecordingState' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation deleteRecording + * + * Delete Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceApiError|null + */ + public function deleteRecording( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecording'][0] + ): ?\Bandwidth\Model\VoiceApiError + { + list($response) = $this->deleteRecordingWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation deleteRecordingWithHttpInfo + * + * Delete Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteRecordingWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecording'][0] + ): array + { + $request = $this->deleteRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteRecordingAsync + * + * Delete Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteRecordingAsync( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecording'][0] + ): PromiseInterface + { + return $this->deleteRecordingAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteRecordingAsyncWithHttpInfo + * + * Delete Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteRecordingAsyncWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecording'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteRecording' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteRecordingRequest( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecording'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling deleteRecording' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling deleteRecording' + ); + } + // verify the required parameter 'recording_id' is set + if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $recording_id when calling deleteRecording' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + // path params + if ($recording_id !== null) { + $resourcePath = str_replace( + '{recordingId}', + ObjectSerializer::toPathValue($recording_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFordeleteRecording(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation deleteRecording + * + * @return array an array of host settings + */ + protected function getHostSettingsFordeleteRecording(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation deleteRecordingMedia + * + * Delete Recording Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingMedia'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceApiError|null + */ + public function deleteRecordingMedia( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecordingMedia'][0] + ): ?\Bandwidth\Model\VoiceApiError + { + list($response) = $this->deleteRecordingMediaWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation deleteRecordingMediaWithHttpInfo + * + * Delete Recording Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingMedia'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteRecordingMediaWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecordingMedia'][0] + ): array + { + $request = $this->deleteRecordingMediaRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteRecordingMediaAsync + * + * Delete Recording Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteRecordingMediaAsync( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecordingMedia'][0] + ): PromiseInterface + { + return $this->deleteRecordingMediaAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteRecordingMediaAsyncWithHttpInfo + * + * Delete Recording Media + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteRecordingMediaAsyncWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecordingMedia'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteRecordingMediaRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteRecordingMedia' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingMedia'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteRecordingMediaRequest( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecordingMedia'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling deleteRecordingMedia' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling deleteRecordingMedia' + ); + } + // verify the required parameter 'recording_id' is set + if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $recording_id when calling deleteRecordingMedia' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + // path params + if ($recording_id !== null) { + $resourcePath = str_replace( + '{recordingId}', + ObjectSerializer::toPathValue($recording_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFordeleteRecordingMedia(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation deleteRecordingMedia + * + * @return array an array of host settings + */ + protected function getHostSettingsFordeleteRecordingMedia(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation deleteRecordingTranscription + * + * Delete Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingTranscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceApiError|null + */ + public function deleteRecordingTranscription( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecordingTranscription'][0] + ): ?\Bandwidth\Model\VoiceApiError + { + list($response) = $this->deleteRecordingTranscriptionWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation deleteRecordingTranscriptionWithHttpInfo + * + * Delete Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingTranscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteRecordingTranscriptionWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecordingTranscription'][0] + ): array + { + $request = $this->deleteRecordingTranscriptionRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteRecordingTranscriptionAsync + * + * Delete Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteRecordingTranscriptionAsync( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecordingTranscription'][0] + ): PromiseInterface + { + return $this->deleteRecordingTranscriptionAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteRecordingTranscriptionAsyncWithHttpInfo + * + * Delete Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteRecordingTranscriptionAsyncWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecordingTranscription'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteRecordingTranscriptionRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteRecordingTranscription' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRecordingTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteRecordingTranscriptionRequest( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRecordingTranscription'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling deleteRecordingTranscription' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling deleteRecordingTranscription' + ); + } + // verify the required parameter 'recording_id' is set + if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $recording_id when calling deleteRecordingTranscription' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + // path params + if ($recording_id !== null) { + $resourcePath = str_replace( + '{recordingId}', + ObjectSerializer::toPathValue($recording_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFordeleteRecordingTranscription(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation deleteRecordingTranscription + * + * @return array an array of host settings + */ + protected function getHostSettingsFordeleteRecordingTranscription(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation downloadCallRecording + * + * Download Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadCallRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \SplFileObject|\Bandwidth\Model\VoiceApiError + */ + public function downloadCallRecording( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['downloadCallRecording'][0] + ): \SplFileObject|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->downloadCallRecordingWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation downloadCallRecordingWithHttpInfo + * + * Download Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadCallRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \SplFileObject|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function downloadCallRecordingWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['downloadCallRecording'][0] + ): array + { + $request = $this->downloadCallRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\SplFileObject', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation downloadCallRecordingAsync + * + * Download Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadCallRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function downloadCallRecordingAsync( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['downloadCallRecording'][0] + ): PromiseInterface + { + return $this->downloadCallRecordingAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation downloadCallRecordingAsyncWithHttpInfo + * + * Download Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadCallRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function downloadCallRecordingAsyncWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['downloadCallRecording'][0] + ): PromiseInterface + { + $returnType = '\SplFileObject'; + $request = $this->downloadCallRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'downloadCallRecording' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadCallRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function downloadCallRecordingRequest( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['downloadCallRecording'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling downloadCallRecording' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling downloadCallRecording' + ); + } + // verify the required parameter 'recording_id' is set + if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $recording_id when calling downloadCallRecording' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + // path params + if ($recording_id !== null) { + $resourcePath = str_replace( + '{recordingId}', + ObjectSerializer::toPathValue($recording_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['audio/vnd.wave', 'audio/mpeg', 'application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFordownloadCallRecording(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation downloadCallRecording + * + * @return array an array of host settings + */ + protected function getHostSettingsFordownloadCallRecording(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation getCallRecording + * + * Get Call Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CallRecordingMetadata|\Bandwidth\Model\VoiceApiError + */ + public function getCallRecording( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getCallRecording'][0] + ): \Bandwidth\Model\CallRecordingMetadata|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->getCallRecordingWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getCallRecordingWithHttpInfo + * + * Get Call Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CallRecordingMetadata|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getCallRecordingWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getCallRecording'][0] + ): array + { + $request = $this->getCallRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallRecordingMetadata', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallRecordingMetadata', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CallRecordingMetadata', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getCallRecordingAsync + * + * Get Call Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getCallRecordingAsync( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getCallRecording'][0] + ): PromiseInterface + { + return $this->getCallRecordingAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getCallRecordingAsyncWithHttpInfo + * + * Get Call Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getCallRecordingAsyncWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getCallRecording'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CallRecordingMetadata'; + $request = $this->getCallRecordingRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getCallRecording' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCallRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getCallRecordingRequest( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getCallRecording'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getCallRecording' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling getCallRecording' + ); + } + // verify the required parameter 'recording_id' is set + if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $recording_id when calling getCallRecording' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + // path params + if ($recording_id !== null) { + $resourcePath = str_replace( + '{recordingId}', + ObjectSerializer::toPathValue($recording_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetCallRecording(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getCallRecording + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetCallRecording(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation getRecordingTranscription + * + * Get Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRecordingTranscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\RecordingTranscriptions|\Bandwidth\Model\VoiceApiError + */ + public function getRecordingTranscription( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getRecordingTranscription'][0] + ): \Bandwidth\Model\RecordingTranscriptions|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->getRecordingTranscriptionWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getRecordingTranscriptionWithHttpInfo + * + * Get Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRecordingTranscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\RecordingTranscriptions|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getRecordingTranscriptionWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getRecordingTranscription'][0] + ): array + { + $request = $this->getRecordingTranscriptionRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\RecordingTranscriptions', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\RecordingTranscriptions', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\RecordingTranscriptions', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getRecordingTranscriptionAsync + * + * Get Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRecordingTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getRecordingTranscriptionAsync( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getRecordingTranscription'][0] + ): PromiseInterface + { + return $this->getRecordingTranscriptionAsyncWithHttpInfo($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRecordingTranscriptionAsyncWithHttpInfo + * + * Get Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRecordingTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getRecordingTranscriptionAsyncWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getRecordingTranscription'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\RecordingTranscriptions'; + $request = $this->getRecordingTranscriptionRequest($account_id, $call_id, $recording_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getRecordingTranscription' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRecordingTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRecordingTranscriptionRequest( + string $account_id, + string $call_id, + string $recording_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getRecordingTranscription'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getRecordingTranscription' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling getRecordingTranscription' + ); + } + // verify the required parameter 'recording_id' is set + if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $recording_id when calling getRecordingTranscription' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + // path params + if ($recording_id !== null) { + $resourcePath = str_replace( + '{recordingId}', + ObjectSerializer::toPathValue($recording_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetRecordingTranscription(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getRecordingTranscription + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetRecordingTranscription(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation listAccountCallRecordings + * + * Get Call Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $to Filter results by the `to` field. (optional) + * @param string|null $from Filter results by the `from` field. (optional) + * @param string|null $min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param string|null $max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAccountCallRecordings'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CallRecordingMetadata[]|\Bandwidth\Model\VoiceApiError + */ + public function listAccountCallRecordings( + string $account_id, + ?string $to = null, + ?string $from = null, + ?string $min_start_time = null, + ?string $max_start_time = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listAccountCallRecordings'][0] + ): array|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->listAccountCallRecordingsWithHttpInfo($account_id, $to, $from, $min_start_time, $max_start_time, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation listAccountCallRecordingsWithHttpInfo + * + * Get Call Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $to Filter results by the `to` field. (optional) + * @param string|null $from Filter results by the `from` field. (optional) + * @param string|null $min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param string|null $max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAccountCallRecordings'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CallRecordingMetadata[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listAccountCallRecordingsWithHttpInfo( + string $account_id, + ?string $to = null, + ?string $from = null, + ?string $min_start_time = null, + ?string $max_start_time = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listAccountCallRecordings'][0] + ): array + { + $request = $this->listAccountCallRecordingsRequest($account_id, $to, $from, $min_start_time, $max_start_time, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallRecordingMetadata[]', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallRecordingMetadata[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CallRecordingMetadata[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listAccountCallRecordingsAsync + * + * Get Call Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $to Filter results by the `to` field. (optional) + * @param string|null $from Filter results by the `from` field. (optional) + * @param string|null $min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param string|null $max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAccountCallRecordings'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listAccountCallRecordingsAsync( + string $account_id, + ?string $to = null, + ?string $from = null, + ?string $min_start_time = null, + ?string $max_start_time = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listAccountCallRecordings'][0] + ): PromiseInterface + { + return $this->listAccountCallRecordingsAsyncWithHttpInfo($account_id, $to, $from, $min_start_time, $max_start_time, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listAccountCallRecordingsAsyncWithHttpInfo + * + * Get Call Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $to Filter results by the `to` field. (optional) + * @param string|null $from Filter results by the `from` field. (optional) + * @param string|null $min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param string|null $max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAccountCallRecordings'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listAccountCallRecordingsAsyncWithHttpInfo( + string $account_id, + ?string $to = null, + ?string $from = null, + ?string $min_start_time = null, + ?string $max_start_time = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listAccountCallRecordings'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CallRecordingMetadata[]'; + $request = $this->listAccountCallRecordingsRequest($account_id, $to, $from, $min_start_time, $max_start_time, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listAccountCallRecordings' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string|null $to Filter results by the `to` field. (optional) + * @param string|null $from Filter results by the `from` field. (optional) + * @param string|null $min_start_time Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param string|null $max_start_time Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAccountCallRecordings'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listAccountCallRecordingsRequest( + string $account_id, + ?string $to = null, + ?string $from = null, + ?string $min_start_time = null, + ?string $max_start_time = null, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listAccountCallRecordings'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling listAccountCallRecordings' + ); + } + + $resourcePath = '/accounts/{accountId}/recordings'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to, + 'to', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from, + 'from', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $min_start_time, + 'minStartTime', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $max_start_time, + 'maxStartTime', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForlistAccountCallRecordings(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation listAccountCallRecordings + * + * @return array an array of host settings + */ + protected function getHostSettingsForlistAccountCallRecordings(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation listCallRecordings + * + * List Call Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCallRecordings'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CallRecordingMetadata[]|\Bandwidth\Model\VoiceApiError + */ + public function listCallRecordings( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listCallRecordings'][0] + ): array|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->listCallRecordingsWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation listCallRecordingsWithHttpInfo + * + * List Call Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCallRecordings'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CallRecordingMetadata[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listCallRecordingsWithHttpInfo( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listCallRecordings'][0] + ): array + { + $request = $this->listCallRecordingsRequest($account_id, $call_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallRecordingMetadata[]', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallRecordingMetadata[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CallRecordingMetadata[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listCallRecordingsAsync + * + * List Call Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCallRecordings'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listCallRecordingsAsync( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listCallRecordings'][0] + ): PromiseInterface + { + return $this->listCallRecordingsAsyncWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listCallRecordingsAsyncWithHttpInfo + * + * List Call Recordings + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCallRecordings'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listCallRecordingsAsyncWithHttpInfo( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listCallRecordings'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CallRecordingMetadata[]'; + $request = $this->listCallRecordingsRequest($account_id, $call_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listCallRecordings' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCallRecordings'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listCallRecordingsRequest( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listCallRecordings'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling listCallRecordings' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling listCallRecordings' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForlistCallRecordings(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation listCallRecordings + * + * @return array an array of host settings + */ + protected function getHostSettingsForlistCallRecordings(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation transcribeCallRecording + * + * Create Transcription Request + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param \Bandwidth\Model\TranscribeRecording $transcribe_recording transcribe_recording (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transcribeCallRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceApiError|null + */ + public function transcribeCallRecording( + string $account_id, + string $call_id, + string $recording_id, + \Bandwidth\Model\TranscribeRecording $transcribe_recording, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['transcribeCallRecording'][0] + ): ?\Bandwidth\Model\VoiceApiError + { + list($response) = $this->transcribeCallRecordingWithHttpInfo($account_id, $call_id, $recording_id, $transcribe_recording, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation transcribeCallRecordingWithHttpInfo + * + * Create Transcription Request + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param \Bandwidth\Model\TranscribeRecording $transcribe_recording (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transcribeCallRecording'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function transcribeCallRecordingWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + \Bandwidth\Model\TranscribeRecording $transcribe_recording, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['transcribeCallRecording'][0] + ): array + { + $request = $this->transcribeCallRecordingRequest($account_id, $call_id, $recording_id, $transcribe_recording, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation transcribeCallRecordingAsync + * + * Create Transcription Request + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param \Bandwidth\Model\TranscribeRecording $transcribe_recording (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transcribeCallRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function transcribeCallRecordingAsync( + string $account_id, + string $call_id, + string $recording_id, + \Bandwidth\Model\TranscribeRecording $transcribe_recording, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['transcribeCallRecording'][0] + ): PromiseInterface + { + return $this->transcribeCallRecordingAsyncWithHttpInfo($account_id, $call_id, $recording_id, $transcribe_recording, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transcribeCallRecordingAsyncWithHttpInfo + * + * Create Transcription Request + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param \Bandwidth\Model\TranscribeRecording $transcribe_recording (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transcribeCallRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function transcribeCallRecordingAsyncWithHttpInfo( + string $account_id, + string $call_id, + string $recording_id, + \Bandwidth\Model\TranscribeRecording $transcribe_recording, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['transcribeCallRecording'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->transcribeCallRecordingRequest($account_id, $call_id, $recording_id, $transcribe_recording, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'transcribeCallRecording' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $recording_id Programmable Voice API Recording ID. (required) + * @param \Bandwidth\Model\TranscribeRecording $transcribe_recording (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transcribeCallRecording'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transcribeCallRecordingRequest( + string $account_id, + string $call_id, + string $recording_id, + \Bandwidth\Model\TranscribeRecording $transcribe_recording, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['transcribeCallRecording'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling transcribeCallRecording' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling transcribeCallRecording' + ); + } + // verify the required parameter 'recording_id' is set + if ($recording_id === null || (is_array($recording_id) && count($recording_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $recording_id when calling transcribeCallRecording' + ); + } + // verify the required parameter 'transcribe_recording' is set + if ($transcribe_recording === null || (is_array($transcribe_recording) && count($transcribe_recording) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $transcribe_recording when calling transcribeCallRecording' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + // path params + if ($recording_id !== null) { + $resourcePath = str_replace( + '{recordingId}', + ObjectSerializer::toPathValue($recording_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($transcribe_recording)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($transcribe_recording)); + } else { + $httpBody = $transcribe_recording; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFortranscribeCallRecording(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation transcribeCallRecording + * + * @return array an array of host settings + */ + protected function getHostSettingsFortranscribeCallRecording(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation updateCallRecordingState + * + * Update Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param \Bandwidth\Model\UpdateCallRecording $update_call_recording update_call_recording (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallRecordingState'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceApiError|null + */ + public function updateCallRecordingState( + string $account_id, + string $call_id, + \Bandwidth\Model\UpdateCallRecording $update_call_recording, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCallRecordingState'][0] + ): ?\Bandwidth\Model\VoiceApiError + { + list($response) = $this->updateCallRecordingStateWithHttpInfo($account_id, $call_id, $update_call_recording, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation updateCallRecordingStateWithHttpInfo + * + * Update Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param \Bandwidth\Model\UpdateCallRecording $update_call_recording (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallRecordingState'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateCallRecordingStateWithHttpInfo( + string $account_id, + string $call_id, + \Bandwidth\Model\UpdateCallRecording $update_call_recording, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCallRecordingState'][0] + ): array + { + $request = $this->updateCallRecordingStateRequest($account_id, $call_id, $update_call_recording, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateCallRecordingStateAsync + * + * Update Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param \Bandwidth\Model\UpdateCallRecording $update_call_recording (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallRecordingState'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateCallRecordingStateAsync( + string $account_id, + string $call_id, + \Bandwidth\Model\UpdateCallRecording $update_call_recording, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCallRecordingState'][0] + ): PromiseInterface + { + return $this->updateCallRecordingStateAsyncWithHttpInfo($account_id, $call_id, $update_call_recording, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateCallRecordingStateAsyncWithHttpInfo + * + * Update Recording + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param \Bandwidth\Model\UpdateCallRecording $update_call_recording (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallRecordingState'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateCallRecordingStateAsyncWithHttpInfo( + string $account_id, + string $call_id, + \Bandwidth\Model\UpdateCallRecording $update_call_recording, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCallRecordingState'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->updateCallRecordingStateRequest($account_id, $call_id, $update_call_recording, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateCallRecordingState' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param \Bandwidth\Model\UpdateCallRecording $update_call_recording (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCallRecordingState'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateCallRecordingStateRequest( + string $account_id, + string $call_id, + \Bandwidth\Model\UpdateCallRecording $update_call_recording, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateCallRecordingState'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling updateCallRecordingState' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling updateCallRecordingState' + ); + } + // verify the required parameter 'update_call_recording' is set + if ($update_call_recording === null || (is_array($update_call_recording) && count($update_call_recording) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $update_call_recording when calling updateCallRecordingState' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/recording'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($update_call_recording)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($update_call_recording)); + } else { + $httpBody = $update_call_recording; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForupdateCallRecordingState(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation updateCallRecordingState + * + * @return array an array of host settings + */ + protected function getHostSettingsForupdateCallRecordingState(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/StatisticsApi.php b/src/Api/StatisticsApi.php new file mode 100644 index 0000000..08d9a22 --- /dev/null +++ b/src/Api/StatisticsApi.php @@ -0,0 +1,630 @@ + $contentTypes **/ + public const contentTypes = [ + 'getStatistics' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation getStatistics + * + * Get Account Statistics + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatistics'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\AccountStatistics|\Bandwidth\Model\VoiceApiError + */ + public function getStatistics( + string $account_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getStatistics'][0] + ): \Bandwidth\Model\AccountStatistics|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->getStatisticsWithHttpInfo($account_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getStatisticsWithHttpInfo + * + * Get Account Statistics + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatistics'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\AccountStatistics|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getStatisticsWithHttpInfo( + string $account_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getStatistics'][0] + ): array + { + $request = $this->getStatisticsRequest($account_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\AccountStatistics', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\AccountStatistics', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\AccountStatistics', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getStatisticsAsync + * + * Get Account Statistics + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatistics'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getStatisticsAsync( + string $account_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getStatistics'][0] + ): PromiseInterface + { + return $this->getStatisticsAsyncWithHttpInfo($account_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getStatisticsAsyncWithHttpInfo + * + * Get Account Statistics + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatistics'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getStatisticsAsyncWithHttpInfo( + string $account_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getStatistics'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\AccountStatistics'; + $request = $this->getStatisticsRequest($account_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getStatistics' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStatistics'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getStatisticsRequest( + string $account_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getStatistics'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getStatistics' + ); + } + + $resourcePath = '/accounts/{accountId}/statistics'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetStatistics(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getStatistics + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetStatistics(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/TollFreeVerificationApi.php b/src/Api/TollFreeVerificationApi.php new file mode 100644 index 0000000..7acaa4e --- /dev/null +++ b/src/Api/TollFreeVerificationApi.php @@ -0,0 +1,4099 @@ + $contentTypes **/ + public const contentTypes = [ + 'createWebhookSubscription' => [ + 'application/json', + ], + 'deleteVerificationRequest' => [ + 'application/json', + ], + 'deleteWebhookSubscription' => [ + 'application/json', + ], + 'getTollFreeVerificationStatus' => [ + 'application/json', + ], + 'listTollFreeUseCases' => [ + 'application/json', + ], + 'listWebhookSubscriptions' => [ + 'application/json', + ], + 'requestTollFreeVerification' => [ + 'application/json', + ], + 'updateTollFreeVerificationRequest' => [ + 'application/json', + ], + 'updateWebhookSubscription' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation createWebhookSubscription + * + * Create Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookSubscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError + */ + public function createWebhookSubscription( + string $account_id, + \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createWebhookSubscription'][0] + ): \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError + { + list($response) = $this->createWebhookSubscriptionWithHttpInfo($account_id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation createWebhookSubscriptionWithHttpInfo + * + * Create Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookSubscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function createWebhookSubscriptionWithHttpInfo( + string $account_id, + \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createWebhookSubscription'][0] + ): array + { + $request = $this->createWebhookSubscriptionRequest($account_id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 201: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\WebhookSubscription', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 503: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\WebhookSubscription', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\WebhookSubscription', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation createWebhookSubscriptionAsync + * + * Create Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookSubscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createWebhookSubscriptionAsync( + string $account_id, + \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createWebhookSubscription'][0] + ): PromiseInterface + { + return $this->createWebhookSubscriptionAsyncWithHttpInfo($account_id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createWebhookSubscriptionAsyncWithHttpInfo + * + * Create Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookSubscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function createWebhookSubscriptionAsyncWithHttpInfo( + string $account_id, + \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createWebhookSubscription'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\WebhookSubscription'; + $request = $this->createWebhookSubscriptionRequest($account_id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createWebhookSubscription' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createWebhookSubscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createWebhookSubscriptionRequest( + string $account_id, + \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['createWebhookSubscription'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling createWebhookSubscription' + ); + } + // verify the required parameter 'webhook_subscription_request_schema' is set + if ($webhook_subscription_request_schema === null || (is_array($webhook_subscription_request_schema) && count($webhook_subscription_request_schema) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $webhook_subscription_request_schema when calling createWebhookSubscription' + ); + } + + $resourcePath = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($webhook_subscription_request_schema)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($webhook_subscription_request_schema)); + } else { + $httpBody = $webhook_subscription_request_schema; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForcreateWebhookSubscription(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation createWebhookSubscription + * + * @return array an array of host settings + */ + protected function getHostSettingsForcreateWebhookSubscription(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation deleteVerificationRequest + * + * Delete a Toll-Free Verification Submission + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVerificationRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\TfvError|null + */ + public function deleteVerificationRequest( + string $account_id, + string $phone_number, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteVerificationRequest'][0] + ): ?\Bandwidth\Model\TfvError + { + list($response) = $this->deleteVerificationRequestWithHttpInfo($account_id, $phone_number, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation deleteVerificationRequestWithHttpInfo + * + * Delete a Toll-Free Verification Submission + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVerificationRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteVerificationRequestWithHttpInfo( + string $account_id, + string $phone_number, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteVerificationRequest'][0] + ): array + { + $request = $this->deleteVerificationRequestRequest($account_id, $phone_number, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteVerificationRequestAsync + * + * Delete a Toll-Free Verification Submission + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVerificationRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteVerificationRequestAsync( + string $account_id, + string $phone_number, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteVerificationRequest'][0] + ): PromiseInterface + { + return $this->deleteVerificationRequestAsyncWithHttpInfo($account_id, $phone_number, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteVerificationRequestAsyncWithHttpInfo + * + * Delete a Toll-Free Verification Submission + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVerificationRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteVerificationRequestAsyncWithHttpInfo( + string $account_id, + string $phone_number, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteVerificationRequest'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteVerificationRequestRequest($account_id, $phone_number, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteVerificationRequest' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteVerificationRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteVerificationRequestRequest( + string $account_id, + string $phone_number, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteVerificationRequest'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling deleteVerificationRequest' + ); + } + // verify the required parameter 'phone_number' is set + if ($phone_number === null || (is_array($phone_number) && count($phone_number) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $phone_number when calling deleteVerificationRequest' + ); + } + if (strlen($phone_number) > 12) { + throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.deleteVerificationRequest, must be smaller than or equal to 12.'); + } + if (strlen($phone_number) < 12) { + throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.deleteVerificationRequest, must be bigger than or equal to 12.'); + } + if (!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $phone_number)) { + throw new InvalidArgumentException("invalid value for \"phone_number\" when calling TollFreeVerificationApi.deleteVerificationRequest, must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."); + } + + $resourcePath = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($phone_number !== null) { + $resourcePath = str_replace( + '{phoneNumber}', + ObjectSerializer::toPathValue($phone_number), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFordeleteVerificationRequest(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation deleteVerificationRequest + * + * @return array an array of host settings + */ + protected function getHostSettingsFordeleteVerificationRequest(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation deleteWebhookSubscription + * + * Delete Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $id Webhook subscription ID (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\TfvError|null + */ + public function deleteWebhookSubscription( + string $account_id, + string $id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteWebhookSubscription'][0] + ): ?\Bandwidth\Model\TfvError + { + list($response) = $this->deleteWebhookSubscriptionWithHttpInfo($account_id, $id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation deleteWebhookSubscriptionWithHttpInfo + * + * Delete Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $id Webhook subscription ID (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteWebhookSubscriptionWithHttpInfo( + string $account_id, + string $id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteWebhookSubscription'][0] + ): array + { + $request = $this->deleteWebhookSubscriptionRequest($account_id, $id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteWebhookSubscriptionAsync + * + * Delete Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $id Webhook subscription ID (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteWebhookSubscriptionAsync( + string $account_id, + string $id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteWebhookSubscription'][0] + ): PromiseInterface + { + return $this->deleteWebhookSubscriptionAsyncWithHttpInfo($account_id, $id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteWebhookSubscriptionAsyncWithHttpInfo + * + * Delete Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $id Webhook subscription ID (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteWebhookSubscriptionAsyncWithHttpInfo( + string $account_id, + string $id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteWebhookSubscription'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteWebhookSubscriptionRequest($account_id, $id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteWebhookSubscription' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $id Webhook subscription ID (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteWebhookSubscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteWebhookSubscriptionRequest( + string $account_id, + string $id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteWebhookSubscription'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling deleteWebhookSubscription' + ); + } + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling deleteWebhookSubscription' + ); + } + + $resourcePath = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{id}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFordeleteWebhookSubscription(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation deleteWebhookSubscription + * + * @return array an array of host settings + */ + protected function getHostSettingsFordeleteWebhookSubscription(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation getTollFreeVerificationStatus + * + * Get Toll-Free Verification Status + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTollFreeVerificationStatus'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\TfvStatus|\Bandwidth\Model\TfvError + */ + public function getTollFreeVerificationStatus( + string $account_id, + string $phone_number, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getTollFreeVerificationStatus'][0] + ): \Bandwidth\Model\TfvStatus|\Bandwidth\Model\TfvError + { + list($response) = $this->getTollFreeVerificationStatusWithHttpInfo($account_id, $phone_number, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getTollFreeVerificationStatusWithHttpInfo + * + * Get Toll-Free Verification Status + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTollFreeVerificationStatus'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\TfvStatus|\Bandwidth\Model\TfvError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getTollFreeVerificationStatusWithHttpInfo( + string $account_id, + string $phone_number, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getTollFreeVerificationStatus'][0] + ): array + { + $request = $this->getTollFreeVerificationStatusRequest($account_id, $phone_number, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvStatus', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 503: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvStatus', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvStatus', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getTollFreeVerificationStatusAsync + * + * Get Toll-Free Verification Status + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTollFreeVerificationStatus'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getTollFreeVerificationStatusAsync( + string $account_id, + string $phone_number, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getTollFreeVerificationStatus'][0] + ): PromiseInterface + { + return $this->getTollFreeVerificationStatusAsyncWithHttpInfo($account_id, $phone_number, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTollFreeVerificationStatusAsyncWithHttpInfo + * + * Get Toll-Free Verification Status + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTollFreeVerificationStatus'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getTollFreeVerificationStatusAsyncWithHttpInfo( + string $account_id, + string $phone_number, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getTollFreeVerificationStatus'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\TfvStatus'; + $request = $this->getTollFreeVerificationStatusRequest($account_id, $phone_number, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTollFreeVerificationStatus' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTollFreeVerificationStatus'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTollFreeVerificationStatusRequest( + string $account_id, + string $phone_number, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getTollFreeVerificationStatus'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getTollFreeVerificationStatus' + ); + } + // verify the required parameter 'phone_number' is set + if ($phone_number === null || (is_array($phone_number) && count($phone_number) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $phone_number when calling getTollFreeVerificationStatus' + ); + } + if (strlen($phone_number) > 12) { + throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.getTollFreeVerificationStatus, must be smaller than or equal to 12.'); + } + if (strlen($phone_number) < 12) { + throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.getTollFreeVerificationStatus, must be bigger than or equal to 12.'); + } + if (!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $phone_number)) { + throw new InvalidArgumentException("invalid value for \"phone_number\" when calling TollFreeVerificationApi.getTollFreeVerificationStatus, must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."); + } + + $resourcePath = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($phone_number !== null) { + $resourcePath = str_replace( + '{phoneNumber}', + ObjectSerializer::toPathValue($phone_number), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetTollFreeVerificationStatus(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getTollFreeVerificationStatus + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetTollFreeVerificationStatus(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation listTollFreeUseCases + * + * List Toll-Free Use Cases + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listTollFreeUseCases'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return string[]|\Bandwidth\Model\TfvError + */ + public function listTollFreeUseCases( + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listTollFreeUseCases'][0] + ): array|\Bandwidth\Model\TfvError + { + list($response) = $this->listTollFreeUseCasesWithHttpInfo($hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation listTollFreeUseCasesWithHttpInfo + * + * List Toll-Free Use Cases + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listTollFreeUseCases'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: string[]|\Bandwidth\Model\TfvError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listTollFreeUseCasesWithHttpInfo( + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listTollFreeUseCases'][0] + ): array + { + $request = $this->listTollFreeUseCasesRequest($hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + 'string[]', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 503: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + 'string[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listTollFreeUseCasesAsync + * + * List Toll-Free Use Cases + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listTollFreeUseCases'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listTollFreeUseCasesAsync( + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listTollFreeUseCases'][0] + ): PromiseInterface + { + return $this->listTollFreeUseCasesAsyncWithHttpInfo($hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listTollFreeUseCasesAsyncWithHttpInfo + * + * List Toll-Free Use Cases + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listTollFreeUseCases'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listTollFreeUseCasesAsyncWithHttpInfo( + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listTollFreeUseCases'][0] + ): PromiseInterface + { + $returnType = 'string[]'; + $request = $this->listTollFreeUseCasesRequest($hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listTollFreeUseCases' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listTollFreeUseCases'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listTollFreeUseCasesRequest( + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listTollFreeUseCases'][0] + ): Request + { + + $resourcePath = '/tollFreeVerification/useCases'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForlistTollFreeUseCases(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation listTollFreeUseCases + * + * @return array an array of host settings + */ + protected function getHostSettingsForlistTollFreeUseCases(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation listWebhookSubscriptions + * + * List Webhook Subscriptions + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWebhookSubscriptions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\WebhookSubscriptionsListBody|\Bandwidth\Model\TfvError + */ + public function listWebhookSubscriptions( + string $account_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listWebhookSubscriptions'][0] + ): \Bandwidth\Model\WebhookSubscriptionsListBody|\Bandwidth\Model\TfvError + { + list($response) = $this->listWebhookSubscriptionsWithHttpInfo($account_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation listWebhookSubscriptionsWithHttpInfo + * + * List Webhook Subscriptions + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWebhookSubscriptions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\WebhookSubscriptionsListBody|\Bandwidth\Model\TfvError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listWebhookSubscriptionsWithHttpInfo( + string $account_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listWebhookSubscriptions'][0] + ): array + { + $request = $this->listWebhookSubscriptionsRequest($account_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\WebhookSubscriptionsListBody', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 503: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\WebhookSubscriptionsListBody', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\WebhookSubscriptionsListBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listWebhookSubscriptionsAsync + * + * List Webhook Subscriptions + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWebhookSubscriptions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listWebhookSubscriptionsAsync( + string $account_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listWebhookSubscriptions'][0] + ): PromiseInterface + { + return $this->listWebhookSubscriptionsAsyncWithHttpInfo($account_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listWebhookSubscriptionsAsyncWithHttpInfo + * + * List Webhook Subscriptions + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWebhookSubscriptions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listWebhookSubscriptionsAsyncWithHttpInfo( + string $account_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listWebhookSubscriptions'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\WebhookSubscriptionsListBody'; + $request = $this->listWebhookSubscriptionsRequest($account_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listWebhookSubscriptions' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listWebhookSubscriptions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listWebhookSubscriptionsRequest( + string $account_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listWebhookSubscriptions'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling listWebhookSubscriptions' + ); + } + + $resourcePath = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForlistWebhookSubscriptions(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation listWebhookSubscriptions + * + * @return array an array of host settings + */ + protected function getHostSettingsForlistWebhookSubscriptions(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation requestTollFreeVerification + * + * Request Toll-Free Verification + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\VerificationRequest $verification_request Request for verification of a toll-free phone number. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestTollFreeVerification'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\TfvError|null + */ + public function requestTollFreeVerification( + string $account_id, + \Bandwidth\Model\VerificationRequest $verification_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['requestTollFreeVerification'][0] + ): ?\Bandwidth\Model\TfvError + { + list($response) = $this->requestTollFreeVerificationWithHttpInfo($account_id, $verification_request, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation requestTollFreeVerificationWithHttpInfo + * + * Request Toll-Free Verification + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\VerificationRequest $verification_request Request for verification of a toll-free phone number. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestTollFreeVerification'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function requestTollFreeVerificationWithHttpInfo( + string $account_id, + \Bandwidth\Model\VerificationRequest $verification_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['requestTollFreeVerification'][0] + ): array + { + $request = $this->requestTollFreeVerificationRequest($account_id, $verification_request, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation requestTollFreeVerificationAsync + * + * Request Toll-Free Verification + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\VerificationRequest $verification_request Request for verification of a toll-free phone number. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestTollFreeVerification'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function requestTollFreeVerificationAsync( + string $account_id, + \Bandwidth\Model\VerificationRequest $verification_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['requestTollFreeVerification'][0] + ): PromiseInterface + { + return $this->requestTollFreeVerificationAsyncWithHttpInfo($account_id, $verification_request, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation requestTollFreeVerificationAsyncWithHttpInfo + * + * Request Toll-Free Verification + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\VerificationRequest $verification_request Request for verification of a toll-free phone number. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestTollFreeVerification'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function requestTollFreeVerificationAsyncWithHttpInfo( + string $account_id, + \Bandwidth\Model\VerificationRequest $verification_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['requestTollFreeVerification'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->requestTollFreeVerificationRequest($account_id, $verification_request, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'requestTollFreeVerification' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param \Bandwidth\Model\VerificationRequest $verification_request Request for verification of a toll-free phone number. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['requestTollFreeVerification'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function requestTollFreeVerificationRequest( + string $account_id, + \Bandwidth\Model\VerificationRequest $verification_request, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['requestTollFreeVerification'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling requestTollFreeVerification' + ); + } + // verify the required parameter 'verification_request' is set + if ($verification_request === null || (is_array($verification_request) && count($verification_request) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $verification_request when calling requestTollFreeVerification' + ); + } + + $resourcePath = '/accounts/{accountId}/tollFreeVerification'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($verification_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($verification_request)); + } else { + $httpBody = $verification_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForrequestTollFreeVerification(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation requestTollFreeVerification + * + * @return array an array of host settings + */ + protected function getHostSettingsForrequestTollFreeVerification(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation updateTollFreeVerificationRequest + * + * Update Toll-Free Verification Request + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper Update a request for verification of a toll-free phone number. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTollFreeVerificationRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\TfvError|null + */ + public function updateTollFreeVerificationRequest( + string $account_id, + string $phone_number, + \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateTollFreeVerificationRequest'][0] + ): ?\Bandwidth\Model\TfvError + { + list($response) = $this->updateTollFreeVerificationRequestWithHttpInfo($account_id, $phone_number, $tfv_submission_wrapper, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation updateTollFreeVerificationRequestWithHttpInfo + * + * Update Toll-Free Verification Request + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper Update a request for verification of a toll-free phone number. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTollFreeVerificationRequest'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateTollFreeVerificationRequestWithHttpInfo( + string $account_id, + string $phone_number, + \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateTollFreeVerificationRequest'][0] + ): array + { + $request = $this->updateTollFreeVerificationRequestRequest($account_id, $phone_number, $tfv_submission_wrapper, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateTollFreeVerificationRequestAsync + * + * Update Toll-Free Verification Request + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper Update a request for verification of a toll-free phone number. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTollFreeVerificationRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateTollFreeVerificationRequestAsync( + string $account_id, + string $phone_number, + \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateTollFreeVerificationRequest'][0] + ): PromiseInterface + { + return $this->updateTollFreeVerificationRequestAsyncWithHttpInfo($account_id, $phone_number, $tfv_submission_wrapper, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateTollFreeVerificationRequestAsyncWithHttpInfo + * + * Update Toll-Free Verification Request + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper Update a request for verification of a toll-free phone number. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTollFreeVerificationRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateTollFreeVerificationRequestAsyncWithHttpInfo( + string $account_id, + string $phone_number, + \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateTollFreeVerificationRequest'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->updateTollFreeVerificationRequestRequest($account_id, $phone_number, $tfv_submission_wrapper, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateTollFreeVerificationRequest' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $phone_number Valid Toll-Free telephone number in E.164 format. (required) + * @param \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper Update a request for verification of a toll-free phone number. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateTollFreeVerificationRequest'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateTollFreeVerificationRequestRequest( + string $account_id, + string $phone_number, + \Bandwidth\Model\TfvSubmissionWrapper $tfv_submission_wrapper, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateTollFreeVerificationRequest'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling updateTollFreeVerificationRequest' + ); + } + // verify the required parameter 'phone_number' is set + if ($phone_number === null || (is_array($phone_number) && count($phone_number) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $phone_number when calling updateTollFreeVerificationRequest' + ); + } + if (strlen($phone_number) > 12) { + throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.updateTollFreeVerificationRequest, must be smaller than or equal to 12.'); + } + if (strlen($phone_number) < 12) { + throw new InvalidArgumentException('invalid length for "$phone_number" when calling TollFreeVerificationApi.updateTollFreeVerificationRequest, must be bigger than or equal to 12.'); + } + if (!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $phone_number)) { + throw new InvalidArgumentException("invalid value for \"phone_number\" when calling TollFreeVerificationApi.updateTollFreeVerificationRequest, must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."); + } + // verify the required parameter 'tfv_submission_wrapper' is set + if ($tfv_submission_wrapper === null || (is_array($tfv_submission_wrapper) && count($tfv_submission_wrapper) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $tfv_submission_wrapper when calling updateTollFreeVerificationRequest' + ); + } + + $resourcePath = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($phone_number !== null) { + $resourcePath = str_replace( + '{phoneNumber}', + ObjectSerializer::toPathValue($phone_number), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($tfv_submission_wrapper)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($tfv_submission_wrapper)); + } else { + $httpBody = $tfv_submission_wrapper; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForupdateTollFreeVerificationRequest(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation updateTollFreeVerificationRequest + * + * @return array an array of host settings + */ + protected function getHostSettingsForupdateTollFreeVerificationRequest(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation updateWebhookSubscription + * + * Update Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $id Webhook subscription ID (required) + * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookSubscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError + */ + public function updateWebhookSubscription( + string $account_id, + string $id, + \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateWebhookSubscription'][0] + ): \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError + { + list($response) = $this->updateWebhookSubscriptionWithHttpInfo($account_id, $id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation updateWebhookSubscriptionWithHttpInfo + * + * Update Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $id Webhook subscription ID (required) + * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookSubscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\WebhookSubscription|\Bandwidth\Model\TfvError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function updateWebhookSubscriptionWithHttpInfo( + string $account_id, + string $id, + \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateWebhookSubscription'][0] + ): array + { + $request = $this->updateWebhookSubscriptionRequest($account_id, $id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\WebhookSubscription', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + case 503: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\TfvError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\WebhookSubscription', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\WebhookSubscription', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 503: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\TfvError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation updateWebhookSubscriptionAsync + * + * Update Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $id Webhook subscription ID (required) + * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookSubscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateWebhookSubscriptionAsync( + string $account_id, + string $id, + \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateWebhookSubscription'][0] + ): PromiseInterface + { + return $this->updateWebhookSubscriptionAsyncWithHttpInfo($account_id, $id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateWebhookSubscriptionAsyncWithHttpInfo + * + * Update Webhook Subscription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $id Webhook subscription ID (required) + * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookSubscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function updateWebhookSubscriptionAsyncWithHttpInfo( + string $account_id, + string $id, + \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateWebhookSubscription'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\WebhookSubscription'; + $request = $this->updateWebhookSubscriptionRequest($account_id, $id, $webhook_subscription_request_schema, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateWebhookSubscription' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://api.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $id Webhook subscription ID (required) + * @param \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateWebhookSubscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateWebhookSubscriptionRequest( + string $account_id, + string $id, + \Bandwidth\Model\WebhookSubscriptionRequestSchema $webhook_subscription_request_schema, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['updateWebhookSubscription'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling updateWebhookSubscription' + ); + } + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $id when calling updateWebhookSubscription' + ); + } + // verify the required parameter 'webhook_subscription_request_schema' is set + if ($webhook_subscription_request_schema === null || (is_array($webhook_subscription_request_schema) && count($webhook_subscription_request_schema) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $webhook_subscription_request_schema when calling updateWebhookSubscription' + ); + } + + $resourcePath = '/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{id}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($webhook_subscription_request_schema)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($webhook_subscription_request_schema)); + } else { + $httpBody = $webhook_subscription_request_schema; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new \GuzzleHttp\Psr7\MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForupdateWebhookSubscription(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation updateWebhookSubscription + * + * @return array an array of host settings + */ + protected function getHostSettingsForupdateWebhookSubscription(): array + { + return [ + [ + "url" => "https://api.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/Api/TranscriptionsApi.php b/src/Api/TranscriptionsApi.php new file mode 100644 index 0000000..424402d --- /dev/null +++ b/src/Api/TranscriptionsApi.php @@ -0,0 +1,1546 @@ + $contentTypes **/ + public const contentTypes = [ + 'deleteRealTimeTranscription' => [ + 'application/json', + ], + 'getRealTimeTranscription' => [ + 'application/json', + ], + 'listRealTimeTranscriptions' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface|null $client + * @param Configuration|null $config + * @param HeaderSelector|null $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ?ClientInterface $client = null, + ?Configuration $config = null, + ?HeaderSelector $selector = null, + int $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex(int $hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex(): int + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig(): Configuration + { + return $this->config; + } + + /** + * Operation deleteRealTimeTranscription + * + * Delete Real-time Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $transcription_id Programmable Voice API Transcription ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRealTimeTranscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\VoiceApiError|null + */ + public function deleteRealTimeTranscription( + string $account_id, + string $call_id, + string $transcription_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRealTimeTranscription'][0] + ): ?\Bandwidth\Model\VoiceApiError + { + list($response) = $this->deleteRealTimeTranscriptionWithHttpInfo($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation deleteRealTimeTranscriptionWithHttpInfo + * + * Delete Real-time Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $transcription_id Programmable Voice API Transcription ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRealTimeTranscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: null, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function deleteRealTimeTranscriptionWithHttpInfo( + string $account_id, + string $call_id, + string $transcription_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRealTimeTranscription'][0] + ): array + { + $request = $this->deleteRealTimeTranscriptionRequest($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation deleteRealTimeTranscriptionAsync + * + * Delete Real-time Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $transcription_id Programmable Voice API Transcription ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRealTimeTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteRealTimeTranscriptionAsync( + string $account_id, + string $call_id, + string $transcription_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRealTimeTranscription'][0] + ): PromiseInterface + { + return $this->deleteRealTimeTranscriptionAsyncWithHttpInfo($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteRealTimeTranscriptionAsyncWithHttpInfo + * + * Delete Real-time Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $transcription_id Programmable Voice API Transcription ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRealTimeTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function deleteRealTimeTranscriptionAsyncWithHttpInfo( + string $account_id, + string $call_id, + string $transcription_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRealTimeTranscription'][0] + ): PromiseInterface + { + $returnType = ''; + $request = $this->deleteRealTimeTranscriptionRequest($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteRealTimeTranscription' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $transcription_id Programmable Voice API Transcription ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteRealTimeTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteRealTimeTranscriptionRequest( + string $account_id, + string $call_id, + string $transcription_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['deleteRealTimeTranscription'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling deleteRealTimeTranscription' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling deleteRealTimeTranscription' + ); + } + // verify the required parameter 'transcription_id' is set + if ($transcription_id === null || (is_array($transcription_id) && count($transcription_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $transcription_id when calling deleteRealTimeTranscription' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + // path params + if ($transcription_id !== null) { + $resourcePath = str_replace( + '{transcriptionId}', + ObjectSerializer::toPathValue($transcription_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsFordeleteRealTimeTranscription(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation deleteRealTimeTranscription + * + * @return array an array of host settings + */ + protected function getHostSettingsFordeleteRealTimeTranscription(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation getRealTimeTranscription + * + * Get Real-time Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $transcription_id Programmable Voice API Transcription ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRealTimeTranscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CallTranscriptionResponse|\Bandwidth\Model\VoiceApiError + */ + public function getRealTimeTranscription( + string $account_id, + string $call_id, + string $transcription_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getRealTimeTranscription'][0] + ): \Bandwidth\Model\CallTranscriptionResponse|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->getRealTimeTranscriptionWithHttpInfo($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation getRealTimeTranscriptionWithHttpInfo + * + * Get Real-time Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $transcription_id Programmable Voice API Transcription ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRealTimeTranscription'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CallTranscriptionResponse|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function getRealTimeTranscriptionWithHttpInfo( + string $account_id, + string $call_id, + string $transcription_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getRealTimeTranscription'][0] + ): array + { + $request = $this->getRealTimeTranscriptionRequest($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallTranscriptionResponse', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallTranscriptionResponse', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CallTranscriptionResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation getRealTimeTranscriptionAsync + * + * Get Real-time Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $transcription_id Programmable Voice API Transcription ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRealTimeTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getRealTimeTranscriptionAsync( + string $account_id, + string $call_id, + string $transcription_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getRealTimeTranscription'][0] + ): PromiseInterface + { + return $this->getRealTimeTranscriptionAsyncWithHttpInfo($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getRealTimeTranscriptionAsyncWithHttpInfo + * + * Get Real-time Transcription + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $transcription_id Programmable Voice API Transcription ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRealTimeTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function getRealTimeTranscriptionAsyncWithHttpInfo( + string $account_id, + string $call_id, + string $transcription_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getRealTimeTranscription'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CallTranscriptionResponse'; + $request = $this->getRealTimeTranscriptionRequest($account_id, $call_id, $transcription_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getRealTimeTranscription' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param string $transcription_id Programmable Voice API Transcription ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRealTimeTranscription'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getRealTimeTranscriptionRequest( + string $account_id, + string $call_id, + string $transcription_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['getRealTimeTranscription'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling getRealTimeTranscription' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling getRealTimeTranscription' + ); + } + // verify the required parameter 'transcription_id' is set + if ($transcription_id === null || (is_array($transcription_id) && count($transcription_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $transcription_id when calling getRealTimeTranscription' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId}'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + // path params + if ($transcription_id !== null) { + $resourcePath = str_replace( + '{transcriptionId}', + ObjectSerializer::toPathValue($transcription_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForgetRealTimeTranscription(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation getRealTimeTranscription + * + * @return array an array of host settings + */ + protected function getHostSettingsForgetRealTimeTranscription(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Operation listRealTimeTranscriptions + * + * List Real-time Transcriptions + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRealTimeTranscriptions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return \Bandwidth\Model\CallTranscriptionMetadata[]|\Bandwidth\Model\VoiceApiError + */ + public function listRealTimeTranscriptions( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listRealTimeTranscriptions'][0] + ): array|\Bandwidth\Model\VoiceApiError + { + list($response) = $this->listRealTimeTranscriptionsWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType); + return $response; + } + + /** + * Operation listRealTimeTranscriptionsWithHttpInfo + * + * List Real-time Transcriptions + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRealTimeTranscriptions'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @return array{0: \Bandwidth\Model\CallTranscriptionMetadata[]|\Bandwidth\Model\VoiceApiError, 1: int, 2: array} [response data, HTTP status code, HTTP response headers] + */ + public function listRealTimeTranscriptionsWithHttpInfo( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listRealTimeTranscriptions'][0] + ): array + { + $request = $this->listRealTimeTranscriptionsRequest($account_id, $call_id, $hostIndex, $variables, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + switch($statusCode) { + case 200: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallTranscriptionMetadata[]', + $request, + $response, + ); + case 400: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 401: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 403: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 404: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 405: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 415: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 429: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + case 500: + return $this->handleResponseWithDataType( + '\Bandwidth\Model\VoiceApiError', + $request, + $response, + ); + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return $this->handleResponseWithDataType( + '\Bandwidth\Model\CallTranscriptionMetadata[]', + $request, + $response, + ); + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\CallTranscriptionMetadata[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 405: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 415: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Bandwidth\Model\VoiceApiError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + throw $e; + } + + throw $e; + } + } + + /** + * Operation listRealTimeTranscriptionsAsync + * + * List Real-time Transcriptions + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRealTimeTranscriptions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listRealTimeTranscriptionsAsync( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listRealTimeTranscriptions'][0] + ): PromiseInterface + { + return $this->listRealTimeTranscriptionsAsyncWithHttpInfo($account_id, $call_id, $hostIndex, $variables, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listRealTimeTranscriptionsAsyncWithHttpInfo + * + * List Real-time Transcriptions + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRealTimeTranscriptions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return PromiseInterface + */ + public function listRealTimeTranscriptionsAsyncWithHttpInfo( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listRealTimeTranscriptions'][0] + ): PromiseInterface + { + $returnType = '\Bandwidth\Model\CallTranscriptionMetadata[]'; + $request = $this->listRealTimeTranscriptionsRequest($account_id, $call_id, $hostIndex, $variables, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listRealTimeTranscriptions' + * + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. + * URL: https://voice.bandwidth.com/api/v2 + * + * @param string $account_id Your Bandwidth Account ID. (required) + * @param string $call_id Programmable Voice API Call ID. (required) + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listRealTimeTranscriptions'] to see the possible values for this operation + * + * @throws InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listRealTimeTranscriptionsRequest( + string $account_id, + string $call_id, + ?int $hostIndex = null, + array $variables = [], + string $contentType = self::contentTypes['listRealTimeTranscriptions'][0] + ): Request + { + // verify the required parameter 'account_id' is set + if ($account_id === null || (is_array($account_id) && count($account_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $account_id when calling listRealTimeTranscriptions' + ); + } + // verify the required parameter 'call_id' is set + if ($call_id === null || (is_array($call_id) && count($call_id) === 0)) { + throw new InvalidArgumentException( + 'Missing the required parameter $call_id when calling listRealTimeTranscriptions' + ); + } + + $resourcePath = '/accounts/{accountId}/calls/{callId}/transcriptions'; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + '{accountId}', + ObjectSerializer::toPathValue($account_id), + $resourcePath + ); + } + // path params + if ($call_id !== null) { + $resourcePath = str_replace( + '{callId}', + ObjectSerializer::toPathValue($call_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + // this endpoint requires OAuth (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + if ($this->config->getIgnoreOperationHosts()) { + $operationHost = $this->config->getHost(); + } else { + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; + } + + $hostSettings = $this->getHostSettingsForlistRealTimeTranscriptions(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + } + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Returns an array of host settings for Operation listRealTimeTranscriptions + * + * @return array an array of host settings + */ + protected function getHostSettingsForlistRealTimeTranscriptions(): array + { + return [ + [ + "url" => "https://voice.bandwidth.com/api/v2", + "description" => "Production", + ] + ]; + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption(): array + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } + + private function handleResponseWithDataType( + string $dataType, + RequestInterface $request, + ResponseInterface $response, + ): array { + if (in_array($dataType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($dataType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $response->getStatusCode(), + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $dataType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + private function responseWithinRangeCode( + string $rangeCode, + int $statusCode, + ): bool { + $left = (int) ($rangeCode[0].'00'); + $right = (int) ($rangeCode[0].'99'); + + return $statusCode >= $left && $statusCode <= $right; + } +} diff --git a/src/BandwidthClient.php b/src/BandwidthClient.php deleted file mode 100644 index 8e80179..0000000 --- a/src/BandwidthClient.php +++ /dev/null @@ -1,89 +0,0 @@ -config = $config; - } - - private $messaging; - private $multiFactorAuth; - private $phoneNumberLookup; - private $voice; - private $webRtc; - - /** - * Provides access to Messaging client - * @return Messaging\MessagingClient - */ - public function getMessaging() - { - if ($this->messaging == null) { - $this->messaging = new Messaging\MessagingClient($this->config); - } - return $this->messaging; - } - - /** - * Provides access to MultiFactorAuth client - * @return MultiFactorAuth\MultiFactorAuthClient - */ - public function getMultiFactorAuth() - { - if ($this->multiFactorAuth == null) { - $this->multiFactorAuth = new MultiFactorAuth\MultiFactorAuthClient($this->config); - } - return $this->multiFactorAuth; - } - - /** - * Provides access to PhoneNumberLookup client - * @return PhoneNumberLookup\PhoneNumberLookupClient - */ - public function getPhoneNumberLookup() - { - if ($this->phoneNumberLookup == null) { - $this->phoneNumberLookup = new PhoneNumberLookup\PhoneNumberLookupClient($this->config); - } - return $this->phoneNumberLookup; - } - - /** - * Provides access to Voice client - * @return Voice\VoiceClient - */ - public function getVoice() - { - if ($this->voice == null) { - $this->voice = new Voice\VoiceClient($this->config); - } - return $this->voice; - } - - /** - * Provides access to WebRtc client - * @return WebRtc\WebRtcClient - */ - public function getWebRtc() - { - if ($this->webRtc == null) { - $this->webRtc = new WebRtc\WebRtcClient($this->config); - } - return $this->webRtc; - } - -} diff --git a/src/Configuration.php b/src/Configuration.php index 2f25f72..7b638c8 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -1,384 +1,719 @@ tempFolderPath = sys_get_temp_dir(); + + // Default OAuth2 getter: reuses a cached token until it nears expiry, + // otherwise fetches a new one via the client credentials grant. + $this->accessTokenGetter = function (): string { + $tokenValid = $this->accessToken !== '' + && ($this->accessTokenExpiration === null || $this->accessTokenExpiration > time() + 60); + if ($tokenValid) { + return $this->accessToken; + } + + // Fall back to the static token when client credentials aren't set + if ($this->clientId === '' || $this->clientSecret === '') { + return $this->accessToken; + } + + $response = (new Client())->post($this->tokenUrl, [ + 'headers' => [ + 'Authorization' => 'Basic ' . base64_encode("{$this->clientId}:{$this->clientSecret}"), + 'Content-Type' => 'application/x-www-form-urlencoded', + ], + 'body' => 'grant_type=client_credentials', + 'http_errors' => false, + ]); + + if ($response->getStatusCode() !== 200) { + throw new \RuntimeException( + "Failed to obtain access token: [{$response->getStatusCode()}] " . (string) $response->getBody() + ); + } + + $body = json_decode((string) $response->getBody(), true); + $this->accessToken = $body['access_token']; + $this->accessTokenExpiration = time() + $body['expires_in']; + + return $this->accessToken; + }; + } /** - * @todo Add description for parameter - * @var string + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this */ - private $baseUrl = 'https://www.example.com'; + public function setApiKey(string $apiKeyIdentifier, string $key): static + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } - public function __construct($configOptions = null) + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey(string $apiKeyIdentifier): ?string { - if (isset($configOptions['timeout'])) { - $this->timeout = $configOptions['timeout']; - } - if (isset($configOptions['messagingBasicAuthUserName'])) { - $this->messagingBasicAuthUserName = $configOptions['messagingBasicAuthUserName']; - } - if (isset($configOptions['messagingBasicAuthPassword'])) { - $this->messagingBasicAuthPassword = $configOptions['messagingBasicAuthPassword']; - } - if (isset($configOptions['multiFactorAuthBasicAuthUserName'])) { - $this->multiFactorAuthBasicAuthUserName = $configOptions['multiFactorAuthBasicAuthUserName']; - } - if (isset($configOptions['multiFactorAuthBasicAuthPassword'])) { - $this->multiFactorAuthBasicAuthPassword = $configOptions['multiFactorAuthBasicAuthPassword']; - } - if (isset($configOptions['phoneNumberLookupBasicAuthUserName'])) { - $this->phoneNumberLookupBasicAuthUserName = $configOptions['phoneNumberLookupBasicAuthUserName']; - } - if (isset($configOptions['phoneNumberLookupBasicAuthPassword'])) { - $this->phoneNumberLookupBasicAuthPassword = $configOptions['phoneNumberLookupBasicAuthPassword']; - } - if (isset($configOptions['voiceBasicAuthUserName'])) { - $this->voiceBasicAuthUserName = $configOptions['voiceBasicAuthUserName']; - } - if (isset($configOptions['voiceBasicAuthPassword'])) { - $this->voiceBasicAuthPassword = $configOptions['voiceBasicAuthPassword']; - } - if (isset($configOptions['webRtcBasicAuthUserName'])) { - $this->webRtcBasicAuthUserName = $configOptions['webRtcBasicAuthUserName']; - } - if (isset($configOptions['webRtcBasicAuthPassword'])) { - $this->webRtcBasicAuthPassword = $configOptions['webRtcBasicAuthPassword']; - } - if (isset($configOptions['clientId'])) { - $this->clientId = $configOptions['clientId']; - } - if (isset($configOptions['clientSecret'])) { - $this->clientSecret = $configOptions['clientSecret']; - } - if (isset($configOptions['accessToken'])) { - $this->accessToken = $configOptions['accessToken']; - } - if (isset($configOptions['accessTokenExpiration'])) { - $this->accessTokenExpiration = $configOptions['accessTokenExpiration']; - } - if (isset($configOptions['environment'])) { - $this->environment = $configOptions['environment']; - } - if (isset($configOptions['baseUrl'])) { - $this->baseUrl = $configOptions['baseUrl']; - } + return $this->apiKeys[$apiKeyIdentifier] ?? null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix): static + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; } - public function getConfigurationMap() + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix(string $apiKeyIdentifier): ?string { - $configMap = array(); + return $this->apiKeyPrefixes[$apiKeyIdentifier] ?? null; + } - if (isset($this->timeout)) { - $configMap['timeout'] = $this->timeout; - } - if (isset($this->messagingBasicAuthUserName)) { - $configMap['messagingBasicAuthUserName'] = $this->messagingBasicAuthUserName; - } - if (isset($this->messagingBasicAuthPassword)) { - $configMap['messagingBasicAuthPassword'] = $this->messagingBasicAuthPassword; - } - if (isset($this->multiFactorAuthBasicAuthUserName)) { - $configMap['multiFactorAuthBasicAuthUserName'] = $this->multiFactorAuthBasicAuthUserName; - } - if (isset($this->multiFactorAuthBasicAuthPassword)) { - $configMap['multiFactorAuthBasicAuthPassword'] = $this->multiFactorAuthBasicAuthPassword; - } - if (isset($this->phoneNumberLookupBasicAuthUserName)) { - $configMap['phoneNumberLookupBasicAuthUserName'] = $this->phoneNumberLookupBasicAuthUserName; - } - if (isset($this->phoneNumberLookupBasicAuthPassword)) { - $configMap['phoneNumberLookupBasicAuthPassword'] = $this->phoneNumberLookupBasicAuthPassword; - } - if (isset($this->voiceBasicAuthUserName)) { - $configMap['voiceBasicAuthUserName'] = $this->voiceBasicAuthUserName; - } - if (isset($this->voiceBasicAuthPassword)) { - $configMap['voiceBasicAuthPassword'] = $this->voiceBasicAuthPassword; - } - if (isset($this->webRtcBasicAuthUserName)) { - $configMap['webRtcBasicAuthUserName'] = $this->webRtcBasicAuthUserName; - } - if (isset($this->webRtcBasicAuthPassword)) { - $configMap['webRtcBasicAuthPassword'] = $this->webRtcBasicAuthPassword; - } - if (isset($this->clientId)) { - $configMap['clientId'] = $this->clientId; - } - if (isset($this->clientSecret)) { - $configMap['clientSecret'] = $this->clientSecret; - } - if (isset($this->accessToken)) { - $configMap['accessToken'] = $this->accessToken; - } - if (isset($this->accessTokenExpiration)) { - $configMap['accessTokenExpiration'] = $this->accessTokenExpiration; - } - if (isset($this->environment)) { - $configMap['environment'] = $this->environment; - } - if (isset($this->baseUrl)) { - $configMap['baseUrl'] = $this->baseUrl; + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken(string $accessToken): static + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * Delegates to the access token getter when set, which may fetch or refresh + * the token (and can therefore perform a network request). Falls back to the + * static access token otherwise. + * + * @return string Access token for OAuth + */ + public function getAccessToken(): string + { + if ($this->accessTokenGetter !== null) { + return ($this->accessTokenGetter)() ?? ''; } + return $this->accessToken; + } - return $configMap; + /** + * Sets the client ID for OAuth2 client credentials authentication + * + * @param string $clientId Client ID for OAuth2 + * + * @return $this + */ + public function setClientId(string $clientId): static + { + $this->clientId = $clientId; + return $this; } - // Getter for timeout - public function getTimeout() + /** + * Gets the client ID for OAuth2 client credentials authentication + * + * @return string Client ID for OAuth2 + */ + public function getClientId(): string { - return $this->timeout; + return $this->clientId; } - // Getter for messagingBasicAuthUserName - public function getMessagingBasicAuthUserName() + /** + * Sets the client secret for OAuth2 client credentials authentication + * + * @param string $clientSecret Client secret for OAuth2 + * + * @return $this + */ + public function setClientSecret(string $clientSecret): static { - return $this->messagingBasicAuthUserName; + $this->clientSecret = $clientSecret; + return $this; } - // Getter for messagingBasicAuthPassword - public function getMessagingBasicAuthPassword() + /** + * Gets the client secret for OAuth2 client credentials authentication + * + * @return string Client secret for OAuth2 + */ + public function getClientSecret(): string { - return $this->messagingBasicAuthPassword; + return $this->clientSecret; } - // Getter for multiFactorAuthBasicAuthUserName - public function getMultiFactorAuthBasicAuthUserName() + /** + * Sets the token endpoint used to fetch an OAuth2 access token + * + * @param string $tokenUrl Token endpoint URL + * + * @return $this + */ + public function setTokenUrl(string $tokenUrl): static { - return $this->multiFactorAuthBasicAuthUserName; + $this->tokenUrl = $tokenUrl; + return $this; } - // Getter for multiFactorAuthBasicAuthPassword - public function getMultiFactorAuthBasicAuthPassword() + /** + * Gets the token endpoint used to fetch an OAuth2 access token + * + * @return string Token endpoint URL + */ + public function getTokenUrl(): string { - return $this->multiFactorAuthBasicAuthPassword; + return $this->tokenUrl; } - // Getter for phoneNumberLookupBasicAuthUserName - public function getPhoneNumberLookupBasicAuthUserName() + /** + * Sets the access token getter. Set to null to use the static access token. + * + * @param \Closure|null $accessTokenGetter Callable returning a valid access token + * + * @return $this + */ + public function setAccessTokenGetter(?\Closure $accessTokenGetter): static { - return $this->phoneNumberLookupBasicAuthUserName; + $this->accessTokenGetter = $accessTokenGetter; + return $this; } - // Getter for phoneNumberLookupBasicAuthPassword - public function getPhoneNumberLookupBasicAuthPassword() + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat): static { - return $this->phoneNumberLookupBasicAuthPassword; + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; } - // Getter for voiceBasicAuthUserName - public function getVoiceBasicAuthUserName() + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string { - return $this->voiceBasicAuthUserName; + return $this->booleanFormatForQueryString; } - // Getter for voiceBasicAuthPassword - public function getVoiceBasicAuthPassword() + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername(string $username): static { - return $this->voiceBasicAuthPassword; + $this->username = $username; + return $this; } - // Getter for webRtcBasicAuthUserName - public function getWebRtcBasicAuthUserName() + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername(): string { - return $this->webRtcBasicAuthUserName; + return $this->username; } - // Getter for webRtcBasicAuthPassword - public function getWebRtcBasicAuthPassword() + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword(string $password): static { - return $this->webRtcBasicAuthPassword; + $this->password = $password; + return $this; } - // Getter for clientId - public function getClientId() + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword(): string { - return $this->clientId; + return $this->password; } - // Getter for clientSecret - public function getClientSecret() + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost(string $host): static { - return $this->clientSecret; + $this->host = $host; + return $this; } - // Getter for accessToken - public function getAccessToken() + /** + * Gets the host + * + * @return string Host + */ + public function getHost(): string { - return $this->accessToken; + return $this->host; } - // Setter for accessToken - public function setAccessToken($value) + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws InvalidArgumentException + * @return $this + */ + public function setUserAgent(string $userAgent): static { - $this->accessToken = $value; + $this->userAgent = $userAgent; + return $this; } - // Getter for getAccessTokenExpiration - public function getAccessTokenExpiration() + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent(): string { - return $this->accessTokenExpiration; + return $this->userAgent; } - // Setter for accessTokenExpiration - public function setAccessTokenExpiration($value) + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug(bool $debug): static + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug(): bool + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile(string $debugFile): static + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile(): string { - $this->accessTokenExpiration = $value; + return $this->debugFile; } - // Getter for environment - public function getEnvironment() + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath(string $tempFolderPath): static { - return $this->environment; + $this->tempFolderPath = $tempFolderPath; + return $this; } - // Getter for baseUrl - public function getBaseUrl() + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath(): string { - return $this->baseUrl; + return $this->tempFolderPath; } /** - * Get the base uri for a given server in the current environment - * @param string $server Server name - * @return string Base URI + * Sets the ignore operation specific hosts flag + * + * @param bool $ignoreOperationHosts Ignore operation specific hosts flag + * + * @return $this */ - public function getBaseUri(string $server = Servers::DEFAULT_) + public function setIgnoreOperationHosts(bool $ignoreOperationHosts): static { - return APIHelper::appendUrlWithTemplateParameters( - static::$environmentsMap[$this->environment][$server], - array( - 'base_url' => $this->baseUrl, - ), - false - ); + $this->ignoreOperationHosts = $ignoreOperationHosts; + return $this; } /** - * A map of all baseurls used in different environments and servers - * @var array + * Gets the ignore operation specific hosts flag + * + * @return bool Ignore operation specific hosts flag */ - private static $environmentsMap = array( - Environments::PRODUCTION => array( - Servers::DEFAULT_ => 'api.bandwidth.com', - Servers::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2', - Servers::MULTIFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1', - Servers::PHONENUMBERLOOKUPDEFAULT => 'https://api.bandwidth.com/v2', - Servers::VOICEDEFAULT => 'https://voice.bandwidth.com', - Servers::WEBRTCDEFAULT => 'https://api.webrtc.bandwidth.com/v1', - ), - Environments::CUSTOM => array( - Servers::DEFAULT_ => '{base_url}', - Servers::MESSAGINGDEFAULT => '{base_url}', - Servers::MULTIFACTORAUTHDEFAULT => '{base_url}', - Servers::PHONENUMBERLOOKUPDEFAULT => '{base_url}', - Servers::VOICEDEFAULT => '{base_url}', - Servers::WEBRTCDEFAULT => '{base_url}', - ), - ); + public function getIgnoreOperationHosts(): bool + { + return $this->ignoreOperationHosts; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration(): Configuration + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config): void + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport(): string + { + $report = 'PHP SDK (Bandwidth) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 1.0.0' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix(string $apiKeyIdentifier): ?string + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings(): array + { + return [ + [ + "url" => "", + "description" => "No description provided", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, int $hostIndex, ?array $variables = null): string + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings(int $index, ?array $variables = null): string + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } } diff --git a/src/Controllers/BaseController.php b/src/Controllers/BaseController.php deleted file mode 100644 index 7a41cc3..0000000 --- a/src/Controllers/BaseController.php +++ /dev/null @@ -1,141 +0,0 @@ -config = $config; - - if (isset($httpCallBack)) { - $this->httpCallBack = $httpCallBack; - } - } - - /** - * Get HttpCallBack for this controller - * @return HttpCallBack The HttpCallBack object set for this controller - */ - public function getHttpCallBack() - { - return $this->httpCallBack; - } - - /** - * Get a new JsonMapper instance for mapping objects - * @return \apimatic\jsonmapper\JsonMapper JsonMapper instance - */ - protected function getJsonMapper() - { - $mapper = new JsonMapper(); - return $mapper; - } - - protected function validateResponse(HttpResponse $response, HttpContext $_httpContext) - { - if (($response->getStatusCode() < 200) || ($response->getStatusCode() > 208)) { //[200,208] = HTTP OK - throw new APIException('HTTP Response Not OK', $_httpContext); - } - } - - /** - * Update Auth for an HTTP request based on the current configuration - * @param array $headers The headers for the request - * @param string $authType The type of basic auth to use - */ - protected function configureAuth(&$headers, $authType) - { - if (!empty($this->config->getAccessToken()) && - (empty($this->config->getAccessTokenExpiration()) || - $this->config->getAccessTokenExpiration() > time() + 60) - ) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - return; - } - - if (!empty($this->config->getClientId()) && !empty($this->config->getClientSecret())) { - $_tokenUrl = 'https://api.bandwidth.com/api/v1/oauth2/token'; - $_tokenHeaders = array ( - 'User-Agent' => BaseController::USER_AGENT, - 'Content-Type' => 'application/x-www-form-urlencoded', - 'Authorization' => 'Basic ' . base64_encode( - $this->config->getClientId() . ':' . $this->config->getClientSecret() - ) - ); - $_tokenBody = Request\Body::Form([ - 'grant_type' => 'client_credentials' - ]); - $response = Request::post($_tokenUrl, $_tokenHeaders, $_tokenBody); - $this->config->setAccessToken($response->body->access_token); - $this->config->setAccessTokenExpiration(time() + $response->body->expires_in); - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - - return; - } - - $username = ''; - $password = ''; - - switch ($authType) { - case 'messaging': - $username = $this->config->getMessagingBasicAuthUserName(); - $password = $this->config->getMessagingBasicAuthPassword(); - break; - case 'voice': - $username = $this->config->getVoiceBasicAuthUserName(); - $password = $this->config->getVoiceBasicAuthPassword(); - break; - case 'webrtc': - $username = $this->config->getWebRtcBasicAuthUserName(); - $password = $this->config->getWebRtcBasicAuthPassword(); - break; - case 'phoneNumberLookup': - $username = $this->config->getPhoneNumberLookupBasicAuthUserName(); - $password = $this->config->getPhoneNumberLookupBasicAuthPassword(); - break; - case 'multiFactorAuth': - $username = $this->config->getMultiFactorAuthBasicAuthUserName(); - $password = $this->config->getMultiFactorAuthBasicAuthPassword(); - break; - } - - Request::auth($username, $password); - } -} diff --git a/src/Environments.php b/src/Environments.php deleted file mode 100644 index 418ec49..0000000 --- a/src/Environments.php +++ /dev/null @@ -1,24 +0,0 @@ - $values the value of the form parameter + * + * @return array [key => value] of formdata + */ + public function prepare(array $values): array + { + $this->has_file = false; + $result = []; + + foreach ($values as $k => $v) { + if ($v === null) { + continue; + } + + $result[$k] = $this->makeFormSafe($v); + } + + return $result; + } + + /** + * Flattens a multi-level array of data and generates a single-level array + * compatible with formdata - a single-level array where the keys use bracket + * notation to signify nested data. + * + * credit: https://github.com/FranBar1966/FlatPHP + */ + public static function flatten(array $source, string $start = ''): array + { + $opt = [ + 'prefix' => '[', + 'suffix' => ']', + 'suffix-end' => true, + 'prefix-list' => '[', + 'suffix-list' => ']', + 'suffix-list-end' => true, + ]; + + if ($start === '') { + $currentPrefix = ''; + $currentSuffix = ''; + $currentSuffixEnd = false; + } elseif (array_is_list($source)) { + $currentPrefix = $opt['prefix-list']; + $currentSuffix = $opt['suffix-list']; + $currentSuffixEnd = $opt['suffix-list-end']; + } else { + $currentPrefix = $opt['prefix']; + $currentSuffix = $opt['suffix']; + $currentSuffixEnd = $opt['suffix-end']; + } + + $currentName = $start; + $result = []; + + foreach ($source as $key => $val) { + $currentName .= $currentPrefix . $key; + + if (is_array($val) && !empty($val)) { + $currentName .= $currentSuffix; + $result += self::flatten($val, $currentName); + } else { + if ($currentSuffixEnd) { + $currentName .= $currentSuffix; + } + + if (is_resource($val)) { + $result[$currentName] = $val; + } else { + $result[$currentName] = ObjectSerializer::toString($val); + } + } + + $currentName = $start; + } + + return $result; + } + + /** + * formdata must be limited to scalars or arrays of scalar values, + * or a resource for a file upload. Here we iterate through all available + * data and identify how to handle each scenario + * + * @param string|bool|array|DateTime|ArrayAccess|SplFileObject $value + */ + protected function makeFormSafe(mixed $value) + { + if ($value instanceof SplFileObject) { + return $this->processFiles([$value])[0]; + } + + if (is_resource($value)) { + $this->has_file = true; + + return $value; + } + + if ($value instanceof ModelInterface) { + return $this->processModel($value); + } + + if (is_array($value) || is_object($value)) { + $data = []; + + foreach ($value as $k => $v) { + $data[$k] = $this->makeFormSafe($v); + } + + return $data; + } + + return ObjectSerializer::toString($value); + } + + /** + * We are able to handle nested ModelInterface. We do not simply call + * json_decode(json_encode()) because any given model may have binary data + * or other data that cannot be serialized to a JSON string + */ + protected function processModel(ModelInterface $model): array + { + $result = []; + + foreach ($model::openAPITypes() as $name => $type) { + $value = $model->offsetGet($name); + + if ($value === null) { + continue; + } + + if (str_contains($type, '\SplFileObject')) { + $file = is_array($value) ? $value : [$value]; + $result[$name] = $this->processFiles($file); + + continue; + } + + if ($value instanceof ModelInterface) { + $result[$name] = $this->processModel($value); + + continue; + } + + if (is_array($value) || is_object($value)) { + $result[$name] = $this->makeFormSafe($value); + + continue; + } + + $result[$name] = ObjectSerializer::toString($value); + } + + return $result; + } + + /** + * Handle file data + */ + protected function processFiles(array $files): array + { + $this->has_file = true; + + $result = []; + + foreach ($files as $i => $file) { + if (is_array($file)) { + $result[$i] = $this->processFiles($file); + + continue; + } + + if ($file instanceof StreamInterface) { + $result[$i] = $file; + + continue; + } + + if ($file instanceof SplFileObject) { + $result[$i] = $this->tryFopen($file); + } + } + + return $result; + } + + private function tryFopen(SplFileObject $file) + { + return Utils::tryFopen($file->getRealPath(), 'rb'); + } +} diff --git a/src/HeaderSelector.php b/src/HeaderSelector.php new file mode 100644 index 0000000..4884754 --- /dev/null +++ b/src/HeaderSelector.php @@ -0,0 +1,244 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/src/Http/ApiResponse.php b/src/Http/ApiResponse.php deleted file mode 100644 index 0da47ee..0000000 --- a/src/Http/ApiResponse.php +++ /dev/null @@ -1,72 +0,0 @@ -statusCode = $statusCode; - $this->headers = $headers; - $this->result = $result; - } - - /** - * Get status code - * @return int Status code - */ - public function getStatusCode() - { - return $this->statusCode; - } - - /** - * Get headers - * @return array Map of headers - */ - public function getHeaders() - { - return $this->headers; - } - - /** - * Get API call result or body - * @return mixed Deserialized response body - */ - public function getResult() - { - return $this->result; - } -} diff --git a/src/Http/HttpCallBack.php b/src/Http/HttpCallBack.php deleted file mode 100644 index eb0cc1e..0000000 --- a/src/Http/HttpCallBack.php +++ /dev/null @@ -1,95 +0,0 @@ -onBeforeRequest = $onBeforeRequest; - $this->onAfterRequest = $onAfterRequest; - } - - /** - * Set on-before event callback - * @param callable $func On-before event callable - */ - public function setOnBeforeRequest(callable $func) - { - $this->onBeforeRequest = $func; - } - - /** - * Get On-before API call event callable - * @return callable Callable - */ - public function getOnBeforeRequest() - { - return $this->onBeforeRequest; - } - - /** - * Set On-after API call event callable - * @param callable $func On-after event callable - */ - public function setOnAfterRequest(callable $func) - { - $this->onAfterRequest = $func; - } - - /** - * Get On-After API call event callable - * @return callable On-after event callable - */ - public function getOnAfterRequest() - { - return $this->onAfterRequest; - } - - /** - * Call on-before event callable - * @param HttpRequest $httpRequest HttpRequest for this call - */ - public function callOnBeforeRequest(HttpRequest $httpRequest) - { - if ($this->onBeforeRequest != null) { - call_user_func($this->onBeforeRequest, $httpRequest); - } - } - - /** - * Call on-after event callable - * @param HttpContext $httpContext HttpRequest for this call - */ - public function callOnAfterRequest(HttpContext $httpContext) - { - if ($this->onAfterRequest != null) { - call_user_func($this->onAfterRequest, $httpContext); - } - } -} diff --git a/src/Http/HttpContext.php b/src/Http/HttpContext.php deleted file mode 100644 index 48ae7e0..0000000 --- a/src/Http/HttpContext.php +++ /dev/null @@ -1,55 +0,0 @@ -request = $request; - $this->response = $response; - } - - /** - * Getter for the Http Request - * @return HttpRequest request - */ - public function getRequest() - { - return $this->request; - } - - /** - * Getter for the Http Response - * @return HttpResponse response - */ - public function getResponse() - { - return $this->response; - } -} diff --git a/src/Http/HttpMethod.php b/src/Http/HttpMethod.php deleted file mode 100644 index 6293d93..0000000 --- a/src/Http/HttpMethod.php +++ /dev/null @@ -1,21 +0,0 @@ -httpMethod = $httpMethod; - $this->headers = $headers; - $this->queryUrl = $queryUrl; - $this->parameters = $parameters; - } - - /** - * Get http method - * @return string - */ - public function getHttpMethod() - { - return $this->httpMethod; - } - - /** - * Set http method - * @param string $httpMethod Http Method as defined in HttpMethod class - */ - public function setHttpMethod(string $httpMethod) - { - $this->httpMethod = $httpMethod; - } - - /** - * Get headers - * @return array Map of headers - */ - public function getHeaders() - { - return $this->headers; - } - - /** - * Set headers - * @param array $headers Headers as map - */ - public function setHeaders(array $headers) - { - $this->headers = $headers; - } - - /** - * Get query url - * @return string Query url - */ - public function getQueryUrl() - { - return $this->queryUrl; - } - - /** - * Set query url - * @param string $queryUrl Query url - */ - public function setQueryUrl(string $queryUrl) - { - $this->queryUrl = $queryUrl; - } - - /** - * Get parameters - * @return array Map of input parameters - */ - public function getParameters() - { - return $this->parameters; - } - - /** - * Set parameters - * @param array $parameters Map of input parameters - */ - public function setParameters(array $parameters) - { - $this->parameters = $parameters; - } -} diff --git a/src/Http/HttpResponse.php b/src/Http/HttpResponse.php deleted file mode 100644 index 361bd50..0000000 --- a/src/Http/HttpResponse.php +++ /dev/null @@ -1,72 +0,0 @@ -statusCode = $statusCode; - $this->headers = $headers; - $this->rawBody = $rawBody; - } - - /** - * Get status code - * @return int Status code - */ - public function getStatusCode() - { - return $this->statusCode; - } - - /** - * Get headers - * @return array Map of headers - */ - public function getHeaders() - { - return $this->headers; - } - - /** - * Get raw response body - * @return string Raw body - */ - public function getRawBody() - { - return $this->rawBody; - } -} diff --git a/src/Messaging/Controllers/APIController.php b/src/Messaging/Controllers/APIController.php deleted file mode 100644 index d087337..0000000 --- a/src/Messaging/Controllers/APIController.php +++ /dev/null @@ -1,615 +0,0 @@ - $accountId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'Continuation-Token' => $continuationToken - ); - - //set authentication - $this->configureAuth($_headers, 'messaging'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); - } - - if ($response->code == 401) { - throw new Exceptions\MessagingException( - '401 The specified user does not have access to the account', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); - } - - if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); - } - - if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClassArray($response->body, 'BandwidthLib\\Messaging\\Models\\Media'); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Downloads a media file you previously uploaded. - * - * @param string $accountId User's account ID - * @param string $mediaId Media ID to retrieve - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getMedia( - string $accountId, - string $mediaId - ) { - - //prepare query string for API call - $_queryBuilder = '/users/{accountId}/media/{mediaId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'mediaId' => $mediaId, - ), false - ); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT - ); - - //set authentication - $this->configureAuth($_headers, 'messaging'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); - } - - if ($response->code == 401) { - throw new Exceptions\MessagingException( - '401 The specified user does not have access to the account', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); - } - - if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); - } - - if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $deserializedResponse = $response->body; - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * 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 string $accountId User's account ID - * @param string $mediaId The user supplied custom media ID - * @param string $body TODO: type description here - * @param string $contentType (optional) The media type of the entity-body - * @param string|null $cacheControl (optional) General-header field is used to specify directives that MUST be obeyed - * by all caching mechanisms along the request/response chain. - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function uploadMedia( - string $accountId, - string $mediaId, - string $body, - string $contentType = 'application/octet-stream', - ?string $cacheControl = null - ) { - - //prepare query string for API call - $_queryBuilder = '/users/{accountId}/media/{mediaId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'mediaId' => $mediaId, - ), false - ); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Content-Type' => (null != $contentType) ? $contentType : 'application/octet-stream', - 'Cache-Control' => $cacheControl - ); - - //json encode body - $_bodyJson = $body; - - //set authentication - $this->configureAuth($_headers, 'messaging'); - - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); - } - - if ($response->code == 401) { - throw new Exceptions\MessagingException( - '401 The specified user does not have access to the account', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); - } - - if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); - } - - if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, 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 string $accountId User's account ID - * @param string $mediaId The media ID to delete - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function deleteMedia( - string $accountId, - string $mediaId - ) { - - //prepare query string for API call - $_queryBuilder = '/users/{accountId}/media/{mediaId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'mediaId' => $mediaId, - ), false - ); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT - ); - - //set authentication - $this->configureAuth($_headers, 'messaging'); - - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); - } - - if ($response->code == 401) { - throw new Exceptions\MessagingException( - '401 The specified user does not have access to the account', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); - } - - if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); - } - - if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Gets a list of messages based on query parameters. - * - * @param string $accountId User's account ID - * @param string|null $messageId (optional) The ID of the message to search for. Special characters need to be - * encoded using URL encoding - * @param string|null $sourceTn (optional) The phone number that sent the message - * @param string|null $destinationTn (optional) The phone number that received the message - * @param string|null $messageStatus (optional) The status of the message. One of RECEIVED, QUEUED, SENDING, SENT, - * FAILED, DELIVERED, ACCEPTED, UNDELIVERED - * @param integer|null $errorCode (optional) The error code of the message - * @param string|null $fromDateTime (optional) 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 string|null $toDateTime (optional) 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 string|null $pageToken (optional) A base64 encoded value used for pagination of results - * @param integer|null $limit (optional) The maximum records requested in search result. Default 100. The sum of - * limit and after cannot be more than 10000 - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getMessages( - string $accountId, - ?string $messageId = null, - ?string $sourceTn = null, - ?string $destinationTn = null, - ?string $messageStatus = null, - ?int $errorCode = null, - ?string $fromDateTime = null, - ?string $toDateTime = null, - ?string $pageToken = null, - ?int $limit = null - ) { - - //prepare query string for API call - $_queryBuilder = '/users/{accountId}/messages'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - )); - - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'messageId' => $messageId, - 'sourceTn' => $sourceTn, - 'destinationTn' => $destinationTn, - 'messageStatus' => $messageStatus, - 'errorCode' => $errorCode, - 'fromDateTime' => $fromDateTime, - 'toDateTime' => $toDateTime, - 'pageToken' => $pageToken, - 'limit' => $limit, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'messaging'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); - } - - if ($response->code == 401) { - throw new Exceptions\MessagingException( - '401 The specified user does not have access to the account', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); - } - - if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); - } - - if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\Messaging\\Models\\BandwidthMessagesList' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Endpoint for sending text messages and picture messages using V2 messaging. - * - * @param string $accountId User's account ID - * @param Models\MessageRequest $body TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function createMessage( - string $accountId, - Models\MessageRequest $body - ) { - - //prepare query string for API call - $_queryBuilder = '/users/{accountId}/messages'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'messaging'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); - } - - if ($response->code == 401) { - throw new Exceptions\MessagingException( - '401 The specified user does not have access to the account', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); - } - - if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); - } - - if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass($response->body, 'BandwidthLib\\Messaging\\Models\\BandwidthMessage'); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } -} diff --git a/src/Messaging/Exceptions/MessagingException.php b/src/Messaging/Exceptions/MessagingException.php deleted file mode 100644 index 238368f..0000000 --- a/src/Messaging/Exceptions/MessagingException.php +++ /dev/null @@ -1,46 +0,0 @@ -config = $config; - } - - - private $client; - - /** - * Provides access to API controller - * @return Controllers\APIController - */ - public function getClient() - { - if ($this->client == null) { - $this->client = new Controllers\APIController($this->config); - } - return $this->client; - } -} diff --git a/src/Messaging/Models/BandwidthCallbackMessage.php b/src/Messaging/Models/BandwidthCallbackMessage.php deleted file mode 100644 index ca22d91..0000000 --- a/src/Messaging/Models/BandwidthCallbackMessage.php +++ /dev/null @@ -1,81 +0,0 @@ -time = func_get_arg(0); - $this->type = func_get_arg(1); - $this->to = func_get_arg(2); - $this->errorCode = func_get_arg(3); - $this->description = func_get_arg(4); - $this->message = func_get_arg(5); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['time'] = $this->time; - $json['type'] = $this->type; - $json['to'] = $this->to; - $json['errorCode'] = $this->errorCode; - $json['description'] = $this->description; - $json['message'] = $this->message; - - return array_filter($json); - } -} diff --git a/src/Messaging/Models/BandwidthMessage.php b/src/Messaging/Models/BandwidthMessage.php deleted file mode 100644 index 2e0bc0c..0000000 --- a/src/Messaging/Models/BandwidthMessage.php +++ /dev/null @@ -1,134 +0,0 @@ -id = func_get_arg(0); - $this->owner = func_get_arg(1); - $this->applicationId = func_get_arg(2); - $this->time = func_get_arg(3); - $this->segmentCount = func_get_arg(4); - $this->direction = func_get_arg(5); - $this->to = func_get_arg(6); - $this->from = func_get_arg(7); - $this->media = func_get_arg(8); - $this->text = func_get_arg(9); - $this->tag = func_get_arg(10); - $this->priority = func_get_arg(11); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['id'] = $this->id; - $json['owner'] = $this->owner; - $json['applicationId'] = $this->applicationId; - $json['time'] = $this->time; - $json['segmentCount'] = $this->segmentCount; - $json['direction'] = $this->direction; - $json['to'] = isset($this->to) ? - array_values($this->to) : null; - $json['from'] = $this->from; - $json['media'] = isset($this->media) ? - array_values($this->media) : null; - $json['text'] = $this->text; - $json['tag'] = $this->tag; - $json['priority'] = $this->priority; - - return array_filter($json); - } -} diff --git a/src/Messaging/Models/BandwidthMessageItem.php b/src/Messaging/Models/BandwidthMessageItem.php deleted file mode 100644 index 2165544..0000000 --- a/src/Messaging/Models/BandwidthMessageItem.php +++ /dev/null @@ -1,161 +0,0 @@ -messageId = func_get_arg(0); - $this->accountId = func_get_arg(1); - $this->sourceTn = func_get_arg(2); - $this->destinationTn = func_get_arg(3); - $this->messageStatus = func_get_arg(4); - $this->messageDirection = func_get_arg(5); - $this->messageType = func_get_arg(6); - $this->segmentCount = func_get_arg(7); - $this->errorCode = func_get_arg(8); - $this->receiveTime = func_get_arg(9); - $this->carrierName = func_get_arg(10); - $this->messageSize = func_get_arg(11); - $this->messageLength = func_get_arg(12); - $this->attachmentCount = func_get_arg(13); - $this->recipientCount = func_get_arg(14); - $this->campaignClass = func_get_arg(15); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['messageId'] = $this->messageId; - $json['accountId'] = $this->accountId; - $json['sourceTn'] = $this->sourceTn; - $json['destinationTn'] = $this->destinationTn; - $json['messageStatus'] = $this->messageStatus; - $json['messageDirection'] = $this->messageDirection; - $json['messageType'] = $this->messageType; - $json['segmentCount'] = $this->segmentCount; - $json['errorCode'] = $this->errorCode; - $json['receiveTime'] = $this->receiveTime; - $json['carrierName'] = $this->carrierName; - $json['messageSize'] = $this->messageSize; - $json['messageLength'] = $this->messageLength; - $json['attachmentCount'] = $this->attachmentCount; - $json['recipientCount'] = $this->recipientCount; - $json['campaignClass'] = $this->campaignClass; - - return array_filter($json); - } -} diff --git a/src/Messaging/Models/BandwidthMessagesList.php b/src/Messaging/Models/BandwidthMessagesList.php deleted file mode 100644 index 8b4dc44..0000000 --- a/src/Messaging/Models/BandwidthMessagesList.php +++ /dev/null @@ -1,58 +0,0 @@ -totalCount = func_get_arg(0); - $this->pageInfo = func_get_arg(1); - $this->messages = func_get_arg(2); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['totalCount'] = $this->totalCount; - $json['pageInfo'] = $this->pageInfo; - $json['messages'] = isset($this->messages) ? - array_values($this->messages) : null; - - return array_filter($json); - } -} diff --git a/src/Messaging/Models/DeferredResult.php b/src/Messaging/Models/DeferredResult.php deleted file mode 100644 index 70c71d7..0000000 --- a/src/Messaging/Models/DeferredResult.php +++ /dev/null @@ -1,49 +0,0 @@ -result = func_get_arg(0); - $this->setOrExpired = func_get_arg(1); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['result'] = $this->result; - $json['setOrExpired'] = $this->setOrExpired; - - return array_filter($json); - } -} diff --git a/src/Messaging/Models/Media.php b/src/Messaging/Models/Media.php deleted file mode 100644 index 942cd45..0000000 --- a/src/Messaging/Models/Media.php +++ /dev/null @@ -1,57 +0,0 @@ -content = func_get_arg(0); - $this->contentLength = func_get_arg(1); - $this->mediaName = func_get_arg(2); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['content'] = $this->content; - $json['contentLength'] = $this->contentLength; - $json['mediaName'] = $this->mediaName; - - return array_filter($json); - } -} diff --git a/src/Messaging/Models/MessageRequest.php b/src/Messaging/Models/MessageRequest.php deleted file mode 100644 index 08ddbc9..0000000 --- a/src/Messaging/Models/MessageRequest.php +++ /dev/null @@ -1,95 +0,0 @@ -applicationId = func_get_arg(0); - $this->to = func_get_arg(1); - $this->from = func_get_arg(2); - $this->text = func_get_arg(3); - $this->media = func_get_arg(4); - $this->tag = func_get_arg(5); - $this->priority = func_get_arg(6); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['applicationId'] = $this->applicationId; - $json['to'] = array_values($this->to); - $json['from'] = $this->from; - $json['text'] = $this->text; - $json['media'] = isset($this->media) ? - array_values($this->media) : null; - $json['tag'] = $this->tag; - $json['priority'] = $this->priority; - - return array_filter($json); - } -} diff --git a/src/Messaging/Models/PageInfo.php b/src/Messaging/Models/PageInfo.php deleted file mode 100644 index 2250bf7..0000000 --- a/src/Messaging/Models/PageInfo.php +++ /dev/null @@ -1,65 +0,0 @@ -prevPage = func_get_arg(0); - $this->nextPage = func_get_arg(1); - $this->prevPageToken = func_get_arg(2); - $this->nextPageToken = func_get_arg(3); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['prevPage'] = $this->prevPage; - $json['nextPage'] = $this->nextPage; - $json['prevPageToken'] = $this->prevPageToken; - $json['nextPageToken'] = $this->nextPageToken; - - return array_filter($json); - } -} diff --git a/src/Messaging/Models/PriorityEnum.php b/src/Messaging/Models/PriorityEnum.php deleted file mode 100644 index 7215ad9..0000000 --- a/src/Messaging/Models/PriorityEnum.php +++ /dev/null @@ -1,25 +0,0 @@ -key = func_get_arg(0); - $this->value = func_get_arg(1); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['key'] = $this->key; - $json['value'] = $this->value; - - return array_filter($json); - } -} diff --git a/src/Model/AccountStatistics.php b/src/Model/AccountStatistics.php new file mode 100644 index 0000000..a4a65fa --- /dev/null +++ b/src/Model/AccountStatistics.php @@ -0,0 +1,418 @@ + + */ +class AccountStatistics implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'accountStatistics'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'current_call_queue_size' => 'int', + 'max_call_queue_size' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'current_call_queue_size' => null, + 'max_call_queue_size' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'current_call_queue_size' => false, + 'max_call_queue_size' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'current_call_queue_size' => 'currentCallQueueSize', + 'max_call_queue_size' => 'maxCallQueueSize' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'current_call_queue_size' => 'setCurrentCallQueueSize', + 'max_call_queue_size' => 'setMaxCallQueueSize' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'current_call_queue_size' => 'getCurrentCallQueueSize', + 'max_call_queue_size' => 'getMaxCallQueueSize' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('current_call_queue_size', $data ?? [], null); + $this->setIfExists('max_call_queue_size', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets current_call_queue_size + * + * @return int|null + */ + public function getCurrentCallQueueSize(): ?int + { + return $this->container['current_call_queue_size']; + } + + /** + * Sets current_call_queue_size + * + * @param int|null $current_call_queue_size The number of calls currently enqueued. + * + * @return $this + */ + public function setCurrentCallQueueSize(?int $current_call_queue_size): static + { + if (is_null($current_call_queue_size)) { + throw new InvalidArgumentException('non-nullable current_call_queue_size cannot be null'); + } + $this->container['current_call_queue_size'] = $current_call_queue_size; + + return $this; + } + + /** + * Gets max_call_queue_size + * + * @return int|null + */ + public function getMaxCallQueueSize(): ?int + { + return $this->container['max_call_queue_size']; + } + + /** + * Sets max_call_queue_size + * + * @param int|null $max_call_queue_size The maximum size of the queue before outgoing calls start being rejected. + * + * @return $this + */ + public function setMaxCallQueueSize(?int $max_call_queue_size): static + { + if (is_null($max_call_queue_size)) { + throw new InvalidArgumentException('non-nullable max_call_queue_size cannot be null'); + } + $this->container['max_call_queue_size'] = $max_call_queue_size; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AdditionalDenialReason.php b/src/Model/AdditionalDenialReason.php new file mode 100644 index 0000000..9da7a3b --- /dev/null +++ b/src/Model/AdditionalDenialReason.php @@ -0,0 +1,461 @@ + + */ +class AdditionalDenialReason implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'additionalDenialReason'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'status_code' => 'int', + 'reason' => 'string', + 'resubmit_allowed' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'status_code' => null, + 'reason' => null, + 'resubmit_allowed' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'status_code' => false, + 'reason' => false, + 'resubmit_allowed' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'status_code' => 'statusCode', + 'reason' => 'reason', + 'resubmit_allowed' => 'resubmitAllowed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'status_code' => 'setStatusCode', + 'reason' => 'setReason', + 'resubmit_allowed' => 'setResubmitAllowed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'status_code' => 'getStatusCode', + 'reason' => 'getReason', + 'resubmit_allowed' => 'getResubmitAllowed' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('status_code', $data ?? [], null); + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('resubmit_allowed', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['status_code'] === null) { + $invalidProperties[] = "'status_code' can't be null"; + } + if ($this->container['reason'] === null) { + $invalidProperties[] = "'reason' can't be null"; + } + if ($this->container['resubmit_allowed'] === null) { + $invalidProperties[] = "'resubmit_allowed' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets status_code + * + * @return int + */ + public function getStatusCode(): int + { + return $this->container['status_code']; + } + + /** + * Sets status_code + * + * @param int $status_code Reason code for denial. + * + * @return $this + */ + public function setStatusCode(int $status_code): static + { + if (is_null($status_code)) { + throw new InvalidArgumentException('non-nullable status_code cannot be null'); + } + $this->container['status_code'] = $status_code; + + return $this; + } + + /** + * Gets reason + * + * @return string + */ + public function getReason(): string + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string $reason Explanation for why a verification request was declined. + * + * @return $this + */ + public function setReason(string $reason): static + { + if (is_null($reason)) { + throw new InvalidArgumentException('non-nullable reason cannot be null'); + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets resubmit_allowed + * + * @return bool + */ + public function getResubmitAllowed(): bool + { + return $this->container['resubmit_allowed']; + } + + /** + * Sets resubmit_allowed + * + * @param bool $resubmit_allowed Whether a Toll-Free Verification request qualifies for resubmission via PUT. + * + * @return $this + */ + public function setResubmitAllowed(bool $resubmit_allowed): static + { + if (is_null($resubmit_allowed)) { + throw new InvalidArgumentException('non-nullable resubmit_allowed cannot be null'); + } + $this->container['resubmit_allowed'] = $resubmit_allowed; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Address.php b/src/Model/Address.php new file mode 100644 index 0000000..db6710a --- /dev/null +++ b/src/Model/Address.php @@ -0,0 +1,712 @@ + + */ +class Address implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'address'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'name' => 'string', + 'addr1' => 'string', + 'addr2' => 'string', + 'city' => 'string', + 'state' => 'string', + 'zip' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'name' => null, + 'addr1' => null, + 'addr2' => null, + 'city' => null, + 'state' => null, + 'zip' => null, + 'url' => 'url' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'name' => false, + 'addr1' => false, + 'addr2' => true, + 'city' => false, + 'state' => false, + 'zip' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'name' => 'name', + 'addr1' => 'addr1', + 'addr2' => 'addr2', + 'city' => 'city', + 'state' => 'state', + 'zip' => 'zip', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'name' => 'setName', + 'addr1' => 'setAddr1', + 'addr2' => 'setAddr2', + 'city' => 'setCity', + 'state' => 'setState', + 'zip' => 'setZip', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'name' => 'getName', + 'addr1' => 'getAddr1', + 'addr2' => 'getAddr2', + 'city' => 'getCity', + 'state' => 'getState', + 'zip' => 'getZip', + 'url' => 'getUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('addr1', $data ?? [], null); + $this->setIfExists('addr2', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('zip', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ((mb_strlen($this->container['name']) > 500)) { + $invalidProperties[] = "invalid value for 'name', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['name']) < 1)) { + $invalidProperties[] = "invalid value for 'name', the character length must be bigger than or equal to 1."; + } + + if ($this->container['addr1'] === null) { + $invalidProperties[] = "'addr1' can't be null"; + } + if ((mb_strlen($this->container['addr1']) > 500)) { + $invalidProperties[] = "invalid value for 'addr1', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['addr1']) < 1)) { + $invalidProperties[] = "invalid value for 'addr1', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['addr2']) && (mb_strlen($this->container['addr2']) > 500)) { + $invalidProperties[] = "invalid value for 'addr2', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['addr2']) && (mb_strlen($this->container['addr2']) < 0)) { + $invalidProperties[] = "invalid value for 'addr2', the character length must be bigger than or equal to 0."; + } + + if ($this->container['city'] === null) { + $invalidProperties[] = "'city' can't be null"; + } + if ((mb_strlen($this->container['city']) > 500)) { + $invalidProperties[] = "invalid value for 'city', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['city']) < 1)) { + $invalidProperties[] = "invalid value for 'city', the character length must be bigger than or equal to 1."; + } + + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + if ((mb_strlen($this->container['state']) > 500)) { + $invalidProperties[] = "invalid value for 'state', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['state']) < 1)) { + $invalidProperties[] = "invalid value for 'state', the character length must be bigger than or equal to 1."; + } + + if ($this->container['zip'] === null) { + $invalidProperties[] = "'zip' can't be null"; + } + if (!preg_match("/[- A-Za-z0-9]{0,500}/", $this->container['zip'])) { + $invalidProperties[] = "invalid value for 'zip', must be conform to the pattern /[- A-Za-z0-9]{0,500}/."; + } + + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + if ((mb_strlen($this->container['url']) > 500)) { + $invalidProperties[] = "invalid value for 'url', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['url']) < 1)) { + $invalidProperties[] = "invalid value for 'url', the character length must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName(): string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The name of the business using the toll-free number. + * + * @return $this + */ + public function setName(string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + if ((mb_strlen($name) > 500)) { + throw new InvalidArgumentException('invalid length for $name when calling Address., must be smaller than or equal to 500.'); + } + if ((mb_strlen($name) < 1)) { + throw new InvalidArgumentException('invalid length for $name when calling Address., must be bigger than or equal to 1.'); + } + + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets addr1 + * + * @return string + */ + public function getAddr1(): string + { + return $this->container['addr1']; + } + + /** + * Sets addr1 + * + * @param string $addr1 The address of the business using the toll-free number. + * + * @return $this + */ + public function setAddr1(string $addr1): static + { + if (is_null($addr1)) { + throw new InvalidArgumentException('non-nullable addr1 cannot be null'); + } + if ((mb_strlen($addr1) > 500)) { + throw new InvalidArgumentException('invalid length for $addr1 when calling Address., must be smaller than or equal to 500.'); + } + if ((mb_strlen($addr1) < 1)) { + throw new InvalidArgumentException('invalid length for $addr1 when calling Address., must be bigger than or equal to 1.'); + } + + $this->container['addr1'] = $addr1; + + return $this; + } + + /** + * Gets addr2 + * + * @return string|null + */ + public function getAddr2(): ?string + { + return $this->container['addr2']; + } + + /** + * Sets addr2 + * + * @param string|null $addr2 The address of the business using the toll-free number. + * + * @return $this + */ + public function setAddr2(?string $addr2): static + { + if (is_null($addr2)) { + array_push($this->openAPINullablesSetToNull, 'addr2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('addr2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($addr2) && (mb_strlen($addr2) > 500)) { + throw new InvalidArgumentException('invalid length for $addr2 when calling Address., must be smaller than or equal to 500.'); + } + if (!is_null($addr2) && (mb_strlen($addr2) < 0)) { + throw new InvalidArgumentException('invalid length for $addr2 when calling Address., must be bigger than or equal to 0.'); + } + + $this->container['addr2'] = $addr2; + + return $this; + } + + /** + * Gets city + * + * @return string + */ + public function getCity(): string + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string $city The city of the business using the toll-free number. + * + * @return $this + */ + public function setCity(string $city): static + { + if (is_null($city)) { + throw new InvalidArgumentException('non-nullable city cannot be null'); + } + if ((mb_strlen($city) > 500)) { + throw new InvalidArgumentException('invalid length for $city when calling Address., must be smaller than or equal to 500.'); + } + if ((mb_strlen($city) < 1)) { + throw new InvalidArgumentException('invalid length for $city when calling Address., must be bigger than or equal to 1.'); + } + + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets state + * + * @return string + */ + public function getState(): string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string $state The state of the business using the toll-free number. + * + * @return $this + */ + public function setState(string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + if ((mb_strlen($state) > 500)) { + throw new InvalidArgumentException('invalid length for $state when calling Address., must be smaller than or equal to 500.'); + } + if ((mb_strlen($state) < 1)) { + throw new InvalidArgumentException('invalid length for $state when calling Address., must be bigger than or equal to 1.'); + } + + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets zip + * + * @return string + */ + public function getZip(): string + { + return $this->container['zip']; + } + + /** + * Sets zip + * + * @param string $zip The zip of the business using the toll-free number. + * + * @return $this + */ + public function setZip(string $zip): static + { + if (is_null($zip)) { + throw new InvalidArgumentException('non-nullable zip cannot be null'); + } + + if ((!preg_match("/[- A-Za-z0-9]{0,500}/", ObjectSerializer::toString($zip)))) { + throw new InvalidArgumentException("invalid value for \$zip when calling Address., must conform to the pattern /[- A-Za-z0-9]{0,500}/."); + } + + $this->container['zip'] = $zip; + + return $this; + } + + /** + * Gets url + * + * @return string + */ + public function getUrl(): string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url The website of the business using the toll-free number. + * + * @return $this + */ + public function setUrl(string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + if ((mb_strlen($url) > 500)) { + throw new InvalidArgumentException('invalid length for $url when calling Address., must be smaller than or equal to 500.'); + } + if ((mb_strlen($url) < 1)) { + throw new InvalidArgumentException('invalid length for $url when calling Address., must be bigger than or equal to 1.'); + } + + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AnswerCallback.php b/src/Model/AnswerCallback.php new file mode 100644 index 0000000..838124e --- /dev/null +++ b/src/Model/AnswerCallback.php @@ -0,0 +1,855 @@ + + */ +class AnswerCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'answerCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'tag' => 'string', + 'machine_detection_result' => '\Bandwidth\Model\MachineDetectionResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'tag' => null, + 'machine_detection_result' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'tag' => true, + 'machine_detection_result' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'tag' => 'tag', + 'machine_detection_result' => 'machineDetectionResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'tag' => 'setTag', + 'machine_detection_result' => 'setMachineDetectionResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'tag' => 'getTag', + 'machine_detection_result' => 'getMachineDetectionResult' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('machine_detection_result', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets machine_detection_result + * + * @return \Bandwidth\Model\MachineDetectionResult|null + */ + public function getMachineDetectionResult(): ?\Bandwidth\Model\MachineDetectionResult + { + return $this->container['machine_detection_result']; + } + + /** + * Sets machine_detection_result + * + * @param \Bandwidth\Model\MachineDetectionResult|null $machine_detection_result machine_detection_result + * + * @return $this + */ + public function setMachineDetectionResult(?\Bandwidth\Model\MachineDetectionResult $machine_detection_result): static + { + if (is_null($machine_detection_result)) { + array_push($this->openAPINullablesSetToNull, 'machine_detection_result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('machine_detection_result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['machine_detection_result'] = $machine_detection_result; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/AnyOfInterface.php b/src/Model/AnyOfInterface.php new file mode 100644 index 0000000..9c01010 --- /dev/null +++ b/src/Model/AnyOfInterface.php @@ -0,0 +1,66 @@ + + */ + public static function getAnyOfDiscriminatorMappings(): array; +} diff --git a/src/Model/AsyncLookupRequest.php b/src/Model/AsyncLookupRequest.php new file mode 100644 index 0000000..03705e0 --- /dev/null +++ b/src/Model/AsyncLookupRequest.php @@ -0,0 +1,388 @@ + + */ +class AsyncLookupRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'asyncLookupRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'phone_numbers' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'phone_numbers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'phone_numbers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'phone_numbers' => 'phoneNumbers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'phone_numbers' => 'setPhoneNumbers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'phone_numbers' => 'getPhoneNumbers' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('phone_numbers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['phone_numbers'] === null) { + $invalidProperties[] = "'phone_numbers' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets phone_numbers + * + * @return string[] + */ + public function getPhoneNumbers(): array + { + return $this->container['phone_numbers']; + } + + /** + * Sets phone_numbers + * + * @param string[] $phone_numbers Telephone numbers in E.164 format. + * + * @return $this + */ + public function setPhoneNumbers(array $phone_numbers): static + { + if (is_null($phone_numbers)) { + throw new InvalidArgumentException('non-nullable phone_numbers cannot be null'); + } + + $this->container['phone_numbers'] = $phone_numbers; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/BlockedWebhook.php b/src/Model/BlockedWebhook.php new file mode 100644 index 0000000..b0a0c64 --- /dev/null +++ b/src/Model/BlockedWebhook.php @@ -0,0 +1,576 @@ + + */ +class BlockedWebhook implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'blockedWebhook'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'account_id' => 'string', + 'phone_number' => 'string', + 'status' => '\Bandwidth\Model\TfvCallbackStatusEnum', + 'internal_ticket_number' => 'string', + 'blocked' => 'bool', + 'blocked_reason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'account_id' => null, + 'phone_number' => null, + 'status' => null, + 'internal_ticket_number' => null, + 'blocked' => null, + 'blocked_reason' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'phone_number' => false, + 'status' => false, + 'internal_ticket_number' => false, + 'blocked' => false, + 'blocked_reason' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'account_id' => 'accountId', + 'phone_number' => 'phoneNumber', + 'status' => 'status', + 'internal_ticket_number' => 'internalTicketNumber', + 'blocked' => 'blocked', + 'blocked_reason' => 'blockedReason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'account_id' => 'setAccountId', + 'phone_number' => 'setPhoneNumber', + 'status' => 'setStatus', + 'internal_ticket_number' => 'setInternalTicketNumber', + 'blocked' => 'setBlocked', + 'blocked_reason' => 'setBlockedReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'account_id' => 'getAccountId', + 'phone_number' => 'getPhoneNumber', + 'status' => 'getStatus', + 'internal_ticket_number' => 'getInternalTicketNumber', + 'blocked' => 'getBlocked', + 'blocked_reason' => 'getBlockedReason' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('internal_ticket_number', $data ?? [], null); + $this->setIfExists('blocked', $data ?? [], null); + $this->setIfExists('blocked_reason', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) > 12)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be smaller than or equal to 12."; + } + + if (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) < 12)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be bigger than or equal to 12."; + } + + if (!is_null($this->container['phone_number']) && !preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $this->container['phone_number'])) { + $invalidProperties[] = "invalid value for 'phone_number', must be conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id User's account ID. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets phone_number + * + * @return string|null + */ + public function getPhoneNumber(): ?string + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string|null $phone_number Toll-free telephone number in E.164 format. + * + * @return $this + */ + public function setPhoneNumber(?string $phone_number): static + { + if (is_null($phone_number)) { + throw new InvalidArgumentException('non-nullable phone_number cannot be null'); + } + if ((mb_strlen($phone_number) > 12)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling BlockedWebhook., must be smaller than or equal to 12.'); + } + if ((mb_strlen($phone_number) < 12)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling BlockedWebhook., must be bigger than or equal to 12.'); + } + if ((!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", ObjectSerializer::toString($phone_number)))) { + throw new InvalidArgumentException("invalid value for \$phone_number when calling BlockedWebhook., must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets status + * + * @return \Bandwidth\Model\TfvCallbackStatusEnum|null + */ + public function getStatus(): ?\Bandwidth\Model\TfvCallbackStatusEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\TfvCallbackStatusEnum|null $status status + * + * @return $this + */ + public function setStatus(?\Bandwidth\Model\TfvCallbackStatusEnum $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets internal_ticket_number + * + * @return string|null + */ + public function getInternalTicketNumber(): ?string + { + return $this->container['internal_ticket_number']; + } + + /** + * Sets internal_ticket_number + * + * @param string|null $internal_ticket_number Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + * + * @return $this + */ + public function setInternalTicketNumber(?string $internal_ticket_number): static + { + if (is_null($internal_ticket_number)) { + throw new InvalidArgumentException('non-nullable internal_ticket_number cannot be null'); + } + $this->container['internal_ticket_number'] = $internal_ticket_number; + + return $this; + } + + /** + * Gets blocked + * + * @return bool|null + */ + public function getBlocked(): ?bool + { + return $this->container['blocked']; + } + + /** + * Sets blocked + * + * @param bool|null $blocked Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. + * + * @return $this + */ + public function setBlocked(?bool $blocked): static + { + if (is_null($blocked)) { + throw new InvalidArgumentException('non-nullable blocked cannot be null'); + } + $this->container['blocked'] = $blocked; + + return $this; + } + + /** + * Gets blocked_reason + * + * @return string|null + */ + public function getBlockedReason(): ?string + { + return $this->container['blocked_reason']; + } + + /** + * Sets blocked_reason + * + * @param string|null $blocked_reason The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. + * + * @return $this + */ + public function setBlockedReason(?string $blocked_reason): static + { + if (is_null($blocked_reason)) { + throw new InvalidArgumentException('non-nullable blocked_reason cannot be null'); + } + $this->container['blocked_reason'] = $blocked_reason; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/BridgeCompleteCallback.php b/src/Model/BridgeCompleteCallback.php new file mode 100644 index 0000000..73601fe --- /dev/null +++ b/src/Model/BridgeCompleteCallback.php @@ -0,0 +1,930 @@ + + */ +class BridgeCompleteCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'bridgeCompleteCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'tag' => 'string', + 'cause' => 'string', + 'error_message' => 'string', + 'error_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'tag' => null, + 'cause' => null, + 'error_message' => null, + 'error_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'tag' => true, + 'cause' => false, + 'error_message' => true, + 'error_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'tag' => 'tag', + 'cause' => 'cause', + 'error_message' => 'errorMessage', + 'error_id' => 'errorId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'tag' => 'setTag', + 'cause' => 'setCause', + 'error_message' => 'setErrorMessage', + 'error_id' => 'setErrorId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'tag' => 'getTag', + 'cause' => 'getCause', + 'error_message' => 'getErrorMessage', + 'error_id' => 'getErrorId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('cause', $data ?? [], null); + $this->setIfExists('error_message', $data ?? [], null); + $this->setIfExists('error_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets cause + * + * @return string|null + */ + public function getCause(): ?string + { + return $this->container['cause']; + } + + /** + * Sets cause + * + * @param string|null $cause Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. + * + * @return $this + */ + public function setCause(?string $cause): static + { + if (is_null($cause)) { + throw new InvalidArgumentException('non-nullable cause cannot be null'); + } + $this->container['cause'] = $cause; + + return $this; + } + + /** + * Gets error_message + * + * @return string|null + */ + public function getErrorMessage(): ?string + { + return $this->container['error_message']; + } + + /** + * Sets error_message + * + * @param string|null $error_message Text explaining the reason that caused the call to fail in case of errors. + * + * @return $this + */ + public function setErrorMessage(?string $error_message): static + { + if (is_null($error_message)) { + array_push($this->openAPINullablesSetToNull, 'error_message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error_message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error_message'] = $error_message; + + return $this; + } + + /** + * Gets error_id + * + * @return string|null + */ + public function getErrorId(): ?string + { + return $this->container['error_id']; + } + + /** + * Sets error_id + * + * @param string|null $error_id Bandwidth's internal id that references the error event. + * + * @return $this + */ + public function setErrorId(?string $error_id): static + { + if (is_null($error_id)) { + array_push($this->openAPINullablesSetToNull, 'error_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error_id'] = $error_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/BridgeTargetCompleteCallback.php b/src/Model/BridgeTargetCompleteCallback.php new file mode 100644 index 0000000..3abf34e --- /dev/null +++ b/src/Model/BridgeTargetCompleteCallback.php @@ -0,0 +1,814 @@ + + */ +class BridgeTargetCompleteCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'bridgeTargetCompleteCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'tag' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/BrtcError.php b/src/Model/BrtcError.php new file mode 100644 index 0000000..9d787bb --- /dev/null +++ b/src/Model/BrtcError.php @@ -0,0 +1,526 @@ + + */ +class BrtcError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'brtcError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'type' => 'string', + 'description' => 'string', + 'code' => 'string', + 'source' => '\Bandwidth\Model\BrtcErrorSource' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => 'uuid', + 'type' => null, + 'description' => null, + 'code' => null, + 'source' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'type' => false, + 'description' => false, + 'code' => false, + 'source' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'description' => 'description', + 'code' => 'code', + 'source' => 'source' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'description' => 'setDescription', + 'code' => 'setCode', + 'source' => 'setSource' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'description' => 'getDescription', + 'code' => 'getCode', + 'source' => 'getSource' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['description'] === null) { + $invalidProperties[] = "'description' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id A unique identifier for the error. + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of error. + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets description + * + * @return string + */ + public function getDescription(): string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description A description of the error. + * + * @return $this + */ + public function setDescription(string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode(): ?string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code A code that uniquely identifies the error. + * + * @return $this + */ + public function setCode(?string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets source + * + * @return \Bandwidth\Model\BrtcErrorSource|null + */ + public function getSource(): ?\Bandwidth\Model\BrtcErrorSource + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \Bandwidth\Model\BrtcErrorSource|null $source source + * + * @return $this + */ + public function setSource(?\Bandwidth\Model\BrtcErrorSource $source): static + { + if (is_null($source)) { + throw new InvalidArgumentException('non-nullable source cannot be null'); + } + $this->container['source'] = $source; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/BrtcErrorResponse.php b/src/Model/BrtcErrorResponse.php new file mode 100644 index 0000000..34ac11b --- /dev/null +++ b/src/Model/BrtcErrorResponse.php @@ -0,0 +1,468 @@ + + */ +class BrtcErrorResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'brtcErrorResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'links' => '\Bandwidth\Model\BrtcLink[]', + 'data' => 'object', + 'errors' => '\Bandwidth\Model\BrtcError[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'links' => null, + 'data' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'links' => false, + 'data' => true, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'links' => 'links', + 'data' => 'data', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'links' => 'setLinks', + 'data' => 'setData', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'links' => 'getLinks', + 'data' => 'getData', + 'errors' => 'getErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } + if ($this->container['data'] === null && !$this->isNullableSetToNull('data')) { + $invalidProperties[] = "'data' is required"; + } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return \Bandwidth\Model\BrtcLink[] + */ + public function getLinks(): array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Bandwidth\Model\BrtcLink[] $links links + * + * @return $this + */ + public function setLinks(array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets data + * + * @return object|null + */ + public function getData(): ?object + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param object|null $data data + * + * @return $this + */ + public function setData(?object $data): static + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets errors + * + * @return \Bandwidth\Model\BrtcError[] + */ + public function getErrors(): array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Bandwidth\Model\BrtcError[] $errors errors + * + * @return $this + */ + public function setErrors(array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/BrtcErrorSource.php b/src/Model/BrtcErrorSource.php new file mode 100644 index 0000000..4398ef9 --- /dev/null +++ b/src/Model/BrtcErrorSource.php @@ -0,0 +1,486 @@ + + */ +class BrtcErrorSource implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'brtcErrorSource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'parameter' => 'string', + 'field' => 'string', + 'header' => 'string', + 'reference' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'parameter' => null, + 'field' => null, + 'header' => null, + 'reference' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'parameter' => false, + 'field' => false, + 'header' => false, + 'reference' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'parameter' => 'parameter', + 'field' => 'field', + 'header' => 'header', + 'reference' => 'reference' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'parameter' => 'setParameter', + 'field' => 'setField', + 'header' => 'setHeader', + 'reference' => 'setReference' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'parameter' => 'getParameter', + 'field' => 'getField', + 'header' => 'getHeader', + 'reference' => 'getReference' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('parameter', $data ?? [], null); + $this->setIfExists('field', $data ?? [], null); + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('reference', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets parameter + * + * @return string|null + */ + public function getParameter(): ?string + { + return $this->container['parameter']; + } + + /** + * Sets parameter + * + * @param string|null $parameter The URI parameter that caused the error. + * + * @return $this + */ + public function setParameter(?string $parameter): static + { + if (is_null($parameter)) { + throw new InvalidArgumentException('non-nullable parameter cannot be null'); + } + $this->container['parameter'] = $parameter; + + return $this; + } + + /** + * Gets field + * + * @return string|null + */ + public function getField(): ?string + { + return $this->container['field']; + } + + /** + * Sets field + * + * @param string|null $field The request body field that caused the error. + * + * @return $this + */ + public function setField(?string $field): static + { + if (is_null($field)) { + throw new InvalidArgumentException('non-nullable field cannot be null'); + } + $this->container['field'] = $field; + + return $this; + } + + /** + * Gets header + * + * @return string|null + */ + public function getHeader(): ?string + { + return $this->container['header']; + } + + /** + * Sets header + * + * @param string|null $header The header that caused the error. + * + * @return $this + */ + public function setHeader(?string $header): static + { + if (is_null($header)) { + throw new InvalidArgumentException('non-nullable header cannot be null'); + } + $this->container['header'] = $header; + + return $this; + } + + /** + * Gets reference + * + * @return string|null + */ + public function getReference(): ?string + { + return $this->container['reference']; + } + + /** + * Sets reference + * + * @param string|null $reference The resource ID or path to the resource (or non-existent resource) causing the error. + * + * @return $this + */ + public function setReference(?string $reference): static + { + if (is_null($reference)) { + throw new InvalidArgumentException('non-nullable reference cannot be null'); + } + $this->container['reference'] = $reference; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/BrtcLink.php b/src/Model/BrtcLink.php new file mode 100644 index 0000000..edb329c --- /dev/null +++ b/src/Model/BrtcLink.php @@ -0,0 +1,452 @@ + + */ +class BrtcLink implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'brtcLink'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'href' => 'string', + 'rel' => 'string', + 'method' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'href' => null, + 'rel' => null, + 'method' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'href' => false, + 'rel' => false, + 'method' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'href' => 'href', + 'rel' => 'rel', + 'method' => 'method' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'href' => 'setHref', + 'rel' => 'setRel', + 'method' => 'setMethod' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'href' => 'getHref', + 'rel' => 'getRel', + 'method' => 'getMethod' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('href', $data ?? [], null); + $this->setIfExists('rel', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets href + * + * @return string|null + */ + public function getHref(): ?string + { + return $this->container['href']; + } + + /** + * Sets href + * + * @param string|null $href The full URL of the link. + * + * @return $this + */ + public function setHref(?string $href): static + { + if (is_null($href)) { + throw new InvalidArgumentException('non-nullable href cannot be null'); + } + $this->container['href'] = $href; + + return $this; + } + + /** + * Gets rel + * + * @return string|null + */ + public function getRel(): ?string + { + return $this->container['rel']; + } + + /** + * Sets rel + * + * @param string|null $rel The relationship of the link to the current resource. + * + * @return $this + */ + public function setRel(?string $rel): static + { + if (is_null($rel)) { + throw new InvalidArgumentException('non-nullable rel cannot be null'); + } + $this->container['rel'] = $rel; + + return $this; + } + + /** + * Gets method + * + * @return string|null + */ + public function getMethod(): ?string + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string|null $method The HTTP method to use when making the request. + * + * @return $this + */ + public function setMethod(?string $method): static + { + if (is_null($method)) { + throw new InvalidArgumentException('non-nullable method cannot be null'); + } + $this->container['method'] = $method; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/BusinessEntityTypeEnum.php b/src/Model/BusinessEntityTypeEnum.php new file mode 100644 index 0000000..4ef0d95 --- /dev/null +++ b/src/Model/BusinessEntityTypeEnum.php @@ -0,0 +1,52 @@ + + */ +class CallRecordingMetadata implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'callRecordingMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'application_id' => 'string', + 'account_id' => 'string', + 'call_id' => 'string', + 'parent_call_id' => 'string', + 'recording_id' => 'string', + 'to' => 'string', + 'from' => 'string', + 'transfer_caller_id' => 'string', + 'transfer_to' => 'string', + 'duration' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'channels' => 'int', + 'start_time' => '\DateTime', + 'end_time' => '\DateTime', + 'file_format' => '\Bandwidth\Model\FileFormatEnum', + 'status' => 'string', + 'media_url' => 'string', + 'transcription' => '\Bandwidth\Model\RecordingTranscriptionMetadata', + 'recording_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'application_id' => null, + 'account_id' => null, + 'call_id' => null, + 'parent_call_id' => null, + 'recording_id' => null, + 'to' => null, + 'from' => null, + 'transfer_caller_id' => null, + 'transfer_to' => null, + 'duration' => null, + 'direction' => null, + 'channels' => 'int32', + 'start_time' => 'date-time', + 'end_time' => 'date-time', + 'file_format' => null, + 'status' => null, + 'media_url' => 'uri', + 'transcription' => null, + 'recording_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'application_id' => false, + 'account_id' => false, + 'call_id' => false, + 'parent_call_id' => false, + 'recording_id' => false, + 'to' => false, + 'from' => false, + 'transfer_caller_id' => false, + 'transfer_to' => false, + 'duration' => false, + 'direction' => false, + 'channels' => false, + 'start_time' => false, + 'end_time' => false, + 'file_format' => false, + 'status' => false, + 'media_url' => true, + 'transcription' => true, + 'recording_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'application_id' => 'applicationId', + 'account_id' => 'accountId', + 'call_id' => 'callId', + 'parent_call_id' => 'parentCallId', + 'recording_id' => 'recordingId', + 'to' => 'to', + 'from' => 'from', + 'transfer_caller_id' => 'transferCallerId', + 'transfer_to' => 'transferTo', + 'duration' => 'duration', + 'direction' => 'direction', + 'channels' => 'channels', + 'start_time' => 'startTime', + 'end_time' => 'endTime', + 'file_format' => 'fileFormat', + 'status' => 'status', + 'media_url' => 'mediaUrl', + 'transcription' => 'transcription', + 'recording_name' => 'recordingName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'application_id' => 'setApplicationId', + 'account_id' => 'setAccountId', + 'call_id' => 'setCallId', + 'parent_call_id' => 'setParentCallId', + 'recording_id' => 'setRecordingId', + 'to' => 'setTo', + 'from' => 'setFrom', + 'transfer_caller_id' => 'setTransferCallerId', + 'transfer_to' => 'setTransferTo', + 'duration' => 'setDuration', + 'direction' => 'setDirection', + 'channels' => 'setChannels', + 'start_time' => 'setStartTime', + 'end_time' => 'setEndTime', + 'file_format' => 'setFileFormat', + 'status' => 'setStatus', + 'media_url' => 'setMediaUrl', + 'transcription' => 'setTranscription', + 'recording_name' => 'setRecordingName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'application_id' => 'getApplicationId', + 'account_id' => 'getAccountId', + 'call_id' => 'getCallId', + 'parent_call_id' => 'getParentCallId', + 'recording_id' => 'getRecordingId', + 'to' => 'getTo', + 'from' => 'getFrom', + 'transfer_caller_id' => 'getTransferCallerId', + 'transfer_to' => 'getTransferTo', + 'duration' => 'getDuration', + 'direction' => 'getDirection', + 'channels' => 'getChannels', + 'start_time' => 'getStartTime', + 'end_time' => 'getEndTime', + 'file_format' => 'getFileFormat', + 'status' => 'getStatus', + 'media_url' => 'getMediaUrl', + 'transcription' => 'getTranscription', + 'recording_name' => 'getRecordingName' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('parent_call_id', $data ?? [], null); + $this->setIfExists('recording_id', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('transfer_caller_id', $data ?? [], null); + $this->setIfExists('transfer_to', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('channels', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('file_format', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('media_url', $data ?? [], null); + $this->setIfExists('transcription', $data ?? [], null); + $this->setIfExists('recording_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets parent_call_id + * + * @return string|null + */ + public function getParentCallId(): ?string + { + return $this->container['parent_call_id']; + } + + /** + * Sets parent_call_id + * + * @param string|null $parent_call_id (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. + * + * @return $this + */ + public function setParentCallId(?string $parent_call_id): static + { + if (is_null($parent_call_id)) { + throw new InvalidArgumentException('non-nullable parent_call_id cannot be null'); + } + $this->container['parent_call_id'] = $parent_call_id; + + return $this; + } + + /** + * Gets recording_id + * + * @return string|null + */ + public function getRecordingId(): ?string + { + return $this->container['recording_id']; + } + + /** + * Sets recording_id + * + * @param string|null $recording_id The unique ID of this recording + * + * @return $this + */ + public function setRecordingId(?string $recording_id): static + { + if (is_null($recording_id)) { + throw new InvalidArgumentException('non-nullable recording_id cannot be null'); + } + $this->container['recording_id'] = $recording_id; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets transfer_caller_id + * + * @return string|null + */ + public function getTransferCallerId(): ?string + { + return $this->container['transfer_caller_id']; + } + + /** + * Sets transfer_caller_id + * + * @param string|null $transfer_caller_id The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferCallerId(?string $transfer_caller_id): static + { + if (is_null($transfer_caller_id)) { + throw new InvalidArgumentException('non-nullable transfer_caller_id cannot be null'); + } + $this->container['transfer_caller_id'] = $transfer_caller_id; + + return $this; + } + + /** + * Gets transfer_to + * + * @return string|null + */ + public function getTransferTo(): ?string + { + return $this->container['transfer_to']; + } + + /** + * Sets transfer_to + * + * @param string|null $transfer_to The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferTo(?string $transfer_to): static + { + if (is_null($transfer_to)) { + throw new InvalidArgumentException('non-nullable transfer_to cannot be null'); + } + $this->container['transfer_to'] = $transfer_to; + + return $this; + } + + /** + * Gets duration + * + * @return string|null + */ + public function getDuration(): ?string + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param string|null $duration The duration of the recording in ISO-8601 format + * + * @return $this + */ + public function setDuration(?string $duration): static + { + if (is_null($duration)) { + throw new InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets channels + * + * @return int|null + */ + public function getChannels(): ?int + { + return $this->container['channels']; + } + + /** + * Sets channels + * + * @param int|null $channels Always `1` for conference recordings; multi-channel recordings are not supported on conferences. + * + * @return $this + */ + public function setChannels(?int $channels): static + { + if (is_null($channels)) { + throw new InvalidArgumentException('non-nullable channels cannot be null'); + } + $this->container['channels'] = $channels; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets end_time + * + * @return \DateTime|null + */ + public function getEndTime(): ?\DateTime + { + return $this->container['end_time']; + } + + /** + * Sets end_time + * + * @param \DateTime|null $end_time The time that the recording ended in ISO-8601 format + * + * @return $this + */ + public function setEndTime(?\DateTime $end_time): static + { + if (is_null($end_time)) { + throw new InvalidArgumentException('non-nullable end_time cannot be null'); + } + $this->container['end_time'] = $end_time; + + return $this; + } + + /** + * Gets file_format + * + * @return \Bandwidth\Model\FileFormatEnum|null + */ + public function getFileFormat(): ?\Bandwidth\Model\FileFormatEnum + { + return $this->container['file_format']; + } + + /** + * Sets file_format + * + * @param \Bandwidth\Model\FileFormatEnum|null $file_format file_format + * + * @return $this + */ + public function setFileFormat(?\Bandwidth\Model\FileFormatEnum $file_format): static + { + if (is_null($file_format)) { + throw new InvalidArgumentException('non-nullable file_format cannot be null'); + } + $this->container['file_format'] = $file_format; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status 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 $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets media_url + * + * @return string|null + */ + public function getMediaUrl(): ?string + { + return $this->container['media_url']; + } + + /** + * Sets media_url + * + * @param string|null $media_url The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * + * @return $this + */ + public function setMediaUrl(?string $media_url): static + { + if (is_null($media_url)) { + array_push($this->openAPINullablesSetToNull, 'media_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('media_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['media_url'] = $media_url; + + return $this; + } + + /** + * Gets transcription + * + * @return \Bandwidth\Model\RecordingTranscriptionMetadata|null + */ + public function getTranscription(): ?\Bandwidth\Model\RecordingTranscriptionMetadata + { + return $this->container['transcription']; + } + + /** + * Sets transcription + * + * @param \Bandwidth\Model\RecordingTranscriptionMetadata|null $transcription transcription + * + * @return $this + */ + public function setTranscription(?\Bandwidth\Model\RecordingTranscriptionMetadata $transcription): static + { + if (is_null($transcription)) { + array_push($this->openAPINullablesSetToNull, 'transcription'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('transcription', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['transcription'] = $transcription; + + return $this; + } + + /** + * Gets recording_name + * + * @return string|null + */ + public function getRecordingName(): ?string + { + return $this->container['recording_name']; + } + + /** + * Sets recording_name + * + * @param string|null $recording_name A name to identify this recording. + * + * @return $this + */ + public function setRecordingName(?string $recording_name): static + { + if (is_null($recording_name)) { + throw new InvalidArgumentException('non-nullable recording_name cannot be null'); + } + $this->container['recording_name'] = $recording_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CallState.php b/src/Model/CallState.php new file mode 100644 index 0000000..e7881a9 --- /dev/null +++ b/src/Model/CallState.php @@ -0,0 +1,1032 @@ + + */ +class CallState implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'callState'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'application_id' => 'string', + 'account_id' => 'string', + 'call_id' => 'string', + 'parent_call_id' => 'string', + 'to' => 'string', + 'from' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'state' => 'string', + 'stir_shaken' => 'array', + 'identity' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'end_time' => '\DateTime', + 'disconnect_cause' => 'string', + 'error_message' => 'string', + 'error_id' => 'string', + 'last_update' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'application_id' => null, + 'account_id' => null, + 'call_id' => null, + 'parent_call_id' => null, + 'to' => null, + 'from' => null, + 'direction' => null, + 'state' => null, + 'stir_shaken' => null, + 'identity' => null, + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'end_time' => 'date-time', + 'disconnect_cause' => null, + 'error_message' => null, + 'error_id' => null, + 'last_update' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'application_id' => false, + 'account_id' => false, + 'call_id' => false, + 'parent_call_id' => true, + 'to' => false, + 'from' => false, + 'direction' => false, + 'state' => false, + 'stir_shaken' => true, + 'identity' => true, + 'enqueued_time' => true, + 'start_time' => true, + 'answer_time' => true, + 'end_time' => true, + 'disconnect_cause' => true, + 'error_message' => true, + 'error_id' => true, + 'last_update' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'application_id' => 'applicationId', + 'account_id' => 'accountId', + 'call_id' => 'callId', + 'parent_call_id' => 'parentCallId', + 'to' => 'to', + 'from' => 'from', + 'direction' => 'direction', + 'state' => 'state', + 'stir_shaken' => 'stirShaken', + 'identity' => 'identity', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'end_time' => 'endTime', + 'disconnect_cause' => 'disconnectCause', + 'error_message' => 'errorMessage', + 'error_id' => 'errorId', + 'last_update' => 'lastUpdate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'application_id' => 'setApplicationId', + 'account_id' => 'setAccountId', + 'call_id' => 'setCallId', + 'parent_call_id' => 'setParentCallId', + 'to' => 'setTo', + 'from' => 'setFrom', + 'direction' => 'setDirection', + 'state' => 'setState', + 'stir_shaken' => 'setStirShaken', + 'identity' => 'setIdentity', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'end_time' => 'setEndTime', + 'disconnect_cause' => 'setDisconnectCause', + 'error_message' => 'setErrorMessage', + 'error_id' => 'setErrorId', + 'last_update' => 'setLastUpdate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'application_id' => 'getApplicationId', + 'account_id' => 'getAccountId', + 'call_id' => 'getCallId', + 'parent_call_id' => 'getParentCallId', + 'to' => 'getTo', + 'from' => 'getFrom', + 'direction' => 'getDirection', + 'state' => 'getState', + 'stir_shaken' => 'getStirShaken', + 'identity' => 'getIdentity', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'end_time' => 'getEndTime', + 'disconnect_cause' => 'getDisconnectCause', + 'error_message' => 'getErrorMessage', + 'error_id' => 'getErrorId', + 'last_update' => 'getLastUpdate' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('parent_call_id', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('stir_shaken', $data ?? [], null); + $this->setIfExists('identity', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('disconnect_cause', $data ?? [], null); + $this->setIfExists('error_message', $data ?? [], null); + $this->setIfExists('error_id', $data ?? [], null); + $this->setIfExists('last_update', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The application id associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The account id associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The programmable voice API call ID. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets parent_call_id + * + * @return string|null + */ + public function getParentCallId(): ?string + { + return $this->container['parent_call_id']; + } + + /** + * Sets parent_call_id + * + * @param string|null $parent_call_id The A-leg call id, set only if this call is the B-leg of a [``](/docs/voice/bxml/transfer). + * + * @return $this + */ + public function setParentCallId(?string $parent_call_id): static + { + if (is_null($parent_call_id)) { + array_push($this->openAPINullablesSetToNull, 'parent_call_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('parent_call_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['parent_call_id'] = $parent_call_id; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to 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 $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The phone number that made the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState(): ?string + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state 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 $this + */ + public function setState(?string $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets stir_shaken + * + * @return array|null + */ + public function getStirShaken(): ?array + { + return $this->container['stir_shaken']; + } + + /** + * Sets stir_shaken + * + * @param array|null $stir_shaken 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-Validation-Passed` or `TN-Validation-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 $this + */ + public function setStirShaken(?array $stir_shaken): static + { + if (is_null($stir_shaken)) { + array_push($this->openAPINullablesSetToNull, 'stir_shaken'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('stir_shaken', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['stir_shaken'] = $stir_shaken; + + return $this; + } + + /** + * Gets identity + * + * @return string|null + */ + public function getIdentity(): ?string + { + return $this->container['identity']; + } + + /** + * Sets identity + * + * @param string|null $identity 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 $this + */ + public function setIdentity(?string $identity): static + { + if (is_null($identity)) { + array_push($this->openAPINullablesSetToNull, 'identity'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('identity', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['identity'] = $identity; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time The time this call was placed in queue. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time The time the call was initiated, in ISO 8601 format. `null` if the call is still in your queue. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + array_push($this->openAPINullablesSetToNull, 'start_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('start_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Populated once the call has been answered, with the time in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets end_time + * + * @return \DateTime|null + */ + public function getEndTime(): ?\DateTime + { + return $this->container['end_time']; + } + + /** + * Sets end_time + * + * @param \DateTime|null $end_time Populated once the call has ended, with the time in ISO 8601 format. + * + * @return $this + */ + public function setEndTime(?\DateTime $end_time): static + { + if (is_null($end_time)) { + array_push($this->openAPINullablesSetToNull, 'end_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('end_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['end_time'] = $end_time; + + return $this; + } + + /** + * Gets disconnect_cause + * + * @return string|null + */ + public function getDisconnectCause(): ?string + { + return $this->container['disconnect_cause']; + } + + /** + * Sets disconnect_cause + * + * @param string|null $disconnect_cause | 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. + * + * @return $this + */ + public function setDisconnectCause(?string $disconnect_cause): static + { + if (is_null($disconnect_cause)) { + array_push($this->openAPINullablesSetToNull, 'disconnect_cause'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('disconnect_cause', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['disconnect_cause'] = $disconnect_cause; + + return $this; + } + + /** + * Gets error_message + * + * @return string|null + */ + public function getErrorMessage(): ?string + { + return $this->container['error_message']; + } + + /** + * Sets error_message + * + * @param string|null $error_message Populated only if the call ended with an error, with text explaining the reason. + * + * @return $this + */ + public function setErrorMessage(?string $error_message): static + { + if (is_null($error_message)) { + array_push($this->openAPINullablesSetToNull, 'error_message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error_message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error_message'] = $error_message; + + return $this; + } + + /** + * Gets error_id + * + * @return string|null + */ + public function getErrorId(): ?string + { + return $this->container['error_id']; + } + + /** + * Sets error_id + * + * @param string|null $error_id Populated only if the call ended with an error, with a Bandwidth internal id that references the error event. + * + * @return $this + */ + public function setErrorId(?string $error_id): static + { + if (is_null($error_id)) { + array_push($this->openAPINullablesSetToNull, 'error_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error_id'] = $error_id; + + return $this; + } + + /** + * Gets last_update + * + * @return \DateTime|null + */ + public function getLastUpdate(): ?\DateTime + { + return $this->container['last_update']; + } + + /** + * Sets last_update + * + * @param \DateTime|null $last_update The last time the call had a state update, in ISO 8601 format. + * + * @return $this + */ + public function setLastUpdate(?\DateTime $last_update): static + { + if (is_null($last_update)) { + throw new InvalidArgumentException('non-nullable last_update cannot be null'); + } + $this->container['last_update'] = $last_update; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CallStateEnum.php b/src/Model/CallStateEnum.php new file mode 100644 index 0000000..8213f29 --- /dev/null +++ b/src/Model/CallStateEnum.php @@ -0,0 +1,46 @@ + + */ +class CallTranscription implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'callTranscription'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'detected_language' => '\Bandwidth\Model\CallTranscriptionDetectedLanguageEnum', + 'track' => '\Bandwidth\Model\CallTranscriptionTrackEnum', + 'transcript' => 'string', + 'confidence' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'detected_language' => null, + 'track' => null, + 'transcript' => null, + 'confidence' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'detected_language' => false, + 'track' => false, + 'transcript' => false, + 'confidence' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'detected_language' => 'detectedLanguage', + 'track' => 'track', + 'transcript' => 'transcript', + 'confidence' => 'confidence' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'detected_language' => 'setDetectedLanguage', + 'track' => 'setTrack', + 'transcript' => 'setTranscript', + 'confidence' => 'setConfidence' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'detected_language' => 'getDetectedLanguage', + 'track' => 'getTrack', + 'transcript' => 'getTranscript', + 'confidence' => 'getConfidence' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('detected_language', $data ?? [], null); + $this->setIfExists('track', $data ?? [], null); + $this->setIfExists('transcript', $data ?? [], null); + $this->setIfExists('confidence', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['confidence']) && ($this->container['confidence'] > 1)) { + $invalidProperties[] = "invalid value for 'confidence', must be smaller than or equal to 1."; + } + + if (!is_null($this->container['confidence']) && ($this->container['confidence'] < 0)) { + $invalidProperties[] = "invalid value for 'confidence', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets detected_language + * + * @return \Bandwidth\Model\CallTranscriptionDetectedLanguageEnum|null + */ + public function getDetectedLanguage(): ?\Bandwidth\Model\CallTranscriptionDetectedLanguageEnum + { + return $this->container['detected_language']; + } + + /** + * Sets detected_language + * + * @param \Bandwidth\Model\CallTranscriptionDetectedLanguageEnum|null $detected_language detected_language + * + * @return $this + */ + public function setDetectedLanguage(?\Bandwidth\Model\CallTranscriptionDetectedLanguageEnum $detected_language): static + { + if (is_null($detected_language)) { + throw new InvalidArgumentException('non-nullable detected_language cannot be null'); + } + $this->container['detected_language'] = $detected_language; + + return $this; + } + + /** + * Gets track + * + * @return \Bandwidth\Model\CallTranscriptionTrackEnum|null + */ + public function getTrack(): ?\Bandwidth\Model\CallTranscriptionTrackEnum + { + return $this->container['track']; + } + + /** + * Sets track + * + * @param \Bandwidth\Model\CallTranscriptionTrackEnum|null $track track + * + * @return $this + */ + public function setTrack(?\Bandwidth\Model\CallTranscriptionTrackEnum $track): static + { + if (is_null($track)) { + throw new InvalidArgumentException('non-nullable track cannot be null'); + } + $this->container['track'] = $track; + + return $this; + } + + /** + * Gets transcript + * + * @return string|null + */ + public function getTranscript(): ?string + { + return $this->container['transcript']; + } + + /** + * Sets transcript + * + * @param string|null $transcript The transcription itself. + * + * @return $this + */ + public function setTranscript(?string $transcript): static + { + if (is_null($transcript)) { + throw new InvalidArgumentException('non-nullable transcript cannot be null'); + } + $this->container['transcript'] = $transcript; + + return $this; + } + + /** + * Gets confidence + * + * @return float|null + */ + public function getConfidence(): ?float + { + return $this->container['confidence']; + } + + /** + * Sets confidence + * + * @param float|null $confidence How confident the transcription engine was in transcribing the associated audio (from `0` to `1`). + * + * @return $this + */ + public function setConfidence(?float $confidence): static + { + if (is_null($confidence)) { + throw new InvalidArgumentException('non-nullable confidence cannot be null'); + } + if (($confidence > 1)) { + throw new InvalidArgumentException('invalid value for $confidence when calling CallTranscription., must be smaller than or equal to 1.'); + } + if (($confidence < 0)) { + throw new InvalidArgumentException('invalid value for $confidence when calling CallTranscription., must be bigger than or equal to 0.'); + } + + $this->container['confidence'] = $confidence; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CallTranscriptionDetectedLanguageEnum.php b/src/Model/CallTranscriptionDetectedLanguageEnum.php new file mode 100644 index 0000000..d903c3a --- /dev/null +++ b/src/Model/CallTranscriptionDetectedLanguageEnum.php @@ -0,0 +1,48 @@ + + */ +class CallTranscriptionMetadata implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'callTranscriptionMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'transcription_id' => 'string', + 'transcription_name' => 'string', + 'transcription_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'transcription_id' => null, + 'transcription_name' => null, + 'transcription_url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'transcription_id' => false, + 'transcription_name' => false, + 'transcription_url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'transcription_id' => 'transcriptionId', + 'transcription_name' => 'transcriptionName', + 'transcription_url' => 'transcriptionUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'transcription_id' => 'setTranscriptionId', + 'transcription_name' => 'setTranscriptionName', + 'transcription_url' => 'setTranscriptionUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'transcription_id' => 'getTranscriptionId', + 'transcription_name' => 'getTranscriptionName', + 'transcription_url' => 'getTranscriptionUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('transcription_id', $data ?? [], null); + $this->setIfExists('transcription_name', $data ?? [], null); + $this->setIfExists('transcription_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets transcription_id + * + * @return string|null + */ + public function getTranscriptionId(): ?string + { + return $this->container['transcription_id']; + } + + /** + * Sets transcription_id + * + * @param string|null $transcription_id The programmable voice API transcription ID. + * + * @return $this + */ + public function setTranscriptionId(?string $transcription_id): static + { + if (is_null($transcription_id)) { + throw new InvalidArgumentException('non-nullable transcription_id cannot be null'); + } + $this->container['transcription_id'] = $transcription_id; + + return $this; + } + + /** + * Gets transcription_name + * + * @return string|null + */ + public function getTranscriptionName(): ?string + { + return $this->container['transcription_name']; + } + + /** + * Sets transcription_name + * + * @param string|null $transcription_name The programmable voice API transcription name. This name could be provided by the user when creating the transcription. + * + * @return $this + */ + public function setTranscriptionName(?string $transcription_name): static + { + if (is_null($transcription_name)) { + throw new InvalidArgumentException('non-nullable transcription_name cannot be null'); + } + $this->container['transcription_name'] = $transcription_name; + + return $this; + } + + /** + * Gets transcription_url + * + * @return string|null + */ + public function getTranscriptionUrl(): ?string + { + return $this->container['transcription_url']; + } + + /** + * Sets transcription_url + * + * @param string|null $transcription_url A URL that may be used to retrieve the transcription itself. This points to the [Get Call Transcription](/apis/voice-apis/voice/#tag/Transcriptions/operation/getRealTimeTranscription) endpoint. + * + * @return $this + */ + public function setTranscriptionUrl(?string $transcription_url): static + { + if (is_null($transcription_url)) { + throw new InvalidArgumentException('non-nullable transcription_url cannot be null'); + } + $this->container['transcription_url'] = $transcription_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CallTranscriptionResponse.php b/src/Model/CallTranscriptionResponse.php new file mode 100644 index 0000000..324e514 --- /dev/null +++ b/src/Model/CallTranscriptionResponse.php @@ -0,0 +1,486 @@ + + */ +class CallTranscriptionResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'callTranscriptionResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'account_id' => 'string', + 'call_id' => 'string', + 'transcription_id' => 'string', + 'tracks' => '\Bandwidth\Model\CallTranscription[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'account_id' => null, + 'call_id' => null, + 'transcription_id' => null, + 'tracks' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'call_id' => false, + 'transcription_id' => false, + 'tracks' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'account_id' => 'accountId', + 'call_id' => 'callId', + 'transcription_id' => 'transcriptionId', + 'tracks' => 'tracks' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'account_id' => 'setAccountId', + 'call_id' => 'setCallId', + 'transcription_id' => 'setTranscriptionId', + 'tracks' => 'setTracks' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'account_id' => 'getAccountId', + 'call_id' => 'getCallId', + 'transcription_id' => 'getTranscriptionId', + 'tracks' => 'getTracks' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('transcription_id', $data ?? [], null); + $this->setIfExists('tracks', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets transcription_id + * + * @return string|null + */ + public function getTranscriptionId(): ?string + { + return $this->container['transcription_id']; + } + + /** + * Sets transcription_id + * + * @param string|null $transcription_id The programmable voice API transcription ID. + * + * @return $this + */ + public function setTranscriptionId(?string $transcription_id): static + { + if (is_null($transcription_id)) { + throw new InvalidArgumentException('non-nullable transcription_id cannot be null'); + } + $this->container['transcription_id'] = $transcription_id; + + return $this; + } + + /** + * Gets tracks + * + * @return \Bandwidth\Model\CallTranscription[]|null + */ + public function getTracks(): ?array + { + return $this->container['tracks']; + } + + /** + * Sets tracks + * + * @param \Bandwidth\Model\CallTranscription[]|null $tracks tracks + * + * @return $this + */ + public function setTracks(?array $tracks): static + { + if (is_null($tracks)) { + throw new InvalidArgumentException('non-nullable tracks cannot be null'); + } + $this->container['tracks'] = $tracks; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CallTranscriptionTrackEnum.php b/src/Model/CallTranscriptionTrackEnum.php new file mode 100644 index 0000000..a6c40fb --- /dev/null +++ b/src/Model/CallTranscriptionTrackEnum.php @@ -0,0 +1,46 @@ + '\Bandwidth\Model\StatusCallback', + 'message-failed' => '\Bandwidth\Model\StatusCallback', + 'message-read' => '\Bandwidth\Model\StatusCallback', + 'message-received' => '\Bandwidth\Model\InboundCallback', + 'message-sending' => '\Bandwidth\Model\StatusCallback', + 'message-sent' => '\Bandwidth\Model\StatusCallback', + 'requested-location-response' => '\Bandwidth\Model\InboundCallback', + 'suggestion-response' => '\Bandwidth\Model\InboundCallback' + ]; + } +} + + diff --git a/src/Model/CallbackMethodEnum.php b/src/Model/CallbackMethodEnum.php new file mode 100644 index 0000000..db853ac --- /dev/null +++ b/src/Model/CallbackMethodEnum.php @@ -0,0 +1,46 @@ + + */ +class CodeRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'codeRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'to' => 'string', + 'from' => 'string', + 'application_id' => 'string', + 'scope' => 'string', + 'message' => 'string', + 'digits' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'to' => null, + 'from' => null, + 'application_id' => null, + 'scope' => null, + 'message' => null, + 'digits' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'to' => false, + 'from' => false, + 'application_id' => false, + 'scope' => false, + 'message' => false, + 'digits' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'to' => 'to', + 'from' => 'from', + 'application_id' => 'applicationId', + 'scope' => 'scope', + 'message' => 'message', + 'digits' => 'digits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'to' => 'setTo', + 'from' => 'setFrom', + 'application_id' => 'setApplicationId', + 'scope' => 'setScope', + 'message' => 'setMessage', + 'digits' => 'setDigits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'to' => 'getTo', + 'from' => 'getFrom', + 'application_id' => 'getApplicationId', + 'scope' => 'getScope', + 'message' => 'getMessage', + 'digits' => 'getDigits' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('scope', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('digits', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if (!preg_match("/^\\+[1-9]\\d{1,14}$/", $this->container['to'])) { + $invalidProperties[] = "invalid value for 'to', must be conform to the pattern /^\\+[1-9]\\d{1,14}$/."; + } + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ((mb_strlen($this->container['from']) > 32)) { + $invalidProperties[] = "invalid value for 'from', the character length must be smaller than or equal to 32."; + } + + if (!preg_match("/^\\+[1-9]\\d{1,14}$/", $this->container['from'])) { + $invalidProperties[] = "invalid value for 'from', must be conform to the pattern /^\\+[1-9]\\d{1,14}$/."; + } + + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ((mb_strlen($this->container['application_id']) > 50)) { + $invalidProperties[] = "invalid value for 'application_id', the character length must be smaller than or equal to 50."; + } + + if (!is_null($this->container['scope']) && (mb_strlen($this->container['scope']) > 25)) { + $invalidProperties[] = "invalid value for 'scope', the character length must be smaller than or equal to 25."; + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ((mb_strlen($this->container['message']) > 2048)) { + $invalidProperties[] = "invalid value for 'message', the character length must be smaller than or equal to 2048."; + } + + if ($this->container['digits'] === null) { + $invalidProperties[] = "'digits' can't be null"; + } + if (($this->container['digits'] > 8)) { + $invalidProperties[] = "invalid value for 'digits', must be smaller than or equal to 8."; + } + + if (($this->container['digits'] < 4)) { + $invalidProperties[] = "invalid value for 'digits', must be bigger than or equal to 4."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to + * + * @return string + */ + public function getTo(): string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to The phone number to send the mfa code to. + * + * @return $this + */ + public function setTo(string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + + if ((!preg_match("/^\\+[1-9]\\d{1,14}$/", ObjectSerializer::toString($to)))) { + throw new InvalidArgumentException("invalid value for \$to when calling CodeRequest., must conform to the pattern /^\\+[1-9]\\d{1,14}$/."); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from The application phone number, the sender of the mfa code. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + if ((mb_strlen($from) > 32)) { + throw new InvalidArgumentException('invalid length for $from when calling CodeRequest., must be smaller than or equal to 32.'); + } + if ((!preg_match("/^\\+[1-9]\\d{1,14}$/", ObjectSerializer::toString($from)))) { + throw new InvalidArgumentException("invalid value for \$from when calling CodeRequest., must conform to the pattern /^\\+[1-9]\\d{1,14}$/."); + } + + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The application unique ID, obtained from Bandwidth. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + if ((mb_strlen($application_id) > 50)) { + throw new InvalidArgumentException('invalid length for $application_id when calling CodeRequest., must be smaller than or equal to 50.'); + } + + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets scope + * + * @return string|null + */ + public function getScope(): ?string + { + return $this->container['scope']; + } + + /** + * Sets scope + * + * @param string|null $scope An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\". + * + * @return $this + */ + public function setScope(?string $scope): static + { + if (is_null($scope)) { + throw new InvalidArgumentException('non-nullable scope cannot be null'); + } + if ((mb_strlen($scope) > 25)) { + throw new InvalidArgumentException('invalid length for $scope when calling CodeRequest., must be smaller than or equal to 25.'); + } + + $this->container['scope'] = $scope; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage(): string + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message 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 $this + */ + public function setMessage(string $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if ((mb_strlen($message) > 2048)) { + throw new InvalidArgumentException('invalid length for $message when calling CodeRequest., must be smaller than or equal to 2048.'); + } + + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets digits + * + * @return int + */ + public function getDigits(): int + { + return $this->container['digits']; + } + + /** + * Sets digits + * + * @param int $digits The number of digits for your mfa code. The valid number ranges from 2 to 8, inclusively. + * + * @return $this + */ + public function setDigits(int $digits): static + { + if (is_null($digits)) { + throw new InvalidArgumentException('non-nullable digits cannot be null'); + } + if (($digits > 8)) { + throw new InvalidArgumentException('invalid value for $digits when calling CodeRequest., must be smaller than or equal to 8.'); + } + if (($digits < 4)) { + throw new InvalidArgumentException('invalid value for $digits when calling CodeRequest., must be bigger than or equal to 4.'); + } + + $this->container['digits'] = $digits; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CompletedLookupStatusEnum.php b/src/Model/CompletedLookupStatusEnum.php new file mode 100644 index 0000000..4dd73ac --- /dev/null +++ b/src/Model/CompletedLookupStatusEnum.php @@ -0,0 +1,47 @@ + + */ +class Conference implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'conference'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'created_time' => '\DateTime', + 'completed_time' => '\DateTime', + 'conference_event_url' => 'string', + 'conference_event_method' => '\Bandwidth\Model\CallbackMethodEnum', + 'tag' => 'string', + 'active_members' => '\Bandwidth\Model\ConferenceMember[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'created_time' => 'date-time', + 'completed_time' => 'date-time', + 'conference_event_url' => 'uri', + 'conference_event_method' => null, + 'tag' => null, + 'active_members' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'created_time' => false, + 'completed_time' => true, + 'conference_event_url' => true, + 'conference_event_method' => true, + 'tag' => true, + 'active_members' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'created_time' => 'createdTime', + 'completed_time' => 'completedTime', + 'conference_event_url' => 'conferenceEventUrl', + 'conference_event_method' => 'conferenceEventMethod', + 'tag' => 'tag', + 'active_members' => 'activeMembers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'created_time' => 'setCreatedTime', + 'completed_time' => 'setCompletedTime', + 'conference_event_url' => 'setConferenceEventUrl', + 'conference_event_method' => 'setConferenceEventMethod', + 'tag' => 'setTag', + 'active_members' => 'setActiveMembers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'created_time' => 'getCreatedTime', + 'completed_time' => 'getCompletedTime', + 'conference_event_url' => 'getConferenceEventUrl', + 'conference_event_method' => 'getConferenceEventMethod', + 'tag' => 'getTag', + 'active_members' => 'getActiveMembers' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('created_time', $data ?? [], null); + $this->setIfExists('completed_time', $data ?? [], null); + $this->setIfExists('conference_event_url', $data ?? [], null); + $this->setIfExists('conference_event_method', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('active_members', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The Bandwidth-generated conference ID. + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the conference, as specified by your application. + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets created_time + * + * @return \DateTime|null + */ + public function getCreatedTime(): ?\DateTime + { + return $this->container['created_time']; + } + + /** + * Sets created_time + * + * @param \DateTime|null $created_time The time the conference was initiated, in ISO 8601 format. + * + * @return $this + */ + public function setCreatedTime(?\DateTime $created_time): static + { + if (is_null($created_time)) { + throw new InvalidArgumentException('non-nullable created_time cannot be null'); + } + $this->container['created_time'] = $created_time; + + return $this; + } + + /** + * Gets completed_time + * + * @return \DateTime|null + */ + public function getCompletedTime(): ?\DateTime + { + return $this->container['completed_time']; + } + + /** + * Sets completed_time + * + * @param \DateTime|null $completed_time The time the conference was terminated, in ISO 8601 format. + * + * @return $this + */ + public function setCompletedTime(?\DateTime $completed_time): static + { + if (is_null($completed_time)) { + array_push($this->openAPINullablesSetToNull, 'completed_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('completed_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['completed_time'] = $completed_time; + + return $this; + } + + /** + * Gets conference_event_url + * + * @return string|null + */ + public function getConferenceEventUrl(): ?string + { + return $this->container['conference_event_url']; + } + + /** + * Sets conference_event_url + * + * @param string|null $conference_event_url The URL to send the conference-related events. + * + * @return $this + */ + public function setConferenceEventUrl(?string $conference_event_url): static + { + if (is_null($conference_event_url)) { + array_push($this->openAPINullablesSetToNull, 'conference_event_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conference_event_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['conference_event_url'] = $conference_event_url; + + return $this; + } + + /** + * Gets conference_event_method + * + * @return \Bandwidth\Model\CallbackMethodEnum|null + */ + public function getConferenceEventMethod(): ?\Bandwidth\Model\CallbackMethodEnum + { + return $this->container['conference_event_method']; + } + + /** + * Sets conference_event_method + * + * @param \Bandwidth\Model\CallbackMethodEnum|null $conference_event_method conference_event_method + * + * @return $this + */ + public function setConferenceEventMethod(?\Bandwidth\Model\CallbackMethodEnum $conference_event_method): static + { + if (is_null($conference_event_method)) { + array_push($this->openAPINullablesSetToNull, 'conference_event_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conference_event_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['conference_event_method'] = $conference_event_method; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag The custom string attached to the conference that will be sent with callbacks. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets active_members + * + * @return \Bandwidth\Model\ConferenceMember[]|null + */ + public function getActiveMembers(): ?array + { + return $this->container['active_members']; + } + + /** + * Sets active_members + * + * @param \Bandwidth\Model\ConferenceMember[]|null $active_members 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 $this + */ + public function setActiveMembers(?array $active_members): static + { + if (is_null($active_members)) { + array_push($this->openAPINullablesSetToNull, 'active_members'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('active_members', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['active_members'] = $active_members; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ConferenceCompletedCallback.php b/src/Model/ConferenceCompletedCallback.php new file mode 100644 index 0000000..9a6c224 --- /dev/null +++ b/src/Model/ConferenceCompletedCallback.php @@ -0,0 +1,528 @@ + + */ +class ConferenceCompletedCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'conferenceCompletedCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'conference_id' => 'string', + 'name' => 'string', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'conference_id' => null, + 'name' => null, + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'conference_id' => false, + 'name' => false, + 'tag' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'conference_id' => 'conferenceId', + 'name' => 'name', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'conference_id' => 'setConferenceId', + 'name' => 'setName', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'conference_id' => 'getConferenceId', + 'name' => 'getName', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('conference_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets conference_id + * + * @return string|null + */ + public function getConferenceId(): ?string + { + return $this->container['conference_id']; + } + + /** + * Sets conference_id + * + * @param string|null $conference_id The unique, Bandwidth-generated ID of the conference that was recorded + * + * @return $this + */ + public function setConferenceId(?string $conference_id): static + { + if (is_null($conference_id)) { + throw new InvalidArgumentException('non-nullable conference_id cannot be null'); + } + $this->container['conference_id'] = $conference_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The user-specified name of the conference that was recorded + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ConferenceCreatedCallback.php b/src/Model/ConferenceCreatedCallback.php new file mode 100644 index 0000000..1775bf4 --- /dev/null +++ b/src/Model/ConferenceCreatedCallback.php @@ -0,0 +1,528 @@ + + */ +class ConferenceCreatedCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'conferenceCreatedCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'conference_id' => 'string', + 'name' => 'string', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'conference_id' => null, + 'name' => null, + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'conference_id' => false, + 'name' => false, + 'tag' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'conference_id' => 'conferenceId', + 'name' => 'name', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'conference_id' => 'setConferenceId', + 'name' => 'setName', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'conference_id' => 'getConferenceId', + 'name' => 'getName', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('conference_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets conference_id + * + * @return string|null + */ + public function getConferenceId(): ?string + { + return $this->container['conference_id']; + } + + /** + * Sets conference_id + * + * @param string|null $conference_id The unique, Bandwidth-generated ID of the conference that was recorded + * + * @return $this + */ + public function setConferenceId(?string $conference_id): static + { + if (is_null($conference_id)) { + throw new InvalidArgumentException('non-nullable conference_id cannot be null'); + } + $this->container['conference_id'] = $conference_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The user-specified name of the conference that was recorded + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ConferenceMember.php b/src/Model/ConferenceMember.php new file mode 100644 index 0000000..a27a432 --- /dev/null +++ b/src/Model/ConferenceMember.php @@ -0,0 +1,561 @@ + + */ +class ConferenceMember implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'conferenceMember'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'call_id' => 'string', + 'conference_id' => 'string', + 'member_url' => 'string', + 'mute' => 'bool', + 'hold' => 'bool', + 'call_ids_to_coach' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'call_id' => null, + 'conference_id' => null, + 'member_url' => 'uri', + 'mute' => null, + 'hold' => null, + 'call_ids_to_coach' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'call_id' => false, + 'conference_id' => false, + 'member_url' => false, + 'mute' => false, + 'hold' => false, + 'call_ids_to_coach' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'call_id' => 'callId', + 'conference_id' => 'conferenceId', + 'member_url' => 'memberUrl', + 'mute' => 'mute', + 'hold' => 'hold', + 'call_ids_to_coach' => 'callIdsToCoach' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'call_id' => 'setCallId', + 'conference_id' => 'setConferenceId', + 'member_url' => 'setMemberUrl', + 'mute' => 'setMute', + 'hold' => 'setHold', + 'call_ids_to_coach' => 'setCallIdsToCoach' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'call_id' => 'getCallId', + 'conference_id' => 'getConferenceId', + 'member_url' => 'getMemberUrl', + 'mute' => 'getMute', + 'hold' => 'getHold', + 'call_ids_to_coach' => 'getCallIdsToCoach' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('conference_id', $data ?? [], null); + $this->setIfExists('member_url', $data ?? [], null); + $this->setIfExists('mute', $data ?? [], null); + $this->setIfExists('hold', $data ?? [], null); + $this->setIfExists('call_ids_to_coach', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets conference_id + * + * @return string|null + */ + public function getConferenceId(): ?string + { + return $this->container['conference_id']; + } + + /** + * Sets conference_id + * + * @param string|null $conference_id The unique, Bandwidth-generated ID of the conference that was recorded + * + * @return $this + */ + public function setConferenceId(?string $conference_id): static + { + if (is_null($conference_id)) { + throw new InvalidArgumentException('non-nullable conference_id cannot be null'); + } + $this->container['conference_id'] = $conference_id; + + return $this; + } + + /** + * Gets member_url + * + * @return string|null + */ + public function getMemberUrl(): ?string + { + return $this->container['member_url']; + } + + /** + * Sets member_url + * + * @param string|null $member_url 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-apis/voice/#tag/Conferences/operation/getConferenceMember) endpoint and [Modify Conference Member](/apis/voice-apis/voice/#tag/Conferences/operation/updateConferenceMember) endpoint. + * + * @return $this + */ + public function setMemberUrl(?string $member_url): static + { + if (is_null($member_url)) { + throw new InvalidArgumentException('non-nullable member_url cannot be null'); + } + $this->container['member_url'] = $member_url; + + return $this; + } + + /** + * Gets mute + * + * @return bool|null + */ + public function getMute(): ?bool + { + return $this->container['mute']; + } + + /** + * Sets mute + * + * @param bool|null $mute 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 $this + */ + public function setMute(?bool $mute): static + { + if (is_null($mute)) { + throw new InvalidArgumentException('non-nullable mute cannot be null'); + } + $this->container['mute'] = $mute; + + return $this; + } + + /** + * Gets hold + * + * @return bool|null + */ + public function getHold(): ?bool + { + return $this->container['hold']; + } + + /** + * Sets hold + * + * @param bool|null $hold 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 $this + */ + public function setHold(?bool $hold): static + { + if (is_null($hold)) { + throw new InvalidArgumentException('non-nullable hold cannot be null'); + } + $this->container['hold'] = $hold; + + return $this; + } + + /** + * Gets call_ids_to_coach + * + * @return string[]|null + */ + public function getCallIdsToCoach(): ?array + { + return $this->container['call_ids_to_coach']; + } + + /** + * Sets call_ids_to_coach + * + * @param string[]|null $call_ids_to_coach 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 $this + */ + public function setCallIdsToCoach(?array $call_ids_to_coach): static + { + if (is_null($call_ids_to_coach)) { + array_push($this->openAPINullablesSetToNull, 'call_ids_to_coach'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('call_ids_to_coach', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['call_ids_to_coach'] = $call_ids_to_coach; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ConferenceMemberExitCallback.php b/src/Model/ConferenceMemberExitCallback.php new file mode 100644 index 0000000..2083caf --- /dev/null +++ b/src/Model/ConferenceMemberExitCallback.php @@ -0,0 +1,630 @@ + + */ +class ConferenceMemberExitCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'conferenceMemberExitCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'conference_id' => 'string', + 'name' => 'string', + 'from' => 'string', + 'to' => 'string', + 'call_id' => 'string', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'conference_id' => null, + 'name' => null, + 'from' => null, + 'to' => null, + 'call_id' => null, + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'conference_id' => false, + 'name' => false, + 'from' => false, + 'to' => false, + 'call_id' => false, + 'tag' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'conference_id' => 'conferenceId', + 'name' => 'name', + 'from' => 'from', + 'to' => 'to', + 'call_id' => 'callId', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'conference_id' => 'setConferenceId', + 'name' => 'setName', + 'from' => 'setFrom', + 'to' => 'setTo', + 'call_id' => 'setCallId', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'conference_id' => 'getConferenceId', + 'name' => 'getName', + 'from' => 'getFrom', + 'to' => 'getTo', + 'call_id' => 'getCallId', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('conference_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets conference_id + * + * @return string|null + */ + public function getConferenceId(): ?string + { + return $this->container['conference_id']; + } + + /** + * Sets conference_id + * + * @param string|null $conference_id The unique, Bandwidth-generated ID of the conference that was recorded + * + * @return $this + */ + public function setConferenceId(?string $conference_id): static + { + if (is_null($conference_id)) { + throw new InvalidArgumentException('non-nullable conference_id cannot be null'); + } + $this->container['conference_id'] = $conference_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The user-specified name of the conference that was recorded + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ConferenceMemberJoinCallback.php b/src/Model/ConferenceMemberJoinCallback.php new file mode 100644 index 0000000..52245c1 --- /dev/null +++ b/src/Model/ConferenceMemberJoinCallback.php @@ -0,0 +1,630 @@ + + */ +class ConferenceMemberJoinCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'conferenceMemberJoinCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'conference_id' => 'string', + 'name' => 'string', + 'from' => 'string', + 'to' => 'string', + 'call_id' => 'string', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'conference_id' => null, + 'name' => null, + 'from' => null, + 'to' => null, + 'call_id' => null, + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'conference_id' => false, + 'name' => false, + 'from' => false, + 'to' => false, + 'call_id' => false, + 'tag' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'conference_id' => 'conferenceId', + 'name' => 'name', + 'from' => 'from', + 'to' => 'to', + 'call_id' => 'callId', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'conference_id' => 'setConferenceId', + 'name' => 'setName', + 'from' => 'setFrom', + 'to' => 'setTo', + 'call_id' => 'setCallId', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'conference_id' => 'getConferenceId', + 'name' => 'getName', + 'from' => 'getFrom', + 'to' => 'getTo', + 'call_id' => 'getCallId', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('conference_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets conference_id + * + * @return string|null + */ + public function getConferenceId(): ?string + { + return $this->container['conference_id']; + } + + /** + * Sets conference_id + * + * @param string|null $conference_id The unique, Bandwidth-generated ID of the conference that was recorded + * + * @return $this + */ + public function setConferenceId(?string $conference_id): static + { + if (is_null($conference_id)) { + throw new InvalidArgumentException('non-nullable conference_id cannot be null'); + } + $this->container['conference_id'] = $conference_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The user-specified name of the conference that was recorded + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ConferenceRecordingAvailableCallback.php b/src/Model/ConferenceRecordingAvailableCallback.php new file mode 100644 index 0000000..3167bb2 --- /dev/null +++ b/src/Model/ConferenceRecordingAvailableCallback.php @@ -0,0 +1,841 @@ + + */ +class ConferenceRecordingAvailableCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'conferenceRecordingAvailableCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'conference_id' => 'string', + 'name' => 'string', + 'account_id' => 'string', + 'recording_id' => 'string', + 'channels' => 'int', + 'start_time' => '\DateTime', + 'end_time' => '\DateTime', + 'duration' => 'string', + 'file_format' => '\Bandwidth\Model\FileFormatEnum', + 'media_url' => 'string', + 'tag' => 'string', + 'status' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'conference_id' => null, + 'name' => null, + 'account_id' => null, + 'recording_id' => null, + 'channels' => 'int32', + 'start_time' => 'date-time', + 'end_time' => 'date-time', + 'duration' => null, + 'file_format' => null, + 'media_url' => 'uri', + 'tag' => null, + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'conference_id' => false, + 'name' => false, + 'account_id' => false, + 'recording_id' => false, + 'channels' => false, + 'start_time' => false, + 'end_time' => false, + 'duration' => false, + 'file_format' => false, + 'media_url' => true, + 'tag' => true, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'conference_id' => 'conferenceId', + 'name' => 'name', + 'account_id' => 'accountId', + 'recording_id' => 'recordingId', + 'channels' => 'channels', + 'start_time' => 'startTime', + 'end_time' => 'endTime', + 'duration' => 'duration', + 'file_format' => 'fileFormat', + 'media_url' => 'mediaUrl', + 'tag' => 'tag', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'conference_id' => 'setConferenceId', + 'name' => 'setName', + 'account_id' => 'setAccountId', + 'recording_id' => 'setRecordingId', + 'channels' => 'setChannels', + 'start_time' => 'setStartTime', + 'end_time' => 'setEndTime', + 'duration' => 'setDuration', + 'file_format' => 'setFileFormat', + 'media_url' => 'setMediaUrl', + 'tag' => 'setTag', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'conference_id' => 'getConferenceId', + 'name' => 'getName', + 'account_id' => 'getAccountId', + 'recording_id' => 'getRecordingId', + 'channels' => 'getChannels', + 'start_time' => 'getStartTime', + 'end_time' => 'getEndTime', + 'duration' => 'getDuration', + 'file_format' => 'getFileFormat', + 'media_url' => 'getMediaUrl', + 'tag' => 'getTag', + 'status' => 'getStatus' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('conference_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('recording_id', $data ?? [], null); + $this->setIfExists('channels', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('file_format', $data ?? [], null); + $this->setIfExists('media_url', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets conference_id + * + * @return string|null + */ + public function getConferenceId(): ?string + { + return $this->container['conference_id']; + } + + /** + * Sets conference_id + * + * @param string|null $conference_id The unique, Bandwidth-generated ID of the conference that was recorded + * + * @return $this + */ + public function setConferenceId(?string $conference_id): static + { + if (is_null($conference_id)) { + throw new InvalidArgumentException('non-nullable conference_id cannot be null'); + } + $this->container['conference_id'] = $conference_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The user-specified name of the conference that was recorded + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets recording_id + * + * @return string|null + */ + public function getRecordingId(): ?string + { + return $this->container['recording_id']; + } + + /** + * Sets recording_id + * + * @param string|null $recording_id The unique ID of this recording + * + * @return $this + */ + public function setRecordingId(?string $recording_id): static + { + if (is_null($recording_id)) { + throw new InvalidArgumentException('non-nullable recording_id cannot be null'); + } + $this->container['recording_id'] = $recording_id; + + return $this; + } + + /** + * Gets channels + * + * @return int|null + */ + public function getChannels(): ?int + { + return $this->container['channels']; + } + + /** + * Sets channels + * + * @param int|null $channels Always `1` for conference recordings; multi-channel recordings are not supported on conferences. + * + * @return $this + */ + public function setChannels(?int $channels): static + { + if (is_null($channels)) { + throw new InvalidArgumentException('non-nullable channels cannot be null'); + } + $this->container['channels'] = $channels; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets end_time + * + * @return \DateTime|null + */ + public function getEndTime(): ?\DateTime + { + return $this->container['end_time']; + } + + /** + * Sets end_time + * + * @param \DateTime|null $end_time The time that the recording ended in ISO-8601 format + * + * @return $this + */ + public function setEndTime(?\DateTime $end_time): static + { + if (is_null($end_time)) { + throw new InvalidArgumentException('non-nullable end_time cannot be null'); + } + $this->container['end_time'] = $end_time; + + return $this; + } + + /** + * Gets duration + * + * @return string|null + */ + public function getDuration(): ?string + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param string|null $duration The duration of the recording in ISO-8601 format + * + * @return $this + */ + public function setDuration(?string $duration): static + { + if (is_null($duration)) { + throw new InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets file_format + * + * @return \Bandwidth\Model\FileFormatEnum|null + */ + public function getFileFormat(): ?\Bandwidth\Model\FileFormatEnum + { + return $this->container['file_format']; + } + + /** + * Sets file_format + * + * @param \Bandwidth\Model\FileFormatEnum|null $file_format file_format + * + * @return $this + */ + public function setFileFormat(?\Bandwidth\Model\FileFormatEnum $file_format): static + { + if (is_null($file_format)) { + throw new InvalidArgumentException('non-nullable file_format cannot be null'); + } + $this->container['file_format'] = $file_format; + + return $this; + } + + /** + * Gets media_url + * + * @return string|null + */ + public function getMediaUrl(): ?string + { + return $this->container['media_url']; + } + + /** + * Sets media_url + * + * @param string|null $media_url The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * + * @return $this + */ + public function setMediaUrl(?string $media_url): static + { + if (is_null($media_url)) { + array_push($this->openAPINullablesSetToNull, 'media_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('media_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['media_url'] = $media_url; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status 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 $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ConferenceRecordingMetadata.php b/src/Model/ConferenceRecordingMetadata.php new file mode 100644 index 0000000..0131bea --- /dev/null +++ b/src/Model/ConferenceRecordingMetadata.php @@ -0,0 +1,765 @@ + + */ +class ConferenceRecordingMetadata implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'conferenceRecordingMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'account_id' => 'string', + 'conference_id' => 'string', + 'name' => 'string', + 'recording_id' => 'string', + 'duration' => 'string', + 'channels' => 'int', + 'start_time' => '\DateTime', + 'end_time' => '\DateTime', + 'file_format' => '\Bandwidth\Model\FileFormatEnum', + 'status' => 'string', + 'media_url' => 'string', + 'recording_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'account_id' => null, + 'conference_id' => null, + 'name' => null, + 'recording_id' => null, + 'duration' => null, + 'channels' => 'int32', + 'start_time' => 'date-time', + 'end_time' => 'date-time', + 'file_format' => null, + 'status' => null, + 'media_url' => 'uri', + 'recording_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'conference_id' => false, + 'name' => false, + 'recording_id' => false, + 'duration' => false, + 'channels' => false, + 'start_time' => false, + 'end_time' => false, + 'file_format' => false, + 'status' => false, + 'media_url' => true, + 'recording_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'account_id' => 'accountId', + 'conference_id' => 'conferenceId', + 'name' => 'name', + 'recording_id' => 'recordingId', + 'duration' => 'duration', + 'channels' => 'channels', + 'start_time' => 'startTime', + 'end_time' => 'endTime', + 'file_format' => 'fileFormat', + 'status' => 'status', + 'media_url' => 'mediaUrl', + 'recording_name' => 'recordingName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'account_id' => 'setAccountId', + 'conference_id' => 'setConferenceId', + 'name' => 'setName', + 'recording_id' => 'setRecordingId', + 'duration' => 'setDuration', + 'channels' => 'setChannels', + 'start_time' => 'setStartTime', + 'end_time' => 'setEndTime', + 'file_format' => 'setFileFormat', + 'status' => 'setStatus', + 'media_url' => 'setMediaUrl', + 'recording_name' => 'setRecordingName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'account_id' => 'getAccountId', + 'conference_id' => 'getConferenceId', + 'name' => 'getName', + 'recording_id' => 'getRecordingId', + 'duration' => 'getDuration', + 'channels' => 'getChannels', + 'start_time' => 'getStartTime', + 'end_time' => 'getEndTime', + 'file_format' => 'getFileFormat', + 'status' => 'getStatus', + 'media_url' => 'getMediaUrl', + 'recording_name' => 'getRecordingName' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('conference_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('recording_id', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('channels', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('file_format', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('media_url', $data ?? [], null); + $this->setIfExists('recording_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets conference_id + * + * @return string|null + */ + public function getConferenceId(): ?string + { + return $this->container['conference_id']; + } + + /** + * Sets conference_id + * + * @param string|null $conference_id The unique, Bandwidth-generated ID of the conference that was recorded + * + * @return $this + */ + public function setConferenceId(?string $conference_id): static + { + if (is_null($conference_id)) { + throw new InvalidArgumentException('non-nullable conference_id cannot be null'); + } + $this->container['conference_id'] = $conference_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The user-specified name of the conference that was recorded + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets recording_id + * + * @return string|null + */ + public function getRecordingId(): ?string + { + return $this->container['recording_id']; + } + + /** + * Sets recording_id + * + * @param string|null $recording_id The unique ID of this recording + * + * @return $this + */ + public function setRecordingId(?string $recording_id): static + { + if (is_null($recording_id)) { + throw new InvalidArgumentException('non-nullable recording_id cannot be null'); + } + $this->container['recording_id'] = $recording_id; + + return $this; + } + + /** + * Gets duration + * + * @return string|null + */ + public function getDuration(): ?string + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param string|null $duration The duration of the recording in ISO-8601 format + * + * @return $this + */ + public function setDuration(?string $duration): static + { + if (is_null($duration)) { + throw new InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets channels + * + * @return int|null + */ + public function getChannels(): ?int + { + return $this->container['channels']; + } + + /** + * Sets channels + * + * @param int|null $channels Always `1` for conference recordings; multi-channel recordings are not supported on conferences. + * + * @return $this + */ + public function setChannels(?int $channels): static + { + if (is_null($channels)) { + throw new InvalidArgumentException('non-nullable channels cannot be null'); + } + $this->container['channels'] = $channels; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets end_time + * + * @return \DateTime|null + */ + public function getEndTime(): ?\DateTime + { + return $this->container['end_time']; + } + + /** + * Sets end_time + * + * @param \DateTime|null $end_time The time that the recording ended in ISO-8601 format + * + * @return $this + */ + public function setEndTime(?\DateTime $end_time): static + { + if (is_null($end_time)) { + throw new InvalidArgumentException('non-nullable end_time cannot be null'); + } + $this->container['end_time'] = $end_time; + + return $this; + } + + /** + * Gets file_format + * + * @return \Bandwidth\Model\FileFormatEnum|null + */ + public function getFileFormat(): ?\Bandwidth\Model\FileFormatEnum + { + return $this->container['file_format']; + } + + /** + * Sets file_format + * + * @param \Bandwidth\Model\FileFormatEnum|null $file_format file_format + * + * @return $this + */ + public function setFileFormat(?\Bandwidth\Model\FileFormatEnum $file_format): static + { + if (is_null($file_format)) { + throw new InvalidArgumentException('non-nullable file_format cannot be null'); + } + $this->container['file_format'] = $file_format; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status 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 $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets media_url + * + * @return string|null + */ + public function getMediaUrl(): ?string + { + return $this->container['media_url']; + } + + /** + * Sets media_url + * + * @param string|null $media_url The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * + * @return $this + */ + public function setMediaUrl(?string $media_url): static + { + if (is_null($media_url)) { + array_push($this->openAPINullablesSetToNull, 'media_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('media_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['media_url'] = $media_url; + + return $this; + } + + /** + * Gets recording_name + * + * @return string|null + */ + public function getRecordingName(): ?string + { + return $this->container['recording_name']; + } + + /** + * Sets recording_name + * + * @param string|null $recording_name A name to identify this recording. + * + * @return $this + */ + public function setRecordingName(?string $recording_name): static + { + if (is_null($recording_name)) { + throw new InvalidArgumentException('non-nullable recording_name cannot be null'); + } + $this->container['recording_name'] = $recording_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ConferenceRedirectCallback.php b/src/Model/ConferenceRedirectCallback.php new file mode 100644 index 0000000..e4f451b --- /dev/null +++ b/src/Model/ConferenceRedirectCallback.php @@ -0,0 +1,528 @@ + + */ +class ConferenceRedirectCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'conferenceRedirectCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'conference_id' => 'string', + 'name' => 'string', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'conference_id' => null, + 'name' => null, + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'conference_id' => false, + 'name' => false, + 'tag' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'conference_id' => 'conferenceId', + 'name' => 'name', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'conference_id' => 'setConferenceId', + 'name' => 'setName', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'conference_id' => 'getConferenceId', + 'name' => 'getName', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('conference_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets conference_id + * + * @return string|null + */ + public function getConferenceId(): ?string + { + return $this->container['conference_id']; + } + + /** + * Sets conference_id + * + * @param string|null $conference_id The unique, Bandwidth-generated ID of the conference that was recorded + * + * @return $this + */ + public function setConferenceId(?string $conference_id): static + { + if (is_null($conference_id)) { + throw new InvalidArgumentException('non-nullable conference_id cannot be null'); + } + $this->container['conference_id'] = $conference_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName(): ?string + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The user-specified name of the conference that was recorded + * + * @return $this + */ + public function setName(?string $name): static + { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ConferenceStateEnum.php b/src/Model/ConferenceStateEnum.php new file mode 100644 index 0000000..2e7b893 --- /dev/null +++ b/src/Model/ConferenceStateEnum.php @@ -0,0 +1,46 @@ + + */ +class Contact implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'contact'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'first_name' => 'string', + 'last_name' => 'string', + 'email' => 'string', + 'phone_number' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'first_name' => null, + 'last_name' => null, + 'email' => 'email', + 'phone_number' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'first_name' => false, + 'last_name' => false, + 'email' => false, + 'phone_number' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'first_name' => 'firstName', + 'last_name' => 'lastName', + 'email' => 'email', + 'phone_number' => 'phoneNumber' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'first_name' => 'setFirstName', + 'last_name' => 'setLastName', + 'email' => 'setEmail', + 'phone_number' => 'setPhoneNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'first_name' => 'getFirstName', + 'last_name' => 'getLastName', + 'email' => 'getEmail', + 'phone_number' => 'getPhoneNumber' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('first_name', $data ?? [], null); + $this->setIfExists('last_name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['first_name'] === null) { + $invalidProperties[] = "'first_name' can't be null"; + } + if ((mb_strlen($this->container['first_name']) > 500)) { + $invalidProperties[] = "invalid value for 'first_name', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['first_name']) < 1)) { + $invalidProperties[] = "invalid value for 'first_name', the character length must be bigger than or equal to 1."; + } + + if ($this->container['last_name'] === null) { + $invalidProperties[] = "'last_name' can't be null"; + } + if ((mb_strlen($this->container['last_name']) > 500)) { + $invalidProperties[] = "invalid value for 'last_name', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['last_name']) < 1)) { + $invalidProperties[] = "invalid value for 'last_name', the character length must be bigger than or equal to 1."; + } + + if ($this->container['email'] === null) { + $invalidProperties[] = "'email' can't be null"; + } + if ((mb_strlen($this->container['email']) > 500)) { + $invalidProperties[] = "invalid value for 'email', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['email']) < 0)) { + $invalidProperties[] = "invalid value for 'email', the character length must be bigger than or equal to 0."; + } + + if (!preg_match("/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/", $this->container['email'])) { + $invalidProperties[] = "invalid value for 'email', must be conform to the pattern /^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/."; + } + + if ($this->container['phone_number'] === null) { + $invalidProperties[] = "'phone_number' can't be null"; + } + if ((mb_strlen($this->container['phone_number']) > 500)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['phone_number']) < 1)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets first_name + * + * @return string + */ + public function getFirstName(): string + { + return $this->container['first_name']; + } + + /** + * Sets first_name + * + * @param string $first_name The first name of the business contact using the toll-free number. + * + * @return $this + */ + public function setFirstName(string $first_name): static + { + if (is_null($first_name)) { + throw new InvalidArgumentException('non-nullable first_name cannot be null'); + } + if ((mb_strlen($first_name) > 500)) { + throw new InvalidArgumentException('invalid length for $first_name when calling Contact., must be smaller than or equal to 500.'); + } + if ((mb_strlen($first_name) < 1)) { + throw new InvalidArgumentException('invalid length for $first_name when calling Contact., must be bigger than or equal to 1.'); + } + + $this->container['first_name'] = $first_name; + + return $this; + } + + /** + * Gets last_name + * + * @return string + */ + public function getLastName(): string + { + return $this->container['last_name']; + } + + /** + * Sets last_name + * + * @param string $last_name The last name of the business contact using the toll-free number. + * + * @return $this + */ + public function setLastName(string $last_name): static + { + if (is_null($last_name)) { + throw new InvalidArgumentException('non-nullable last_name cannot be null'); + } + if ((mb_strlen($last_name) > 500)) { + throw new InvalidArgumentException('invalid length for $last_name when calling Contact., must be smaller than or equal to 500.'); + } + if ((mb_strlen($last_name) < 1)) { + throw new InvalidArgumentException('invalid length for $last_name when calling Contact., must be bigger than or equal to 1.'); + } + + $this->container['last_name'] = $last_name; + + return $this; + } + + /** + * Gets email + * + * @return string + */ + public function getEmail(): string + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string $email email + * + * @return $this + */ + public function setEmail(string $email): static + { + if (is_null($email)) { + throw new InvalidArgumentException('non-nullable email cannot be null'); + } + if ((mb_strlen($email) > 500)) { + throw new InvalidArgumentException('invalid length for $email when calling Contact., must be smaller than or equal to 500.'); + } + if ((mb_strlen($email) < 0)) { + throw new InvalidArgumentException('invalid length for $email when calling Contact., must be bigger than or equal to 0.'); + } + if ((!preg_match("/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/", ObjectSerializer::toString($email)))) { + throw new InvalidArgumentException("invalid value for \$email when calling Contact., must conform to the pattern /^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/."); + } + + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets phone_number + * + * @return string + */ + public function getPhoneNumber(): string + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string $phone_number Contact telephone number + * + * @return $this + */ + public function setPhoneNumber(string $phone_number): static + { + if (is_null($phone_number)) { + throw new InvalidArgumentException('non-nullable phone_number cannot be null'); + } + if ((mb_strlen($phone_number) > 500)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling Contact., must be smaller than or equal to 500.'); + } + if ((mb_strlen($phone_number) < 1)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling Contact., must be bigger than or equal to 1.'); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateAsyncBulkLookupResponse.php b/src/Model/CreateAsyncBulkLookupResponse.php new file mode 100644 index 0000000..24cd226 --- /dev/null +++ b/src/Model/CreateAsyncBulkLookupResponse.php @@ -0,0 +1,452 @@ + + */ +class CreateAsyncBulkLookupResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createAsyncBulkLookupResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'links' => '\Bandwidth\Model\LinkSchema[]', + 'data' => '\Bandwidth\Model\CreateAsyncBulkLookupResponseData', + 'errors' => '\Bandwidth\Model\LookupErrorSchema[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'links' => null, + 'data' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'links' => false, + 'data' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'links' => 'links', + 'data' => 'data', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'links' => 'setLinks', + 'data' => 'setData', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'links' => 'getLinks', + 'data' => 'getData', + 'errors' => 'getErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return \Bandwidth\Model\LinkSchema[]|null + */ + public function getLinks(): ?array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Bandwidth\Model\LinkSchema[]|null $links Links for pagination (if applicable) + * + * @return $this + */ + public function setLinks(?array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets data + * + * @return \Bandwidth\Model\CreateAsyncBulkLookupResponseData|null + */ + public function getData(): ?\Bandwidth\Model\CreateAsyncBulkLookupResponseData + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Bandwidth\Model\CreateAsyncBulkLookupResponseData|null $data data + * + * @return $this + */ + public function setData(?\Bandwidth\Model\CreateAsyncBulkLookupResponseData $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets errors + * + * @return \Bandwidth\Model\LookupErrorSchema[]|null + */ + public function getErrors(): ?array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Bandwidth\Model\LookupErrorSchema[]|null $errors errors + * + * @return $this + */ + public function setErrors(?array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateAsyncBulkLookupResponseData.php b/src/Model/CreateAsyncBulkLookupResponseData.php new file mode 100644 index 0000000..11b0028 --- /dev/null +++ b/src/Model/CreateAsyncBulkLookupResponseData.php @@ -0,0 +1,419 @@ + + */ +class CreateAsyncBulkLookupResponseData implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createAsyncBulkLookupResponse_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'request_id' => 'string', + 'status' => '\Bandwidth\Model\InProgressLookupStatusEnum' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'request_id' => 'uuid', + 'status' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'request_id' => false, + 'status' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'request_id' => 'requestId', + 'status' => 'status' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'request_id' => 'setRequestId', + 'status' => 'setStatus' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'request_id' => 'getRequestId', + 'status' => 'getStatus' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId(): ?string + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id The phone number lookup request ID from Bandwidth. + * + * @return $this + */ + public function setRequestId(?string $request_id): static + { + if (is_null($request_id)) { + throw new InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets status + * + * @return \Bandwidth\Model\InProgressLookupStatusEnum|null + */ + public function getStatus(): ?\Bandwidth\Model\InProgressLookupStatusEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\InProgressLookupStatusEnum|null $status status + * + * @return $this + */ + public function setStatus(?\Bandwidth\Model\InProgressLookupStatusEnum $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateCall.php b/src/Model/CreateCall.php new file mode 100644 index 0000000..750e081 --- /dev/null +++ b/src/Model/CreateCall.php @@ -0,0 +1,1305 @@ + + */ +class CreateCall implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createCall'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'to' => 'string', + 'from' => 'string', + 'privacy' => 'bool', + 'display_name' => 'string', + 'uui' => 'string', + 'application_id' => 'string', + 'answer_url' => 'string', + 'answer_method' => '\Bandwidth\Model\CallbackMethodEnum', + 'username' => 'string', + 'password' => 'string', + 'answer_fallback_url' => 'string', + 'answer_fallback_method' => '\Bandwidth\Model\CallbackMethodEnum', + 'fallback_username' => 'string', + 'fallback_password' => 'string', + 'disconnect_url' => 'string', + 'disconnect_method' => '\Bandwidth\Model\CallbackMethodEnum', + 'call_timeout' => 'float', + 'callback_timeout' => 'float', + 'machine_detection' => '\Bandwidth\Model\MachineDetectionConfiguration', + 'priority' => 'int', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'to' => null, + 'from' => null, + 'privacy' => null, + 'display_name' => null, + 'uui' => null, + 'application_id' => null, + 'answer_url' => 'uri', + 'answer_method' => null, + 'username' => null, + 'password' => null, + 'answer_fallback_url' => 'uri', + 'answer_fallback_method' => null, + 'fallback_username' => null, + 'fallback_password' => null, + 'disconnect_url' => 'uri', + 'disconnect_method' => null, + 'call_timeout' => 'double', + 'callback_timeout' => 'double', + 'machine_detection' => null, + 'priority' => null, + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'to' => false, + 'from' => false, + 'privacy' => true, + 'display_name' => true, + 'uui' => true, + 'application_id' => false, + 'answer_url' => false, + 'answer_method' => true, + 'username' => true, + 'password' => true, + 'answer_fallback_url' => true, + 'answer_fallback_method' => true, + 'fallback_username' => true, + 'fallback_password' => true, + 'disconnect_url' => true, + 'disconnect_method' => true, + 'call_timeout' => true, + 'callback_timeout' => true, + 'machine_detection' => false, + 'priority' => true, + 'tag' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'to' => 'to', + 'from' => 'from', + 'privacy' => 'privacy', + 'display_name' => 'displayName', + 'uui' => 'uui', + 'application_id' => 'applicationId', + 'answer_url' => 'answerUrl', + 'answer_method' => 'answerMethod', + 'username' => 'username', + 'password' => 'password', + 'answer_fallback_url' => 'answerFallbackUrl', + 'answer_fallback_method' => 'answerFallbackMethod', + 'fallback_username' => 'fallbackUsername', + 'fallback_password' => 'fallbackPassword', + 'disconnect_url' => 'disconnectUrl', + 'disconnect_method' => 'disconnectMethod', + 'call_timeout' => 'callTimeout', + 'callback_timeout' => 'callbackTimeout', + 'machine_detection' => 'machineDetection', + 'priority' => 'priority', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'to' => 'setTo', + 'from' => 'setFrom', + 'privacy' => 'setPrivacy', + 'display_name' => 'setDisplayName', + 'uui' => 'setUui', + 'application_id' => 'setApplicationId', + 'answer_url' => 'setAnswerUrl', + 'answer_method' => 'setAnswerMethod', + 'username' => 'setUsername', + 'password' => 'setPassword', + 'answer_fallback_url' => 'setAnswerFallbackUrl', + 'answer_fallback_method' => 'setAnswerFallbackMethod', + 'fallback_username' => 'setFallbackUsername', + 'fallback_password' => 'setFallbackPassword', + 'disconnect_url' => 'setDisconnectUrl', + 'disconnect_method' => 'setDisconnectMethod', + 'call_timeout' => 'setCallTimeout', + 'callback_timeout' => 'setCallbackTimeout', + 'machine_detection' => 'setMachineDetection', + 'priority' => 'setPriority', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'to' => 'getTo', + 'from' => 'getFrom', + 'privacy' => 'getPrivacy', + 'display_name' => 'getDisplayName', + 'uui' => 'getUui', + 'application_id' => 'getApplicationId', + 'answer_url' => 'getAnswerUrl', + 'answer_method' => 'getAnswerMethod', + 'username' => 'getUsername', + 'password' => 'getPassword', + 'answer_fallback_url' => 'getAnswerFallbackUrl', + 'answer_fallback_method' => 'getAnswerFallbackMethod', + 'fallback_username' => 'getFallbackUsername', + 'fallback_password' => 'getFallbackPassword', + 'disconnect_url' => 'getDisconnectUrl', + 'disconnect_method' => 'getDisconnectMethod', + 'call_timeout' => 'getCallTimeout', + 'callback_timeout' => 'getCallbackTimeout', + 'machine_detection' => 'getMachineDetection', + 'priority' => 'getPriority', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('display_name', $data ?? [], null); + $this->setIfExists('uui', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('answer_url', $data ?? [], null); + $this->setIfExists('answer_method', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('answer_fallback_url', $data ?? [], null); + $this->setIfExists('answer_fallback_method', $data ?? [], null); + $this->setIfExists('fallback_username', $data ?? [], null); + $this->setIfExists('fallback_password', $data ?? [], null); + $this->setIfExists('disconnect_url', $data ?? [], null); + $this->setIfExists('disconnect_method', $data ?? [], null); + $this->setIfExists('call_timeout', $data ?? [], 30); + $this->setIfExists('callback_timeout', $data ?? [], 15); + $this->setIfExists('machine_detection', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], 5); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if (!is_null($this->container['display_name']) && (mb_strlen($this->container['display_name']) > 256)) { + $invalidProperties[] = "invalid value for 'display_name', the character length must be smaller than or equal to 256."; + } + + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['answer_url'] === null) { + $invalidProperties[] = "'answer_url' can't be null"; + } + if ((mb_strlen($this->container['answer_url']) > 2048)) { + $invalidProperties[] = "invalid value for 'answer_url', the character length must be smaller than or equal to 2048."; + } + + if (!is_null($this->container['username']) && (mb_strlen($this->container['username']) > 1024)) { + $invalidProperties[] = "invalid value for 'username', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) > 1024)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['answer_fallback_url']) && (mb_strlen($this->container['answer_fallback_url']) > 2048)) { + $invalidProperties[] = "invalid value for 'answer_fallback_url', the character length must be smaller than or equal to 2048."; + } + + if (!is_null($this->container['fallback_username']) && (mb_strlen($this->container['fallback_username']) > 1024)) { + $invalidProperties[] = "invalid value for 'fallback_username', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['fallback_password']) && (mb_strlen($this->container['fallback_password']) > 1024)) { + $invalidProperties[] = "invalid value for 'fallback_password', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['disconnect_url']) && (mb_strlen($this->container['disconnect_url']) > 2048)) { + $invalidProperties[] = "invalid value for 'disconnect_url', the character length must be smaller than or equal to 2048."; + } + + if (!is_null($this->container['call_timeout']) && ($this->container['call_timeout'] > 300)) { + $invalidProperties[] = "invalid value for 'call_timeout', must be smaller than or equal to 300."; + } + + if (!is_null($this->container['call_timeout']) && ($this->container['call_timeout'] < 1)) { + $invalidProperties[] = "invalid value for 'call_timeout', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['callback_timeout']) && ($this->container['callback_timeout'] > 25)) { + $invalidProperties[] = "invalid value for 'callback_timeout', must be smaller than or equal to 25."; + } + + if (!is_null($this->container['callback_timeout']) && ($this->container['callback_timeout'] < 1)) { + $invalidProperties[] = "invalid value for 'callback_timeout', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['priority']) && ($this->container['priority'] > 5)) { + $invalidProperties[] = "invalid value for 'priority', must be smaller than or equal to 5."; + } + + if (!is_null($this->container['priority']) && ($this->container['priority'] < 1)) { + $invalidProperties[] = "invalid value for 'priority', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['tag']) && (mb_strlen($this->container['tag']) > 4096)) { + $invalidProperties[] = "invalid value for 'tag', the character length must be smaller than or equal to 4096."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to + * + * @return string + */ + public function getTo(): string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to 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 $this + */ + public function setTo(string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from A Bandwidth phone number on your account the call should come from (must be in E.164 format, like `+15555551212`) even if `privacy` is set to true. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets privacy + * + * @return bool|null + */ + public function getPrivacy(): ?bool + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param bool|null $privacy Hide the calling number. The `displayName` field can be used to customize the displayed name. + * + * @return $this + */ + public function setPrivacy(?bool $privacy): static + { + if (is_null($privacy)) { + array_push($this->openAPINullablesSetToNull, 'privacy'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('privacy', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets display_name + * + * @return string|null + */ + public function getDisplayName(): ?string + { + return $this->container['display_name']; + } + + /** + * Sets display_name + * + * @param string|null $display_name The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. If `privacy` is true, only the following values are valid: `Restricted`, `Anonymous`, `Private`, or `Unavailable`. + * + * @return $this + */ + public function setDisplayName(?string $display_name): static + { + if (is_null($display_name)) { + array_push($this->openAPINullablesSetToNull, 'display_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('display_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($display_name) && (mb_strlen($display_name) > 256)) { + throw new InvalidArgumentException('invalid length for $display_name when calling CreateCall., must be smaller than or equal to 256.'); + } + + $this->container['display_name'] = $display_name; + + return $this; + } + + /** + * Gets uui + * + * @return string|null + */ + public function getUui(): ?string + { + return $this->container['uui']; + } + + /** + * Sets uui + * + * @param string|null $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 RFC 7433. Only 'jwt', 'base64' and 'hex' encodings are allowed. The entire value cannot exceed 350 characters, including parameters and separators. + * + * @return $this + */ + public function setUui(?string $uui): static + { + if (is_null($uui)) { + array_push($this->openAPINullablesSetToNull, 'uui'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('uui', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['uui'] = $uui; + + return $this; + } + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The id of the application associated with the `from` number. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets answer_url + * + * @return string + */ + public function getAnswerUrl(): string + { + return $this->container['answer_url']; + } + + /** + * Sets answer_url + * + * @param string $answer_url 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`. + * + * @return $this + */ + public function setAnswerUrl(string $answer_url): static + { + if (is_null($answer_url)) { + throw new InvalidArgumentException('non-nullable answer_url cannot be null'); + } + if ((mb_strlen($answer_url) > 2048)) { + throw new InvalidArgumentException('invalid length for $answer_url when calling CreateCall., must be smaller than or equal to 2048.'); + } + + $this->container['answer_url'] = $answer_url; + + return $this; + } + + /** + * Gets answer_method + * + * @return \Bandwidth\Model\CallbackMethodEnum|null + */ + public function getAnswerMethod(): ?\Bandwidth\Model\CallbackMethodEnum + { + return $this->container['answer_method']; + } + + /** + * Sets answer_method + * + * @param \Bandwidth\Model\CallbackMethodEnum|null $answer_method answer_method + * + * @return $this + */ + public function setAnswerMethod(?\Bandwidth\Model\CallbackMethodEnum $answer_method): static + { + if (is_null($answer_method)) { + array_push($this->openAPINullablesSetToNull, 'answer_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_method'] = $answer_method; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username Basic auth username. + * + * @return $this + */ + public function setUsername(?string $username): static + { + if (is_null($username)) { + array_push($this->openAPINullablesSetToNull, 'username'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('username', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($username) && (mb_strlen($username) > 1024)) { + throw new InvalidArgumentException('invalid length for $username when calling CreateCall., must be smaller than or equal to 1024.'); + } + + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password Basic auth password. + * + * @return $this + */ + public function setPassword(?string $password): static + { + if (is_null($password)) { + array_push($this->openAPINullablesSetToNull, 'password'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('password', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($password) && (mb_strlen($password) > 1024)) { + throw new InvalidArgumentException('invalid length for $password when calling CreateCall., must be smaller than or equal to 1024.'); + } + + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets answer_fallback_url + * + * @return string|null + */ + public function getAnswerFallbackUrl(): ?string + { + return $this->container['answer_fallback_url']; + } + + /** + * Sets answer_fallback_url + * + * @param string|null $answer_fallback_url 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 $this + */ + public function setAnswerFallbackUrl(?string $answer_fallback_url): static + { + if (is_null($answer_fallback_url)) { + array_push($this->openAPINullablesSetToNull, 'answer_fallback_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_fallback_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($answer_fallback_url) && (mb_strlen($answer_fallback_url) > 2048)) { + throw new InvalidArgumentException('invalid length for $answer_fallback_url when calling CreateCall., must be smaller than or equal to 2048.'); + } + + $this->container['answer_fallback_url'] = $answer_fallback_url; + + return $this; + } + + /** + * Gets answer_fallback_method + * + * @return \Bandwidth\Model\CallbackMethodEnum|null + */ + public function getAnswerFallbackMethod(): ?\Bandwidth\Model\CallbackMethodEnum + { + return $this->container['answer_fallback_method']; + } + + /** + * Sets answer_fallback_method + * + * @param \Bandwidth\Model\CallbackMethodEnum|null $answer_fallback_method answer_fallback_method + * + * @return $this + */ + public function setAnswerFallbackMethod(?\Bandwidth\Model\CallbackMethodEnum $answer_fallback_method): static + { + if (is_null($answer_fallback_method)) { + array_push($this->openAPINullablesSetToNull, 'answer_fallback_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_fallback_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_fallback_method'] = $answer_fallback_method; + + return $this; + } + + /** + * Gets fallback_username + * + * @return string|null + */ + public function getFallbackUsername(): ?string + { + return $this->container['fallback_username']; + } + + /** + * Sets fallback_username + * + * @param string|null $fallback_username Basic auth username. + * + * @return $this + */ + public function setFallbackUsername(?string $fallback_username): static + { + if (is_null($fallback_username)) { + array_push($this->openAPINullablesSetToNull, 'fallback_username'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_username', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($fallback_username) && (mb_strlen($fallback_username) > 1024)) { + throw new InvalidArgumentException('invalid length for $fallback_username when calling CreateCall., must be smaller than or equal to 1024.'); + } + + $this->container['fallback_username'] = $fallback_username; + + return $this; + } + + /** + * Gets fallback_password + * + * @return string|null + */ + public function getFallbackPassword(): ?string + { + return $this->container['fallback_password']; + } + + /** + * Sets fallback_password + * + * @param string|null $fallback_password Basic auth password. + * + * @return $this + */ + public function setFallbackPassword(?string $fallback_password): static + { + if (is_null($fallback_password)) { + array_push($this->openAPINullablesSetToNull, 'fallback_password'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_password', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($fallback_password) && (mb_strlen($fallback_password) > 1024)) { + throw new InvalidArgumentException('invalid length for $fallback_password when calling CreateCall., must be smaller than or equal to 1024.'); + } + + $this->container['fallback_password'] = $fallback_password; + + return $this; + } + + /** + * Gets disconnect_url + * + * @return string|null + */ + public function getDisconnectUrl(): ?string + { + return $this->container['disconnect_url']; + } + + /** + * Sets disconnect_url + * + * @param string|null $disconnect_url The URL to send the Disconnect event to when the call ends. This event does not expect a BXML response. + * + * @return $this + */ + public function setDisconnectUrl(?string $disconnect_url): static + { + if (is_null($disconnect_url)) { + array_push($this->openAPINullablesSetToNull, 'disconnect_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('disconnect_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($disconnect_url) && (mb_strlen($disconnect_url) > 2048)) { + throw new InvalidArgumentException('invalid length for $disconnect_url when calling CreateCall., must be smaller than or equal to 2048.'); + } + + $this->container['disconnect_url'] = $disconnect_url; + + return $this; + } + + /** + * Gets disconnect_method + * + * @return \Bandwidth\Model\CallbackMethodEnum|null + */ + public function getDisconnectMethod(): ?\Bandwidth\Model\CallbackMethodEnum + { + return $this->container['disconnect_method']; + } + + /** + * Sets disconnect_method + * + * @param \Bandwidth\Model\CallbackMethodEnum|null $disconnect_method disconnect_method + * + * @return $this + */ + public function setDisconnectMethod(?\Bandwidth\Model\CallbackMethodEnum $disconnect_method): static + { + if (is_null($disconnect_method)) { + array_push($this->openAPINullablesSetToNull, 'disconnect_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('disconnect_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['disconnect_method'] = $disconnect_method; + + return $this; + } + + /** + * Gets call_timeout + * + * @return float|null + */ + public function getCallTimeout(): ?float + { + return $this->container['call_timeout']; + } + + /** + * Sets call_timeout + * + * @param float|null $call_timeout 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. + * + * @return $this + */ + public function setCallTimeout(?float $call_timeout): static + { + if (is_null($call_timeout)) { + array_push($this->openAPINullablesSetToNull, 'call_timeout'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('call_timeout', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($call_timeout) && ($call_timeout > 300)) { + throw new InvalidArgumentException('invalid value for $call_timeout when calling CreateCall., must be smaller than or equal to 300.'); + } + if (!is_null($call_timeout) && ($call_timeout < 1)) { + throw new InvalidArgumentException('invalid value for $call_timeout when calling CreateCall., must be bigger than or equal to 1.'); + } + + $this->container['call_timeout'] = $call_timeout; + + return $this; + } + + /** + * Gets callback_timeout + * + * @return float|null + */ + public function getCallbackTimeout(): ?float + { + return $this->container['callback_timeout']; + } + + /** + * Sets callback_timeout + * + * @param float|null $callback_timeout 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. + * + * @return $this + */ + public function setCallbackTimeout(?float $callback_timeout): static + { + if (is_null($callback_timeout)) { + array_push($this->openAPINullablesSetToNull, 'callback_timeout'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('callback_timeout', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($callback_timeout) && ($callback_timeout > 25)) { + throw new InvalidArgumentException('invalid value for $callback_timeout when calling CreateCall., must be smaller than or equal to 25.'); + } + if (!is_null($callback_timeout) && ($callback_timeout < 1)) { + throw new InvalidArgumentException('invalid value for $callback_timeout when calling CreateCall., must be bigger than or equal to 1.'); + } + + $this->container['callback_timeout'] = $callback_timeout; + + return $this; + } + + /** + * Gets machine_detection + * + * @return \Bandwidth\Model\MachineDetectionConfiguration|null + */ + public function getMachineDetection(): ?\Bandwidth\Model\MachineDetectionConfiguration + { + return $this->container['machine_detection']; + } + + /** + * Sets machine_detection + * + * @param \Bandwidth\Model\MachineDetectionConfiguration|null $machine_detection machine_detection + * + * @return $this + */ + public function setMachineDetection(?\Bandwidth\Model\MachineDetectionConfiguration $machine_detection): static + { + if (is_null($machine_detection)) { + throw new InvalidArgumentException('non-nullable machine_detection cannot be null'); + } + $this->container['machine_detection'] = $machine_detection; + + return $this; + } + + /** + * Gets priority + * + * @return int|null + */ + public function getPriority(): ?int + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param int|null $priority 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. + * + * @return $this + */ + public function setPriority(?int $priority): static + { + if (is_null($priority)) { + array_push($this->openAPINullablesSetToNull, 'priority'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('priority', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($priority) && ($priority > 5)) { + throw new InvalidArgumentException('invalid value for $priority when calling CreateCall., must be smaller than or equal to 5.'); + } + if (!is_null($priority) && ($priority < 1)) { + throw new InvalidArgumentException('invalid value for $priority when calling CreateCall., must be bigger than or equal to 1.'); + } + + $this->container['priority'] = $priority; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag 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 4096 characters. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($tag) && (mb_strlen($tag) > 4096)) { + throw new InvalidArgumentException('invalid length for $tag when calling CreateCall., must be smaller than or equal to 4096.'); + } + + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateCallResponse.php b/src/Model/CreateCallResponse.php new file mode 100644 index 0000000..01008a1 --- /dev/null +++ b/src/Model/CreateCallResponse.php @@ -0,0 +1,1207 @@ + + */ +class CreateCallResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createCallResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'application_id' => 'string', + 'account_id' => 'string', + 'call_id' => 'string', + 'to' => 'string', + 'from' => 'string', + 'enqueued_time' => '\DateTime', + 'call_url' => 'string', + 'call_timeout' => 'float', + 'callback_timeout' => 'float', + 'tag' => 'string', + 'answer_method' => '\Bandwidth\Model\CallbackMethodEnum', + 'answer_url' => 'string', + 'answer_fallback_method' => '\Bandwidth\Model\CallbackMethodEnum', + 'answer_fallback_url' => 'string', + 'disconnect_method' => '\Bandwidth\Model\CallbackMethodEnum', + 'disconnect_url' => 'string', + 'username' => 'string', + 'password' => 'string', + 'fallback_username' => 'string', + 'fallback_password' => 'string', + 'priority' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'application_id' => null, + 'account_id' => null, + 'call_id' => null, + 'to' => null, + 'from' => null, + 'enqueued_time' => 'date-time', + 'call_url' => 'uri', + 'call_timeout' => 'double', + 'callback_timeout' => 'double', + 'tag' => null, + 'answer_method' => null, + 'answer_url' => 'uri', + 'answer_fallback_method' => null, + 'answer_fallback_url' => 'uri', + 'disconnect_method' => null, + 'disconnect_url' => 'uri', + 'username' => null, + 'password' => null, + 'fallback_username' => null, + 'fallback_password' => null, + 'priority' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'application_id' => false, + 'account_id' => false, + 'call_id' => false, + 'to' => false, + 'from' => false, + 'enqueued_time' => true, + 'call_url' => false, + 'call_timeout' => false, + 'callback_timeout' => false, + 'tag' => true, + 'answer_method' => true, + 'answer_url' => false, + 'answer_fallback_method' => true, + 'answer_fallback_url' => true, + 'disconnect_method' => true, + 'disconnect_url' => true, + 'username' => true, + 'password' => true, + 'fallback_username' => true, + 'fallback_password' => true, + 'priority' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'application_id' => 'applicationId', + 'account_id' => 'accountId', + 'call_id' => 'callId', + 'to' => 'to', + 'from' => 'from', + 'enqueued_time' => 'enqueuedTime', + 'call_url' => 'callUrl', + 'call_timeout' => 'callTimeout', + 'callback_timeout' => 'callbackTimeout', + 'tag' => 'tag', + 'answer_method' => 'answerMethod', + 'answer_url' => 'answerUrl', + 'answer_fallback_method' => 'answerFallbackMethod', + 'answer_fallback_url' => 'answerFallbackUrl', + 'disconnect_method' => 'disconnectMethod', + 'disconnect_url' => 'disconnectUrl', + 'username' => 'username', + 'password' => 'password', + 'fallback_username' => 'fallbackUsername', + 'fallback_password' => 'fallbackPassword', + 'priority' => 'priority' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'application_id' => 'setApplicationId', + 'account_id' => 'setAccountId', + 'call_id' => 'setCallId', + 'to' => 'setTo', + 'from' => 'setFrom', + 'enqueued_time' => 'setEnqueuedTime', + 'call_url' => 'setCallUrl', + 'call_timeout' => 'setCallTimeout', + 'callback_timeout' => 'setCallbackTimeout', + 'tag' => 'setTag', + 'answer_method' => 'setAnswerMethod', + 'answer_url' => 'setAnswerUrl', + 'answer_fallback_method' => 'setAnswerFallbackMethod', + 'answer_fallback_url' => 'setAnswerFallbackUrl', + 'disconnect_method' => 'setDisconnectMethod', + 'disconnect_url' => 'setDisconnectUrl', + 'username' => 'setUsername', + 'password' => 'setPassword', + 'fallback_username' => 'setFallbackUsername', + 'fallback_password' => 'setFallbackPassword', + 'priority' => 'setPriority' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'application_id' => 'getApplicationId', + 'account_id' => 'getAccountId', + 'call_id' => 'getCallId', + 'to' => 'getTo', + 'from' => 'getFrom', + 'enqueued_time' => 'getEnqueuedTime', + 'call_url' => 'getCallUrl', + 'call_timeout' => 'getCallTimeout', + 'callback_timeout' => 'getCallbackTimeout', + 'tag' => 'getTag', + 'answer_method' => 'getAnswerMethod', + 'answer_url' => 'getAnswerUrl', + 'answer_fallback_method' => 'getAnswerFallbackMethod', + 'answer_fallback_url' => 'getAnswerFallbackUrl', + 'disconnect_method' => 'getDisconnectMethod', + 'disconnect_url' => 'getDisconnectUrl', + 'username' => 'getUsername', + 'password' => 'getPassword', + 'fallback_username' => 'getFallbackUsername', + 'fallback_password' => 'getFallbackPassword', + 'priority' => 'getPriority' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('call_timeout', $data ?? [], null); + $this->setIfExists('callback_timeout', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('answer_method', $data ?? [], null); + $this->setIfExists('answer_url', $data ?? [], null); + $this->setIfExists('answer_fallback_method', $data ?? [], null); + $this->setIfExists('answer_fallback_url', $data ?? [], null); + $this->setIfExists('disconnect_method', $data ?? [], null); + $this->setIfExists('disconnect_url', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('fallback_username', $data ?? [], null); + $this->setIfExists('fallback_password', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['account_id'] === null) { + $invalidProperties[] = "'account_id' can't be null"; + } + if ($this->container['call_id'] === null) { + $invalidProperties[] = "'call_id' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['call_url'] === null) { + $invalidProperties[] = "'call_url' can't be null"; + } + if ($this->container['answer_method'] === null && !$this->isNullableSetToNull('answer_method')) { + $invalidProperties[] = "'answer_method' is required"; + } + if ($this->container['answer_url'] === null) { + $invalidProperties[] = "'answer_url' can't be null"; + } + if ($this->container['disconnect_method'] === null && !$this->isNullableSetToNull('disconnect_method')) { + $invalidProperties[] = "'disconnect_method' is required"; + } + if (!is_null($this->container['username']) && (mb_strlen($this->container['username']) > 1024)) { + $invalidProperties[] = "invalid value for 'username', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) > 1024)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['fallback_username']) && (mb_strlen($this->container['fallback_username']) > 1024)) { + $invalidProperties[] = "invalid value for 'fallback_username', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['fallback_password']) && (mb_strlen($this->container['fallback_password']) > 1024)) { + $invalidProperties[] = "invalid value for 'fallback_password', the character length must be smaller than or equal to 1024."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The id of the application associated with the `from` number. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets account_id + * + * @return string + */ + public function getAccountId(): string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string $account_id The bandwidth account ID associated with the call. + * + * @return $this + */ + public function setAccountId(string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets call_id + * + * @return string + */ + public function getCallId(): string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string $call_id Programmable Voice API Call ID. + * + * @return $this + */ + public function setCallId(string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets to + * + * @return string + */ + public function getTo(): string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to Recipient of the outgoing call. + * + * @return $this + */ + public function setTo(string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from Phone number that created the outbound call. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time The time at which the call was accepted into the queue. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets call_url + * + * @return string + */ + public function getCallUrl(): string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string $call_url The URL to update this call's state. + * + * @return $this + */ + public function setCallUrl(string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets call_timeout + * + * @return float|null + */ + public function getCallTimeout(): ?float + { + return $this->container['call_timeout']; + } + + /** + * Sets call_timeout + * + * @param float|null $call_timeout The timeout (in seconds) for the callee to answer the call after it starts ringing. + * + * @return $this + */ + public function setCallTimeout(?float $call_timeout): static + { + if (is_null($call_timeout)) { + throw new InvalidArgumentException('non-nullable call_timeout cannot be null'); + } + $this->container['call_timeout'] = $call_timeout; + + return $this; + } + + /** + * Gets callback_timeout + * + * @return float|null + */ + public function getCallbackTimeout(): ?float + { + return $this->container['callback_timeout']; + } + + /** + * Sets callback_timeout + * + * @param float|null $callback_timeout This is the timeout (in seconds) to use when delivering webhooks for the call. + * + * @return $this + */ + public function setCallbackTimeout(?float $callback_timeout): static + { + if (is_null($callback_timeout)) { + throw new InvalidArgumentException('non-nullable callback_timeout cannot be null'); + } + $this->container['callback_timeout'] = $callback_timeout; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag Custom tag value. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets answer_method + * + * @return \Bandwidth\Model\CallbackMethodEnum|null + */ + public function getAnswerMethod(): ?\Bandwidth\Model\CallbackMethodEnum + { + return $this->container['answer_method']; + } + + /** + * Sets answer_method + * + * @param \Bandwidth\Model\CallbackMethodEnum|null $answer_method answer_method + * + * @return $this + */ + public function setAnswerMethod(?\Bandwidth\Model\CallbackMethodEnum $answer_method): static + { + if (is_null($answer_method)) { + array_push($this->openAPINullablesSetToNull, 'answer_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_method'] = $answer_method; + + return $this; + } + + /** + * Gets answer_url + * + * @return string + */ + public function getAnswerUrl(): string + { + return $this->container['answer_url']; + } + + /** + * Sets answer_url + * + * @param string $answer_url URL to deliver the `answer` event webhook. + * + * @return $this + */ + public function setAnswerUrl(string $answer_url): static + { + if (is_null($answer_url)) { + throw new InvalidArgumentException('non-nullable answer_url cannot be null'); + } + $this->container['answer_url'] = $answer_url; + + return $this; + } + + /** + * Gets answer_fallback_method + * + * @return \Bandwidth\Model\CallbackMethodEnum|null + */ + public function getAnswerFallbackMethod(): ?\Bandwidth\Model\CallbackMethodEnum + { + return $this->container['answer_fallback_method']; + } + + /** + * Sets answer_fallback_method + * + * @param \Bandwidth\Model\CallbackMethodEnum|null $answer_fallback_method answer_fallback_method + * + * @return $this + */ + public function setAnswerFallbackMethod(?\Bandwidth\Model\CallbackMethodEnum $answer_fallback_method): static + { + if (is_null($answer_fallback_method)) { + array_push($this->openAPINullablesSetToNull, 'answer_fallback_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_fallback_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_fallback_method'] = $answer_fallback_method; + + return $this; + } + + /** + * Gets answer_fallback_url + * + * @return string|null + */ + public function getAnswerFallbackUrl(): ?string + { + return $this->container['answer_fallback_url']; + } + + /** + * Sets answer_fallback_url + * + * @param string|null $answer_fallback_url Fallback URL to deliver the `answer` event webhook. + * + * @return $this + */ + public function setAnswerFallbackUrl(?string $answer_fallback_url): static + { + if (is_null($answer_fallback_url)) { + array_push($this->openAPINullablesSetToNull, 'answer_fallback_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_fallback_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_fallback_url'] = $answer_fallback_url; + + return $this; + } + + /** + * Gets disconnect_method + * + * @return \Bandwidth\Model\CallbackMethodEnum|null + */ + public function getDisconnectMethod(): ?\Bandwidth\Model\CallbackMethodEnum + { + return $this->container['disconnect_method']; + } + + /** + * Sets disconnect_method + * + * @param \Bandwidth\Model\CallbackMethodEnum|null $disconnect_method disconnect_method + * + * @return $this + */ + public function setDisconnectMethod(?\Bandwidth\Model\CallbackMethodEnum $disconnect_method): static + { + if (is_null($disconnect_method)) { + array_push($this->openAPINullablesSetToNull, 'disconnect_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('disconnect_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['disconnect_method'] = $disconnect_method; + + return $this; + } + + /** + * Gets disconnect_url + * + * @return string|null + */ + public function getDisconnectUrl(): ?string + { + return $this->container['disconnect_url']; + } + + /** + * Sets disconnect_url + * + * @param string|null $disconnect_url URL to deliver the `disconnect` event webhook. + * + * @return $this + */ + public function setDisconnectUrl(?string $disconnect_url): static + { + if (is_null($disconnect_url)) { + array_push($this->openAPINullablesSetToNull, 'disconnect_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('disconnect_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['disconnect_url'] = $disconnect_url; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username Basic auth username. + * + * @return $this + */ + public function setUsername(?string $username): static + { + if (is_null($username)) { + array_push($this->openAPINullablesSetToNull, 'username'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('username', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($username) && (mb_strlen($username) > 1024)) { + throw new InvalidArgumentException('invalid length for $username when calling CreateCallResponse., must be smaller than or equal to 1024.'); + } + + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password Basic auth password. + * + * @return $this + */ + public function setPassword(?string $password): static + { + if (is_null($password)) { + array_push($this->openAPINullablesSetToNull, 'password'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('password', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($password) && (mb_strlen($password) > 1024)) { + throw new InvalidArgumentException('invalid length for $password when calling CreateCallResponse., must be smaller than or equal to 1024.'); + } + + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets fallback_username + * + * @return string|null + */ + public function getFallbackUsername(): ?string + { + return $this->container['fallback_username']; + } + + /** + * Sets fallback_username + * + * @param string|null $fallback_username Basic auth username. + * + * @return $this + */ + public function setFallbackUsername(?string $fallback_username): static + { + if (is_null($fallback_username)) { + array_push($this->openAPINullablesSetToNull, 'fallback_username'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_username', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($fallback_username) && (mb_strlen($fallback_username) > 1024)) { + throw new InvalidArgumentException('invalid length for $fallback_username when calling CreateCallResponse., must be smaller than or equal to 1024.'); + } + + $this->container['fallback_username'] = $fallback_username; + + return $this; + } + + /** + * Gets fallback_password + * + * @return string|null + */ + public function getFallbackPassword(): ?string + { + return $this->container['fallback_password']; + } + + /** + * Sets fallback_password + * + * @param string|null $fallback_password Basic auth password. + * + * @return $this + */ + public function setFallbackPassword(?string $fallback_password): static + { + if (is_null($fallback_password)) { + array_push($this->openAPINullablesSetToNull, 'fallback_password'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_password', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($fallback_password) && (mb_strlen($fallback_password) > 1024)) { + throw new InvalidArgumentException('invalid length for $fallback_password when calling CreateCallResponse., must be smaller than or equal to 1024.'); + } + + $this->container['fallback_password'] = $fallback_password; + + return $this; + } + + /** + * Gets priority + * + * @return int|null + */ + public function getPriority(): ?int + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param int|null $priority The priority of this call over other calls from your account. + * + * @return $this + */ + public function setPriority(?int $priority): static + { + if (is_null($priority)) { + array_push($this->openAPINullablesSetToNull, 'priority'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('priority', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['priority'] = $priority; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateEndpointRequestBase.php b/src/Model/CreateEndpointRequestBase.php new file mode 100644 index 0000000..7555d3e --- /dev/null +++ b/src/Model/CreateEndpointRequestBase.php @@ -0,0 +1,528 @@ + + */ +class CreateEndpointRequestBase implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createEndpointRequestBase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => '\Bandwidth\Model\EndpointTypeEnum', + 'direction' => '\Bandwidth\Model\EndpointDirectionEnum', + 'event_callback_url' => 'string', + 'event_fallback_url' => 'string', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'direction' => null, + 'event_callback_url' => 'uri', + 'event_fallback_url' => 'uri', + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'direction' => false, + 'event_callback_url' => false, + 'event_fallback_url' => false, + 'tag' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'direction' => 'direction', + 'event_callback_url' => 'eventCallbackUrl', + 'event_fallback_url' => 'eventFallbackUrl', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'direction' => 'setDirection', + 'event_callback_url' => 'setEventCallbackUrl', + 'event_fallback_url' => 'setEventFallbackUrl', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'direction' => 'getDirection', + 'event_callback_url' => 'getEventCallbackUrl', + 'event_fallback_url' => 'getEventFallbackUrl', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('event_callback_url', $data ?? [], null); + $this->setIfExists('event_fallback_url', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['direction'] === null) { + $invalidProperties[] = "'direction' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \Bandwidth\Model\EndpointTypeEnum + */ + public function getType(): \Bandwidth\Model\EndpointTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\EndpointTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\EndpointTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\EndpointDirectionEnum + */ + public function getDirection(): \Bandwidth\Model\EndpointDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\EndpointDirectionEnum $direction direction + * + * @return $this + */ + public function setDirection(\Bandwidth\Model\EndpointDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets event_callback_url + * + * @return string|null + */ + public function getEventCallbackUrl(): ?string + { + return $this->container['event_callback_url']; + } + + /** + * Sets event_callback_url + * + * @param string|null $event_callback_url The URL to send event callbacks to. + * + * @return $this + */ + public function setEventCallbackUrl(?string $event_callback_url): static + { + if (is_null($event_callback_url)) { + throw new InvalidArgumentException('non-nullable event_callback_url cannot be null'); + } + $this->container['event_callback_url'] = $event_callback_url; + + return $this; + } + + /** + * Gets event_fallback_url + * + * @return string|null + */ + public function getEventFallbackUrl(): ?string + { + return $this->container['event_fallback_url']; + } + + /** + * Sets event_fallback_url + * + * @param string|null $event_fallback_url The URL to send event fallbacks to. + * + * @return $this + */ + public function setEventFallbackUrl(?string $event_fallback_url): static + { + if (is_null($event_fallback_url)) { + throw new InvalidArgumentException('non-nullable event_fallback_url cannot be null'); + } + $this->container['event_fallback_url'] = $event_fallback_url; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A tag for the endpoint. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + + + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateEndpointResponse.php b/src/Model/CreateEndpointResponse.php new file mode 100644 index 0000000..cf0f91a --- /dev/null +++ b/src/Model/CreateEndpointResponse.php @@ -0,0 +1,461 @@ + + */ +class CreateEndpointResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createEndpointResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'links' => '\Bandwidth\Model\BrtcLink[]', + 'data' => '\Bandwidth\Model\CreateEndpointResponseData', + 'errors' => '\Bandwidth\Model\BrtcError[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'links' => null, + 'data' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'links' => false, + 'data' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'links' => 'links', + 'data' => 'data', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'links' => 'setLinks', + 'data' => 'setData', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'links' => 'getLinks', + 'data' => 'getData', + 'errors' => 'getErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return \Bandwidth\Model\BrtcLink[] + */ + public function getLinks(): array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Bandwidth\Model\BrtcLink[] $links links + * + * @return $this + */ + public function setLinks(array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets data + * + * @return \Bandwidth\Model\CreateEndpointResponseData + */ + public function getData(): \Bandwidth\Model\CreateEndpointResponseData + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Bandwidth\Model\CreateEndpointResponseData $data data + * + * @return $this + */ + public function setData(\Bandwidth\Model\CreateEndpointResponseData $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets errors + * + * @return \Bandwidth\Model\BrtcError[] + */ + public function getErrors(): array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Bandwidth\Model\BrtcError[] $errors errors + * + * @return $this + */ + public function setErrors(array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateEndpointResponseData.php b/src/Model/CreateEndpointResponseData.php new file mode 100644 index 0000000..a1e2992 --- /dev/null +++ b/src/Model/CreateEndpointResponseData.php @@ -0,0 +1,642 @@ + + */ +class CreateEndpointResponseData implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createEndpointResponseData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'endpoint_id' => 'string', + 'type' => '\Bandwidth\Model\EndpointTypeEnum', + 'status' => '\Bandwidth\Model\EndpointStatusEnum', + 'creation_timestamp' => '\DateTime', + 'expiration_timestamp' => '\DateTime', + 'tag' => 'string', + 'devices' => '\Bandwidth\Model\Device[]', + 'token' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'endpoint_id' => null, + 'type' => null, + 'status' => null, + 'creation_timestamp' => 'date-time', + 'expiration_timestamp' => 'date-time', + 'tag' => null, + 'devices' => null, + 'token' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'endpoint_id' => false, + 'type' => false, + 'status' => false, + 'creation_timestamp' => false, + 'expiration_timestamp' => false, + 'tag' => false, + 'devices' => false, + 'token' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'endpoint_id' => 'endpointId', + 'type' => 'type', + 'status' => 'status', + 'creation_timestamp' => 'creationTimestamp', + 'expiration_timestamp' => 'expirationTimestamp', + 'tag' => 'tag', + 'devices' => 'devices', + 'token' => 'token' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'endpoint_id' => 'setEndpointId', + 'type' => 'setType', + 'status' => 'setStatus', + 'creation_timestamp' => 'setCreationTimestamp', + 'expiration_timestamp' => 'setExpirationTimestamp', + 'tag' => 'setTag', + 'devices' => 'setDevices', + 'token' => 'setToken' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'endpoint_id' => 'getEndpointId', + 'type' => 'getType', + 'status' => 'getStatus', + 'creation_timestamp' => 'getCreationTimestamp', + 'expiration_timestamp' => 'getExpirationTimestamp', + 'tag' => 'getTag', + 'devices' => 'getDevices', + 'token' => 'getToken' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('endpoint_id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('creation_timestamp', $data ?? [], null); + $this->setIfExists('expiration_timestamp', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('devices', $data ?? [], null); + $this->setIfExists('token', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['endpoint_id'] === null) { + $invalidProperties[] = "'endpoint_id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['creation_timestamp'] === null) { + $invalidProperties[] = "'creation_timestamp' can't be null"; + } + if ($this->container['expiration_timestamp'] === null) { + $invalidProperties[] = "'expiration_timestamp' can't be null"; + } + if ($this->container['token'] === null) { + $invalidProperties[] = "'token' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets endpoint_id + * + * @return string + */ + public function getEndpointId(): string + { + return $this->container['endpoint_id']; + } + + /** + * Sets endpoint_id + * + * @param string $endpoint_id The unique ID of the endpoint. + * + * @return $this + */ + public function setEndpointId(string $endpoint_id): static + { + if (is_null($endpoint_id)) { + throw new InvalidArgumentException('non-nullable endpoint_id cannot be null'); + } + $this->container['endpoint_id'] = $endpoint_id; + + return $this; + } + + /** + * Gets type + * + * @return \Bandwidth\Model\EndpointTypeEnum + */ + public function getType(): \Bandwidth\Model\EndpointTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\EndpointTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\EndpointTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets status + * + * @return \Bandwidth\Model\EndpointStatusEnum + */ + public function getStatus(): \Bandwidth\Model\EndpointStatusEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\EndpointStatusEnum $status status + * + * @return $this + */ + public function setStatus(\Bandwidth\Model\EndpointStatusEnum $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets creation_timestamp + * + * @return \DateTime + */ + public function getCreationTimestamp(): \DateTime + { + return $this->container['creation_timestamp']; + } + + /** + * Sets creation_timestamp + * + * @param \DateTime $creation_timestamp The time the endpoint was created. In ISO-8601 format. + * + * @return $this + */ + public function setCreationTimestamp(\DateTime $creation_timestamp): static + { + if (is_null($creation_timestamp)) { + throw new InvalidArgumentException('non-nullable creation_timestamp cannot be null'); + } + $this->container['creation_timestamp'] = $creation_timestamp; + + return $this; + } + + /** + * Gets expiration_timestamp + * + * @return \DateTime + */ + public function getExpirationTimestamp(): \DateTime + { + return $this->container['expiration_timestamp']; + } + + /** + * Sets expiration_timestamp + * + * @param \DateTime $expiration_timestamp The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + * + * @return $this + */ + public function setExpirationTimestamp(\DateTime $expiration_timestamp): static + { + if (is_null($expiration_timestamp)) { + throw new InvalidArgumentException('non-nullable expiration_timestamp cannot be null'); + } + $this->container['expiration_timestamp'] = $expiration_timestamp; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A tag for the endpoint. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + + + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets devices + * + * @return \Bandwidth\Model\Device[]|null + */ + public function getDevices(): ?array + { + return $this->container['devices']; + } + + /** + * Sets devices + * + * @param \Bandwidth\Model\Device[]|null $devices devices + * + * @return $this + */ + public function setDevices(?array $devices): static + { + if (is_null($devices)) { + throw new InvalidArgumentException('non-nullable devices cannot be null'); + } + $this->container['devices'] = $devices; + + return $this; + } + + /** + * Gets token + * + * @return string + */ + public function getToken(): string + { + return $this->container['token']; + } + + /** + * Sets token + * + * @param string $token The json web token specific to the endpoint. Used to authenticate the client with the media gateway. + * + * @return $this + */ + public function setToken(string $token): static + { + if (is_null($token)) { + throw new InvalidArgumentException('non-nullable token cannot be null'); + } + $this->container['token'] = $token; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateMessageRequestError.php b/src/Model/CreateMessageRequestError.php new file mode 100644 index 0000000..7d1ea43 --- /dev/null +++ b/src/Model/CreateMessageRequestError.php @@ -0,0 +1,458 @@ + + */ +class CreateMessageRequestError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createMessageRequestError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'description' => 'string', + 'field_errors' => '\Bandwidth\Model\FieldError[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'description' => null, + 'field_errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'description' => false, + 'field_errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'description' => 'description', + 'field_errors' => 'fieldErrors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'description' => 'setDescription', + 'field_errors' => 'setFieldErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'description' => 'getDescription', + 'field_errors' => 'getFieldErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('field_errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['description'] === null) { + $invalidProperties[] = "'description' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type type + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets description + * + * @return string + */ + public function getDescription(): string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description description + * + * @return $this + */ + public function setDescription(string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets field_errors + * + * @return \Bandwidth\Model\FieldError[]|null + */ + public function getFieldErrors(): ?array + { + return $this->container['field_errors']; + } + + /** + * Sets field_errors + * + * @param \Bandwidth\Model\FieldError[]|null $field_errors field_errors + * + * @return $this + */ + public function setFieldErrors(?array $field_errors): static + { + if (is_null($field_errors)) { + throw new InvalidArgumentException('non-nullable field_errors cannot be null'); + } + $this->container['field_errors'] = $field_errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateMultiChannelMessageResponse.php b/src/Model/CreateMultiChannelMessageResponse.php new file mode 100644 index 0000000..12ebcb3 --- /dev/null +++ b/src/Model/CreateMultiChannelMessageResponse.php @@ -0,0 +1,452 @@ + + */ +class CreateMultiChannelMessageResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createMultiChannelMessageResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'links' => '\Bandwidth\Model\Link[]', + 'data' => '\Bandwidth\Model\MultiChannelMessageResponseData', + 'errors' => '\Bandwidth\Model\ErrorObject[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'links' => null, + 'data' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'links' => false, + 'data' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'links' => 'links', + 'data' => 'data', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'links' => 'setLinks', + 'data' => 'setData', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'links' => 'getLinks', + 'data' => 'getData', + 'errors' => 'getErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return \Bandwidth\Model\Link[]|null + */ + public function getLinks(): ?array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Bandwidth\Model\Link[]|null $links links + * + * @return $this + */ + public function setLinks(?array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets data + * + * @return \Bandwidth\Model\MultiChannelMessageResponseData|null + */ + public function getData(): ?\Bandwidth\Model\MultiChannelMessageResponseData + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Bandwidth\Model\MultiChannelMessageResponseData|null $data data + * + * @return $this + */ + public function setData(?\Bandwidth\Model\MultiChannelMessageResponseData $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets errors + * + * @return \Bandwidth\Model\ErrorObject[]|null + */ + public function getErrors(): ?array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Bandwidth\Model\ErrorObject[]|null $errors errors + * + * @return $this + */ + public function setErrors(?array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateSyncLookupResponse.php b/src/Model/CreateSyncLookupResponse.php new file mode 100644 index 0000000..6430c4a --- /dev/null +++ b/src/Model/CreateSyncLookupResponse.php @@ -0,0 +1,452 @@ + + */ +class CreateSyncLookupResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createSyncLookupResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'links' => '\Bandwidth\Model\LinkSchema[]', + 'data' => '\Bandwidth\Model\CreateSyncLookupResponseData', + 'errors' => '\Bandwidth\Model\LookupErrorSchema[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'links' => null, + 'data' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'links' => false, + 'data' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'links' => 'links', + 'data' => 'data', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'links' => 'setLinks', + 'data' => 'setData', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'links' => 'getLinks', + 'data' => 'getData', + 'errors' => 'getErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return \Bandwidth\Model\LinkSchema[]|null + */ + public function getLinks(): ?array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Bandwidth\Model\LinkSchema[]|null $links links + * + * @return $this + */ + public function setLinks(?array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets data + * + * @return \Bandwidth\Model\CreateSyncLookupResponseData|null + */ + public function getData(): ?\Bandwidth\Model\CreateSyncLookupResponseData + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Bandwidth\Model\CreateSyncLookupResponseData|null $data data + * + * @return $this + */ + public function setData(?\Bandwidth\Model\CreateSyncLookupResponseData $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets errors + * + * @return \Bandwidth\Model\LookupErrorSchema[]|null + */ + public function getErrors(): ?array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Bandwidth\Model\LookupErrorSchema[]|null $errors errors + * + * @return $this + */ + public function setErrors(?array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateSyncLookupResponseData.php b/src/Model/CreateSyncLookupResponseData.php new file mode 100644 index 0000000..f0594e0 --- /dev/null +++ b/src/Model/CreateSyncLookupResponseData.php @@ -0,0 +1,453 @@ + + */ +class CreateSyncLookupResponseData implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createSyncLookupResponse_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'request_id' => 'string', + 'status' => '\Bandwidth\Model\CompletedLookupStatusEnum', + 'results' => '\Bandwidth\Model\LookupResult[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'request_id' => 'uuid', + 'status' => null, + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'request_id' => false, + 'status' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'request_id' => 'requestId', + 'status' => 'status', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'request_id' => 'setRequestId', + 'status' => 'setStatus', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'request_id' => 'getRequestId', + 'status' => 'getStatus', + 'results' => 'getResults' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId(): ?string + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id The phone number lookup request ID from Bandwidth. + * + * @return $this + */ + public function setRequestId(?string $request_id): static + { + if (is_null($request_id)) { + throw new InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets status + * + * @return \Bandwidth\Model\CompletedLookupStatusEnum|null + */ + public function getStatus(): ?\Bandwidth\Model\CompletedLookupStatusEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\CompletedLookupStatusEnum|null $status status + * + * @return $this + */ + public function setStatus(?\Bandwidth\Model\CompletedLookupStatusEnum $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets results + * + * @return \Bandwidth\Model\LookupResult[]|null + */ + public function getResults(): ?array + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \Bandwidth\Model\LookupResult[]|null $results The carrier information results for the specified telephone numbers. + * + * @return $this + */ + public function setResults(?array $results): static + { + if (is_null($results)) { + throw new InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/CreateWebRtcConnectionRequest.php b/src/Model/CreateWebRtcConnectionRequest.php new file mode 100644 index 0000000..79a1fc1 --- /dev/null +++ b/src/Model/CreateWebRtcConnectionRequest.php @@ -0,0 +1,562 @@ + + */ +class CreateWebRtcConnectionRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'createWebRtcConnectionRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => '\Bandwidth\Model\EndpointTypeEnum', + 'direction' => '\Bandwidth\Model\EndpointDirectionEnum', + 'event_callback_url' => 'string', + 'event_fallback_url' => 'string', + 'tag' => 'string', + 'connection_metadata' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'direction' => null, + 'event_callback_url' => 'uri', + 'event_fallback_url' => 'uri', + 'tag' => null, + 'connection_metadata' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'direction' => false, + 'event_callback_url' => false, + 'event_fallback_url' => false, + 'tag' => false, + 'connection_metadata' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'direction' => 'direction', + 'event_callback_url' => 'eventCallbackUrl', + 'event_fallback_url' => 'eventFallbackUrl', + 'tag' => 'tag', + 'connection_metadata' => 'connectionMetadata' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'direction' => 'setDirection', + 'event_callback_url' => 'setEventCallbackUrl', + 'event_fallback_url' => 'setEventFallbackUrl', + 'tag' => 'setTag', + 'connection_metadata' => 'setConnectionMetadata' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'direction' => 'getDirection', + 'event_callback_url' => 'getEventCallbackUrl', + 'event_fallback_url' => 'getEventFallbackUrl', + 'tag' => 'getTag', + 'connection_metadata' => 'getConnectionMetadata' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('event_callback_url', $data ?? [], null); + $this->setIfExists('event_fallback_url', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('connection_metadata', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['direction'] === null) { + $invalidProperties[] = "'direction' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \Bandwidth\Model\EndpointTypeEnum + */ + public function getType(): \Bandwidth\Model\EndpointTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\EndpointTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\EndpointTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\EndpointDirectionEnum + */ + public function getDirection(): \Bandwidth\Model\EndpointDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\EndpointDirectionEnum $direction direction + * + * @return $this + */ + public function setDirection(\Bandwidth\Model\EndpointDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets event_callback_url + * + * @return string|null + */ + public function getEventCallbackUrl(): ?string + { + return $this->container['event_callback_url']; + } + + /** + * Sets event_callback_url + * + * @param string|null $event_callback_url The URL to send event callbacks to. + * + * @return $this + */ + public function setEventCallbackUrl(?string $event_callback_url): static + { + if (is_null($event_callback_url)) { + throw new InvalidArgumentException('non-nullable event_callback_url cannot be null'); + } + $this->container['event_callback_url'] = $event_callback_url; + + return $this; + } + + /** + * Gets event_fallback_url + * + * @return string|null + */ + public function getEventFallbackUrl(): ?string + { + return $this->container['event_fallback_url']; + } + + /** + * Sets event_fallback_url + * + * @param string|null $event_fallback_url The URL to send event fallbacks to. + * + * @return $this + */ + public function setEventFallbackUrl(?string $event_fallback_url): static + { + if (is_null($event_fallback_url)) { + throw new InvalidArgumentException('non-nullable event_fallback_url cannot be null'); + } + $this->container['event_fallback_url'] = $event_fallback_url; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A tag for the endpoint. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + + + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets connection_metadata + * + * @return object|null + */ + public function getConnectionMetadata(): ?object + { + return $this->container['connection_metadata']; + } + + /** + * Sets connection_metadata + * + * @param object|null $connection_metadata connection_metadata + * + * @return $this + */ + public function setConnectionMetadata(?object $connection_metadata): static + { + if (is_null($connection_metadata)) { + throw new InvalidArgumentException('non-nullable connection_metadata cannot be null'); + } + $this->container['connection_metadata'] = $connection_metadata; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/DeactivationEventEnum.php b/src/Model/DeactivationEventEnum.php new file mode 100644 index 0000000..c891163 --- /dev/null +++ b/src/Model/DeactivationEventEnum.php @@ -0,0 +1,44 @@ + + */ +class Device implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'device'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'device_id' => 'string', + 'device_name' => 'string', + 'status' => '\Bandwidth\Model\DeviceStatusEnum', + 'creation_timestamp' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'device_id' => null, + 'device_name' => null, + 'status' => null, + 'creation_timestamp' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'device_id' => false, + 'device_name' => false, + 'status' => false, + 'creation_timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'device_id' => 'deviceId', + 'device_name' => 'deviceName', + 'status' => 'status', + 'creation_timestamp' => 'creationTimestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'device_id' => 'setDeviceId', + 'device_name' => 'setDeviceName', + 'status' => 'setStatus', + 'creation_timestamp' => 'setCreationTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'device_id' => 'getDeviceId', + 'device_name' => 'getDeviceName', + 'status' => 'getStatus', + 'creation_timestamp' => 'getCreationTimestamp' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('device_id', $data ?? [], null); + $this->setIfExists('device_name', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('creation_timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['device_id'] === null) { + $invalidProperties[] = "'device_id' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['creation_timestamp'] === null) { + $invalidProperties[] = "'creation_timestamp' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets device_id + * + * @return string + */ + public function getDeviceId(): string + { + return $this->container['device_id']; + } + + /** + * Sets device_id + * + * @param string $device_id The unique ID of the device. + * + * @return $this + */ + public function setDeviceId(string $device_id): static + { + if (is_null($device_id)) { + throw new InvalidArgumentException('non-nullable device_id cannot be null'); + } + $this->container['device_id'] = $device_id; + + return $this; + } + + /** + * Gets device_name + * + * @return string|null + */ + public function getDeviceName(): ?string + { + return $this->container['device_name']; + } + + /** + * Sets device_name + * + * @param string|null $device_name The name of the device. + * + * @return $this + */ + public function setDeviceName(?string $device_name): static + { + if (is_null($device_name)) { + throw new InvalidArgumentException('non-nullable device_name cannot be null'); + } + + + $this->container['device_name'] = $device_name; + + return $this; + } + + /** + * Gets status + * + * @return \Bandwidth\Model\DeviceStatusEnum + */ + public function getStatus(): \Bandwidth\Model\DeviceStatusEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\DeviceStatusEnum $status status + * + * @return $this + */ + public function setStatus(\Bandwidth\Model\DeviceStatusEnum $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets creation_timestamp + * + * @return \DateTime + */ + public function getCreationTimestamp(): \DateTime + { + return $this->container['creation_timestamp']; + } + + /** + * Sets creation_timestamp + * + * @param \DateTime $creation_timestamp The time the device was created. In ISO-8601 format. + * + * @return $this + */ + public function setCreationTimestamp(\DateTime $creation_timestamp): static + { + if (is_null($creation_timestamp)) { + throw new InvalidArgumentException('non-nullable creation_timestamp cannot be null'); + } + $this->container['creation_timestamp'] = $creation_timestamp; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/DeviceStatusEnum.php b/src/Model/DeviceStatusEnum.php new file mode 100644 index 0000000..c89e812 --- /dev/null +++ b/src/Model/DeviceStatusEnum.php @@ -0,0 +1,45 @@ + + */ +class DisconnectCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'disconnectCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'call_id' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_url' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'end_time' => '\DateTime', + 'cause' => 'string', + 'error_message' => 'string', + 'error_id' => 'string', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'call_id' => null, + 'direction' => null, + 'call_url' => 'uri', + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'end_time' => 'date-time', + 'cause' => null, + 'error_message' => null, + 'error_id' => null, + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'call_id' => false, + 'direction' => false, + 'call_url' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'end_time' => false, + 'cause' => false, + 'error_message' => true, + 'error_id' => true, + 'tag' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'call_id' => 'callId', + 'direction' => 'direction', + 'call_url' => 'callUrl', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'end_time' => 'endTime', + 'cause' => 'cause', + 'error_message' => 'errorMessage', + 'error_id' => 'errorId', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'call_id' => 'setCallId', + 'direction' => 'setDirection', + 'call_url' => 'setCallUrl', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'end_time' => 'setEndTime', + 'cause' => 'setCause', + 'error_message' => 'setErrorMessage', + 'error_id' => 'setErrorId', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'call_id' => 'getCallId', + 'direction' => 'getDirection', + 'call_url' => 'getCallUrl', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'end_time' => 'getEndTime', + 'cause' => 'getCause', + 'error_message' => 'getErrorMessage', + 'error_id' => 'getErrorId', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('cause', $data ?? [], null); + $this->setIfExists('error_message', $data ?? [], null); + $this->setIfExists('error_id', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets end_time + * + * @return \DateTime|null + */ + public function getEndTime(): ?\DateTime + { + return $this->container['end_time']; + } + + /** + * Sets end_time + * + * @param \DateTime|null $end_time The time that the recording ended in ISO-8601 format + * + * @return $this + */ + public function setEndTime(?\DateTime $end_time): static + { + if (is_null($end_time)) { + throw new InvalidArgumentException('non-nullable end_time cannot be null'); + } + $this->container['end_time'] = $end_time; + + return $this; + } + + /** + * Gets cause + * + * @return string|null + */ + public function getCause(): ?string + { + return $this->container['cause']; + } + + /** + * Sets cause + * + * @param string|null $cause Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. + * + * @return $this + */ + public function setCause(?string $cause): static + { + if (is_null($cause)) { + throw new InvalidArgumentException('non-nullable cause cannot be null'); + } + $this->container['cause'] = $cause; + + return $this; + } + + /** + * Gets error_message + * + * @return string|null + */ + public function getErrorMessage(): ?string + { + return $this->container['error_message']; + } + + /** + * Sets error_message + * + * @param string|null $error_message Text explaining the reason that caused the call to fail in case of errors. + * + * @return $this + */ + public function setErrorMessage(?string $error_message): static + { + if (is_null($error_message)) { + array_push($this->openAPINullablesSetToNull, 'error_message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error_message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error_message'] = $error_message; + + return $this; + } + + /** + * Gets error_id + * + * @return string|null + */ + public function getErrorId(): ?string + { + return $this->container['error_id']; + } + + /** + * Sets error_id + * + * @param string|null $error_id Bandwidth's internal id that references the error event. + * + * @return $this + */ + public function setErrorId(?string $error_id): static + { + if (is_null($error_id)) { + array_push($this->openAPINullablesSetToNull, 'error_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error_id'] = $error_id; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Diversion.php b/src/Model/Diversion.php new file mode 100644 index 0000000..4dd3c58 --- /dev/null +++ b/src/Model/Diversion.php @@ -0,0 +1,588 @@ + + */ +class Diversion implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'diversion'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'reason' => 'string', + 'privacy' => 'string', + 'screen' => 'string', + 'counter' => 'string', + 'limit' => 'string', + 'unknown' => 'string', + 'orig_to' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'reason' => null, + 'privacy' => null, + 'screen' => null, + 'counter' => null, + 'limit' => null, + 'unknown' => null, + 'orig_to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'reason' => false, + 'privacy' => false, + 'screen' => false, + 'counter' => false, + 'limit' => false, + 'unknown' => false, + 'orig_to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'reason' => 'reason', + 'privacy' => 'privacy', + 'screen' => 'screen', + 'counter' => 'counter', + 'limit' => 'limit', + 'unknown' => 'unknown', + 'orig_to' => 'origTo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'reason' => 'setReason', + 'privacy' => 'setPrivacy', + 'screen' => 'setScreen', + 'counter' => 'setCounter', + 'limit' => 'setLimit', + 'unknown' => 'setUnknown', + 'orig_to' => 'setOrigTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'reason' => 'getReason', + 'privacy' => 'getPrivacy', + 'screen' => 'getScreen', + 'counter' => 'getCounter', + 'limit' => 'getLimit', + 'unknown' => 'getUnknown', + 'orig_to' => 'getOrigTo' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('reason', $data ?? [], null); + $this->setIfExists('privacy', $data ?? [], null); + $this->setIfExists('screen', $data ?? [], null); + $this->setIfExists('counter', $data ?? [], null); + $this->setIfExists('limit', $data ?? [], null); + $this->setIfExists('unknown', $data ?? [], null); + $this->setIfExists('orig_to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets reason + * + * @return string|null + */ + public function getReason(): ?string + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason 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 $this + */ + public function setReason(?string $reason): static + { + if (is_null($reason)) { + throw new InvalidArgumentException('non-nullable reason cannot be null'); + } + $this->container['reason'] = $reason; + + return $this; + } + + /** + * Gets privacy + * + * @return string|null + */ + public function getPrivacy(): ?string + { + return $this->container['privacy']; + } + + /** + * Sets privacy + * + * @param string|null $privacy off or full + * + * @return $this + */ + public function setPrivacy(?string $privacy): static + { + if (is_null($privacy)) { + throw new InvalidArgumentException('non-nullable privacy cannot be null'); + } + $this->container['privacy'] = $privacy; + + return $this; + } + + /** + * Gets screen + * + * @return string|null + */ + public function getScreen(): ?string + { + return $this->container['screen']; + } + + /** + * Sets screen + * + * @param string|null $screen No if the number was provided by the user, yes if the number was provided by the network + * + * @return $this + */ + public function setScreen(?string $screen): static + { + if (is_null($screen)) { + throw new InvalidArgumentException('non-nullable screen cannot be null'); + } + $this->container['screen'] = $screen; + + return $this; + } + + /** + * Gets counter + * + * @return string|null + */ + public function getCounter(): ?string + { + return $this->container['counter']; + } + + /** + * Sets counter + * + * @param string|null $counter The number of diversions that have occurred + * + * @return $this + */ + public function setCounter(?string $counter): static + { + if (is_null($counter)) { + throw new InvalidArgumentException('non-nullable counter cannot be null'); + } + $this->container['counter'] = $counter; + + return $this; + } + + /** + * Gets limit + * + * @return string|null + */ + public function getLimit(): ?string + { + return $this->container['limit']; + } + + /** + * Sets limit + * + * @param string|null $limit The maximum number of diversions allowed for this session + * + * @return $this + */ + public function setLimit(?string $limit): static + { + if (is_null($limit)) { + throw new InvalidArgumentException('non-nullable limit cannot be null'); + } + $this->container['limit'] = $limit; + + return $this; + } + + /** + * Gets unknown + * + * @return string|null + */ + public function getUnknown(): ?string + { + return $this->container['unknown']; + } + + /** + * Sets unknown + * + * @param string|null $unknown The normal list of values is not exhaustive. Your application must be tolerant of unlisted keys and unlisted values of those keys. + * + * @return $this + */ + public function setUnknown(?string $unknown): static + { + if (is_null($unknown)) { + throw new InvalidArgumentException('non-nullable unknown cannot be null'); + } + $this->container['unknown'] = $unknown; + + return $this; + } + + /** + * Gets orig_to + * + * @return string|null + */ + public function getOrigTo(): ?string + { + return $this->container['orig_to']; + } + + /** + * Sets orig_to + * + * @param string|null $orig_to Always present. Indicates the last telephone number that the call was diverted from. + * + * @return $this + */ + public function setOrigTo(?string $orig_to): static + { + if (is_null($orig_to)) { + throw new InvalidArgumentException('non-nullable orig_to cannot be null'); + } + $this->container['orig_to'] = $orig_to; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/DtmfCallback.php b/src/Model/DtmfCallback.php new file mode 100644 index 0000000..edfa926 --- /dev/null +++ b/src/Model/DtmfCallback.php @@ -0,0 +1,950 @@ + + */ +class DtmfCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'dtmfCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'call_id' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'digit' => 'string', + 'call_url' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'parent_call_id' => 'string', + 'transfer_caller_id' => 'string', + 'transfer_to' => 'string', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'call_id' => null, + 'direction' => null, + 'digit' => null, + 'call_url' => 'uri', + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'parent_call_id' => null, + 'transfer_caller_id' => null, + 'transfer_to' => null, + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'call_id' => false, + 'direction' => false, + 'digit' => false, + 'call_url' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'parent_call_id' => false, + 'transfer_caller_id' => false, + 'transfer_to' => false, + 'tag' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'call_id' => 'callId', + 'direction' => 'direction', + 'digit' => 'digit', + 'call_url' => 'callUrl', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'parent_call_id' => 'parentCallId', + 'transfer_caller_id' => 'transferCallerId', + 'transfer_to' => 'transferTo', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'call_id' => 'setCallId', + 'direction' => 'setDirection', + 'digit' => 'setDigit', + 'call_url' => 'setCallUrl', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'parent_call_id' => 'setParentCallId', + 'transfer_caller_id' => 'setTransferCallerId', + 'transfer_to' => 'setTransferTo', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'call_id' => 'getCallId', + 'direction' => 'getDirection', + 'digit' => 'getDigit', + 'call_url' => 'getCallUrl', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'parent_call_id' => 'getParentCallId', + 'transfer_caller_id' => 'getTransferCallerId', + 'transfer_to' => 'getTransferTo', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('digit', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('parent_call_id', $data ?? [], null); + $this->setIfExists('transfer_caller_id', $data ?? [], null); + $this->setIfExists('transfer_to', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets digit + * + * @return string|null + */ + public function getDigit(): ?string + { + return $this->container['digit']; + } + + /** + * Sets digit + * + * @param string|null $digit The digit collected in the call. + * + * @return $this + */ + public function setDigit(?string $digit): static + { + if (is_null($digit)) { + throw new InvalidArgumentException('non-nullable digit cannot be null'); + } + $this->container['digit'] = $digit; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets parent_call_id + * + * @return string|null + */ + public function getParentCallId(): ?string + { + return $this->container['parent_call_id']; + } + + /** + * Sets parent_call_id + * + * @param string|null $parent_call_id (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. + * + * @return $this + */ + public function setParentCallId(?string $parent_call_id): static + { + if (is_null($parent_call_id)) { + throw new InvalidArgumentException('non-nullable parent_call_id cannot be null'); + } + $this->container['parent_call_id'] = $parent_call_id; + + return $this; + } + + /** + * Gets transfer_caller_id + * + * @return string|null + */ + public function getTransferCallerId(): ?string + { + return $this->container['transfer_caller_id']; + } + + /** + * Sets transfer_caller_id + * + * @param string|null $transfer_caller_id The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferCallerId(?string $transfer_caller_id): static + { + if (is_null($transfer_caller_id)) { + throw new InvalidArgumentException('non-nullable transfer_caller_id cannot be null'); + } + $this->container['transfer_caller_id'] = $transfer_caller_id; + + return $this; + } + + /** + * Gets transfer_to + * + * @return string|null + */ + public function getTransferTo(): ?string + { + return $this->container['transfer_to']; + } + + /** + * Sets transfer_to + * + * @param string|null $transfer_to The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferTo(?string $transfer_to): static + { + if (is_null($transfer_to)) { + throw new InvalidArgumentException('non-nullable transfer_to cannot be null'); + } + $this->container['transfer_to'] = $transfer_to; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Endpoint.php b/src/Model/Endpoint.php new file mode 100644 index 0000000..52a3a3d --- /dev/null +++ b/src/Model/Endpoint.php @@ -0,0 +1,605 @@ + + */ +class Endpoint implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'endpoint'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'endpoint_id' => 'string', + 'type' => '\Bandwidth\Model\EndpointTypeEnum', + 'status' => '\Bandwidth\Model\EndpointStatusEnum', + 'creation_timestamp' => '\DateTime', + 'expiration_timestamp' => '\DateTime', + 'tag' => 'string', + 'devices' => '\Bandwidth\Model\Device[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'endpoint_id' => null, + 'type' => null, + 'status' => null, + 'creation_timestamp' => 'date-time', + 'expiration_timestamp' => 'date-time', + 'tag' => null, + 'devices' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'endpoint_id' => false, + 'type' => false, + 'status' => false, + 'creation_timestamp' => false, + 'expiration_timestamp' => false, + 'tag' => false, + 'devices' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'endpoint_id' => 'endpointId', + 'type' => 'type', + 'status' => 'status', + 'creation_timestamp' => 'creationTimestamp', + 'expiration_timestamp' => 'expirationTimestamp', + 'tag' => 'tag', + 'devices' => 'devices' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'endpoint_id' => 'setEndpointId', + 'type' => 'setType', + 'status' => 'setStatus', + 'creation_timestamp' => 'setCreationTimestamp', + 'expiration_timestamp' => 'setExpirationTimestamp', + 'tag' => 'setTag', + 'devices' => 'setDevices' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'endpoint_id' => 'getEndpointId', + 'type' => 'getType', + 'status' => 'getStatus', + 'creation_timestamp' => 'getCreationTimestamp', + 'expiration_timestamp' => 'getExpirationTimestamp', + 'tag' => 'getTag', + 'devices' => 'getDevices' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('endpoint_id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('creation_timestamp', $data ?? [], null); + $this->setIfExists('expiration_timestamp', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('devices', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['endpoint_id'] === null) { + $invalidProperties[] = "'endpoint_id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['creation_timestamp'] === null) { + $invalidProperties[] = "'creation_timestamp' can't be null"; + } + if ($this->container['expiration_timestamp'] === null) { + $invalidProperties[] = "'expiration_timestamp' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets endpoint_id + * + * @return string + */ + public function getEndpointId(): string + { + return $this->container['endpoint_id']; + } + + /** + * Sets endpoint_id + * + * @param string $endpoint_id The unique ID of the endpoint. + * + * @return $this + */ + public function setEndpointId(string $endpoint_id): static + { + if (is_null($endpoint_id)) { + throw new InvalidArgumentException('non-nullable endpoint_id cannot be null'); + } + $this->container['endpoint_id'] = $endpoint_id; + + return $this; + } + + /** + * Gets type + * + * @return \Bandwidth\Model\EndpointTypeEnum + */ + public function getType(): \Bandwidth\Model\EndpointTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\EndpointTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\EndpointTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets status + * + * @return \Bandwidth\Model\EndpointStatusEnum + */ + public function getStatus(): \Bandwidth\Model\EndpointStatusEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\EndpointStatusEnum $status status + * + * @return $this + */ + public function setStatus(\Bandwidth\Model\EndpointStatusEnum $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets creation_timestamp + * + * @return \DateTime + */ + public function getCreationTimestamp(): \DateTime + { + return $this->container['creation_timestamp']; + } + + /** + * Sets creation_timestamp + * + * @param \DateTime $creation_timestamp The time the endpoint was created. In ISO-8601 format. + * + * @return $this + */ + public function setCreationTimestamp(\DateTime $creation_timestamp): static + { + if (is_null($creation_timestamp)) { + throw new InvalidArgumentException('non-nullable creation_timestamp cannot be null'); + } + $this->container['creation_timestamp'] = $creation_timestamp; + + return $this; + } + + /** + * Gets expiration_timestamp + * + * @return \DateTime + */ + public function getExpirationTimestamp(): \DateTime + { + return $this->container['expiration_timestamp']; + } + + /** + * Sets expiration_timestamp + * + * @param \DateTime $expiration_timestamp The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + * + * @return $this + */ + public function setExpirationTimestamp(\DateTime $expiration_timestamp): static + { + if (is_null($expiration_timestamp)) { + throw new InvalidArgumentException('non-nullable expiration_timestamp cannot be null'); + } + $this->container['expiration_timestamp'] = $expiration_timestamp; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A tag for the endpoint. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + + + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets devices + * + * @return \Bandwidth\Model\Device[]|null + */ + public function getDevices(): ?array + { + return $this->container['devices']; + } + + /** + * Sets devices + * + * @param \Bandwidth\Model\Device[]|null $devices devices + * + * @return $this + */ + public function setDevices(?array $devices): static + { + if (is_null($devices)) { + throw new InvalidArgumentException('non-nullable devices cannot be null'); + } + $this->container['devices'] = $devices; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EndpointDirectionEnum.php b/src/Model/EndpointDirectionEnum.php new file mode 100644 index 0000000..aa3b79c --- /dev/null +++ b/src/Model/EndpointDirectionEnum.php @@ -0,0 +1,47 @@ + + */ +class EndpointEvent implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'endpointEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'endpoint_id' => 'string', + 'type' => '\Bandwidth\Model\EndpointTypeEnum', + 'status' => '\Bandwidth\Model\EndpointStatusEnum', + 'creation_timestamp' => '\DateTime', + 'expiration_timestamp' => '\DateTime', + 'tag' => 'string', + 'event_time' => '\DateTime', + 'event_type' => '\Bandwidth\Model\EndpointEventTypeEnum', + 'device' => '\Bandwidth\Model\Device' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'endpoint_id' => null, + 'type' => null, + 'status' => null, + 'creation_timestamp' => 'date-time', + 'expiration_timestamp' => 'date-time', + 'tag' => null, + 'event_time' => 'date-time', + 'event_type' => null, + 'device' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'endpoint_id' => false, + 'type' => false, + 'status' => false, + 'creation_timestamp' => false, + 'expiration_timestamp' => false, + 'tag' => false, + 'event_time' => false, + 'event_type' => false, + 'device' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'endpoint_id' => 'endpointId', + 'type' => 'type', + 'status' => 'status', + 'creation_timestamp' => 'creationTimestamp', + 'expiration_timestamp' => 'expirationTimestamp', + 'tag' => 'tag', + 'event_time' => 'eventTime', + 'event_type' => 'eventType', + 'device' => 'device' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'endpoint_id' => 'setEndpointId', + 'type' => 'setType', + 'status' => 'setStatus', + 'creation_timestamp' => 'setCreationTimestamp', + 'expiration_timestamp' => 'setExpirationTimestamp', + 'tag' => 'setTag', + 'event_time' => 'setEventTime', + 'event_type' => 'setEventType', + 'device' => 'setDevice' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'endpoint_id' => 'getEndpointId', + 'type' => 'getType', + 'status' => 'getStatus', + 'creation_timestamp' => 'getCreationTimestamp', + 'expiration_timestamp' => 'getExpirationTimestamp', + 'tag' => 'getTag', + 'event_time' => 'getEventTime', + 'event_type' => 'getEventType', + 'device' => 'getDevice' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('endpoint_id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('creation_timestamp', $data ?? [], null); + $this->setIfExists('expiration_timestamp', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('device', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['endpoint_id'] === null) { + $invalidProperties[] = "'endpoint_id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['creation_timestamp'] === null) { + $invalidProperties[] = "'creation_timestamp' can't be null"; + } + if ($this->container['expiration_timestamp'] === null) { + $invalidProperties[] = "'expiration_timestamp' can't be null"; + } + if ($this->container['event_time'] === null) { + $invalidProperties[] = "'event_time' can't be null"; + } + if ($this->container['event_type'] === null) { + $invalidProperties[] = "'event_type' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets endpoint_id + * + * @return string + */ + public function getEndpointId(): string + { + return $this->container['endpoint_id']; + } + + /** + * Sets endpoint_id + * + * @param string $endpoint_id The unique ID of the endpoint. + * + * @return $this + */ + public function setEndpointId(string $endpoint_id): static + { + if (is_null($endpoint_id)) { + throw new InvalidArgumentException('non-nullable endpoint_id cannot be null'); + } + $this->container['endpoint_id'] = $endpoint_id; + + return $this; + } + + /** + * Gets type + * + * @return \Bandwidth\Model\EndpointTypeEnum + */ + public function getType(): \Bandwidth\Model\EndpointTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\EndpointTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\EndpointTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets status + * + * @return \Bandwidth\Model\EndpointStatusEnum + */ + public function getStatus(): \Bandwidth\Model\EndpointStatusEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\EndpointStatusEnum $status status + * + * @return $this + */ + public function setStatus(\Bandwidth\Model\EndpointStatusEnum $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets creation_timestamp + * + * @return \DateTime + */ + public function getCreationTimestamp(): \DateTime + { + return $this->container['creation_timestamp']; + } + + /** + * Sets creation_timestamp + * + * @param \DateTime $creation_timestamp The time the endpoint was created. In ISO-8601 format. + * + * @return $this + */ + public function setCreationTimestamp(\DateTime $creation_timestamp): static + { + if (is_null($creation_timestamp)) { + throw new InvalidArgumentException('non-nullable creation_timestamp cannot be null'); + } + $this->container['creation_timestamp'] = $creation_timestamp; + + return $this; + } + + /** + * Gets expiration_timestamp + * + * @return \DateTime + */ + public function getExpirationTimestamp(): \DateTime + { + return $this->container['expiration_timestamp']; + } + + /** + * Sets expiration_timestamp + * + * @param \DateTime $expiration_timestamp The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + * + * @return $this + */ + public function setExpirationTimestamp(\DateTime $expiration_timestamp): static + { + if (is_null($expiration_timestamp)) { + throw new InvalidArgumentException('non-nullable expiration_timestamp cannot be null'); + } + $this->container['expiration_timestamp'] = $expiration_timestamp; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A tag for the endpoint. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + + + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime + */ + public function getEventTime(): \DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime $event_time The time the event occurred. In ISO-8601 format. + * + * @return $this + */ + public function setEventTime(\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets event_type + * + * @return \Bandwidth\Model\EndpointEventTypeEnum + */ + public function getEventType(): \Bandwidth\Model\EndpointEventTypeEnum + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param \Bandwidth\Model\EndpointEventTypeEnum $event_type event_type + * + * @return $this + */ + public function setEventType(\Bandwidth\Model\EndpointEventTypeEnum $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets device + * + * @return \Bandwidth\Model\Device|null + */ + public function getDevice(): ?\Bandwidth\Model\Device + { + return $this->container['device']; + } + + /** + * Sets device + * + * @param \Bandwidth\Model\Device|null $device device + * + * @return $this + */ + public function setDevice(?\Bandwidth\Model\Device $device): static + { + if (is_null($device)) { + throw new InvalidArgumentException('non-nullable device cannot be null'); + } + $this->container['device'] = $device; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EndpointEventTypeEnum.php b/src/Model/EndpointEventTypeEnum.php new file mode 100644 index 0000000..0ea0a93 --- /dev/null +++ b/src/Model/EndpointEventTypeEnum.php @@ -0,0 +1,45 @@ + + */ +class EndpointResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'endpointResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'links' => '\Bandwidth\Model\BrtcLink[]', + 'data' => '\Bandwidth\Model\Endpoint', + 'errors' => '\Bandwidth\Model\BrtcError[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'links' => null, + 'data' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'links' => false, + 'data' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'links' => 'links', + 'data' => 'data', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'links' => 'setLinks', + 'data' => 'setData', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'links' => 'getLinks', + 'data' => 'getData', + 'errors' => 'getErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return \Bandwidth\Model\BrtcLink[] + */ + public function getLinks(): array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Bandwidth\Model\BrtcLink[] $links links + * + * @return $this + */ + public function setLinks(array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets data + * + * @return \Bandwidth\Model\Endpoint + */ + public function getData(): \Bandwidth\Model\Endpoint + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Bandwidth\Model\Endpoint $data data + * + * @return $this + */ + public function setData(\Bandwidth\Model\Endpoint $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets errors + * + * @return \Bandwidth\Model\BrtcError[] + */ + public function getErrors(): array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Bandwidth\Model\BrtcError[] $errors errors + * + * @return $this + */ + public function setErrors(array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/EndpointStatusEnum.php b/src/Model/EndpointStatusEnum.php new file mode 100644 index 0000000..84eb986 --- /dev/null +++ b/src/Model/EndpointStatusEnum.php @@ -0,0 +1,45 @@ + + */ +class Endpoints implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'endpoints'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'endpoint_id' => 'string', + 'type' => '\Bandwidth\Model\EndpointTypeEnum', + 'status' => '\Bandwidth\Model\EndpointStatusEnum', + 'creation_timestamp' => '\DateTime', + 'expiration_timestamp' => '\DateTime', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'endpoint_id' => null, + 'type' => null, + 'status' => null, + 'creation_timestamp' => 'date-time', + 'expiration_timestamp' => 'date-time', + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'endpoint_id' => false, + 'type' => false, + 'status' => false, + 'creation_timestamp' => false, + 'expiration_timestamp' => false, + 'tag' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'endpoint_id' => 'endpointId', + 'type' => 'type', + 'status' => 'status', + 'creation_timestamp' => 'creationTimestamp', + 'expiration_timestamp' => 'expirationTimestamp', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'endpoint_id' => 'setEndpointId', + 'type' => 'setType', + 'status' => 'setStatus', + 'creation_timestamp' => 'setCreationTimestamp', + 'expiration_timestamp' => 'setExpirationTimestamp', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'endpoint_id' => 'getEndpointId', + 'type' => 'getType', + 'status' => 'getStatus', + 'creation_timestamp' => 'getCreationTimestamp', + 'expiration_timestamp' => 'getExpirationTimestamp', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('endpoint_id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('creation_timestamp', $data ?? [], null); + $this->setIfExists('expiration_timestamp', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['endpoint_id'] === null) { + $invalidProperties[] = "'endpoint_id' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['creation_timestamp'] === null) { + $invalidProperties[] = "'creation_timestamp' can't be null"; + } + if ($this->container['expiration_timestamp'] === null) { + $invalidProperties[] = "'expiration_timestamp' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets endpoint_id + * + * @return string + */ + public function getEndpointId(): string + { + return $this->container['endpoint_id']; + } + + /** + * Sets endpoint_id + * + * @param string $endpoint_id The unique ID of the endpoint. + * + * @return $this + */ + public function setEndpointId(string $endpoint_id): static + { + if (is_null($endpoint_id)) { + throw new InvalidArgumentException('non-nullable endpoint_id cannot be null'); + } + $this->container['endpoint_id'] = $endpoint_id; + + return $this; + } + + /** + * Gets type + * + * @return \Bandwidth\Model\EndpointTypeEnum + */ + public function getType(): \Bandwidth\Model\EndpointTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\EndpointTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\EndpointTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets status + * + * @return \Bandwidth\Model\EndpointStatusEnum + */ + public function getStatus(): \Bandwidth\Model\EndpointStatusEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\EndpointStatusEnum $status status + * + * @return $this + */ + public function setStatus(\Bandwidth\Model\EndpointStatusEnum $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets creation_timestamp + * + * @return \DateTime + */ + public function getCreationTimestamp(): \DateTime + { + return $this->container['creation_timestamp']; + } + + /** + * Sets creation_timestamp + * + * @param \DateTime $creation_timestamp The time the endpoint was created. In ISO-8601 format. + * + * @return $this + */ + public function setCreationTimestamp(\DateTime $creation_timestamp): static + { + if (is_null($creation_timestamp)) { + throw new InvalidArgumentException('non-nullable creation_timestamp cannot be null'); + } + $this->container['creation_timestamp'] = $creation_timestamp; + + return $this; + } + + /** + * Gets expiration_timestamp + * + * @return \DateTime + */ + public function getExpirationTimestamp(): \DateTime + { + return $this->container['expiration_timestamp']; + } + + /** + * Sets expiration_timestamp + * + * @param \DateTime $expiration_timestamp The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + * + * @return $this + */ + public function setExpirationTimestamp(\DateTime $expiration_timestamp): static + { + if (is_null($expiration_timestamp)) { + throw new InvalidArgumentException('non-nullable expiration_timestamp cannot be null'); + } + $this->container['expiration_timestamp'] = $expiration_timestamp; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A tag for the endpoint. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + + + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ErrorObject.php b/src/Model/ErrorObject.php new file mode 100644 index 0000000..fd2d2bf --- /dev/null +++ b/src/Model/ErrorObject.php @@ -0,0 +1,461 @@ + + */ +class ErrorObject implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'errorObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'description' => 'string', + 'source' => '\Bandwidth\Model\ErrorSource' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'description' => null, + 'source' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'description' => false, + 'source' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'description' => 'description', + 'source' => 'source' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'description' => 'setDescription', + 'source' => 'setSource' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'description' => 'getDescription', + 'source' => 'getSource' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['description'] === null) { + $invalidProperties[] = "'description' can't be null"; + } + if ($this->container['source'] === null) { + $invalidProperties[] = "'source' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type A concise summary of the error used for categorization. + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets description + * + * @return string + */ + public function getDescription(): string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description A detailed explanation of the error. + * + * @return $this + */ + public function setDescription(string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets source + * + * @return \Bandwidth\Model\ErrorSource + */ + public function getSource(): \Bandwidth\Model\ErrorSource + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param \Bandwidth\Model\ErrorSource $source source + * + * @return $this + */ + public function setSource(\Bandwidth\Model\ErrorSource $source): static + { + if (is_null($source)) { + throw new InvalidArgumentException('non-nullable source cannot be null'); + } + $this->container['source'] = $source; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ErrorSource.php b/src/Model/ErrorSource.php new file mode 100644 index 0000000..39f5742 --- /dev/null +++ b/src/Model/ErrorSource.php @@ -0,0 +1,487 @@ + + */ +class ErrorSource implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'errorSource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'parameter' => 'string', + 'field' => 'string', + 'header' => 'string', + 'reference' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'parameter' => null, + 'field' => null, + 'header' => null, + 'reference' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'parameter' => false, + 'field' => false, + 'header' => false, + 'reference' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'parameter' => 'parameter', + 'field' => 'field', + 'header' => 'header', + 'reference' => 'reference' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'parameter' => 'setParameter', + 'field' => 'setField', + 'header' => 'setHeader', + 'reference' => 'setReference' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'parameter' => 'getParameter', + 'field' => 'getField', + 'header' => 'getHeader', + 'reference' => 'getReference' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('parameter', $data ?? [], null); + $this->setIfExists('field', $data ?? [], null); + $this->setIfExists('header', $data ?? [], null); + $this->setIfExists('reference', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets parameter + * + * @return string|null + */ + public function getParameter(): ?string + { + return $this->container['parameter']; + } + + /** + * Sets parameter + * + * @param string|null $parameter The relevant URI query parameter causing the error + * + * @return $this + */ + public function setParameter(?string $parameter): static + { + if (is_null($parameter)) { + throw new InvalidArgumentException('non-nullable parameter cannot be null'); + } + $this->container['parameter'] = $parameter; + + return $this; + } + + /** + * Gets field + * + * @return string|null + */ + public function getField(): ?string + { + return $this->container['field']; + } + + /** + * Sets field + * + * @param string|null $field The request body field that led to the error + * + * @return $this + */ + public function setField(?string $field): static + { + if (is_null($field)) { + throw new InvalidArgumentException('non-nullable field cannot be null'); + } + $this->container['field'] = $field; + + return $this; + } + + /** + * Gets header + * + * @return string|null + */ + public function getHeader(): ?string + { + return $this->container['header']; + } + + /** + * Sets header + * + * @param string|null $header The header field that contributed to the error + * + * @return $this + */ + public function setHeader(?string $header): static + { + if (is_null($header)) { + throw new InvalidArgumentException('non-nullable header cannot be null'); + } + $this->container['header'] = $header; + + return $this; + } + + /** + * Gets reference + * + * @return string|null + */ + public function getReference(): ?string + { + return $this->container['reference']; + } + + /** + * Sets reference + * + * @param string|null $reference A resource ID or path linked to the error + * + * @return $this + */ + public function setReference(?string $reference): static + { + if (is_null($reference)) { + throw new InvalidArgumentException('non-nullable reference cannot be null'); + } + $this->container['reference'] = $reference; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FailureWebhook.php b/src/Model/FailureWebhook.php new file mode 100644 index 0000000..152f246 --- /dev/null +++ b/src/Model/FailureWebhook.php @@ -0,0 +1,576 @@ + + */ +class FailureWebhook implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'failureWebhook'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'account_id' => 'string', + 'phone_number' => 'string', + 'error_code' => 'string', + 'error_message' => 'string', + 'errors' => 'string[]', + 'internal_ticket_number' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'account_id' => null, + 'phone_number' => null, + 'error_code' => null, + 'error_message' => null, + 'errors' => null, + 'internal_ticket_number' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'phone_number' => false, + 'error_code' => false, + 'error_message' => false, + 'errors' => false, + 'internal_ticket_number' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'account_id' => 'accountId', + 'phone_number' => 'phoneNumber', + 'error_code' => 'errorCode', + 'error_message' => 'errorMessage', + 'errors' => 'errors', + 'internal_ticket_number' => 'internalTicketNumber' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'account_id' => 'setAccountId', + 'phone_number' => 'setPhoneNumber', + 'error_code' => 'setErrorCode', + 'error_message' => 'setErrorMessage', + 'errors' => 'setErrors', + 'internal_ticket_number' => 'setInternalTicketNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'account_id' => 'getAccountId', + 'phone_number' => 'getPhoneNumber', + 'error_code' => 'getErrorCode', + 'error_message' => 'getErrorMessage', + 'errors' => 'getErrors', + 'internal_ticket_number' => 'getInternalTicketNumber' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('error_message', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('internal_ticket_number', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) > 12)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be smaller than or equal to 12."; + } + + if (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) < 12)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be bigger than or equal to 12."; + } + + if (!is_null($this->container['phone_number']) && !preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $this->container['phone_number'])) { + $invalidProperties[] = "invalid value for 'phone_number', must be conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id User's account ID. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets phone_number + * + * @return string|null + */ + public function getPhoneNumber(): ?string + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string|null $phone_number Toll-free telephone number in E.164 format. + * + * @return $this + */ + public function setPhoneNumber(?string $phone_number): static + { + if (is_null($phone_number)) { + throw new InvalidArgumentException('non-nullable phone_number cannot be null'); + } + if ((mb_strlen($phone_number) > 12)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling FailureWebhook., must be smaller than or equal to 12.'); + } + if ((mb_strlen($phone_number) < 12)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling FailureWebhook., must be bigger than or equal to 12.'); + } + if ((!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", ObjectSerializer::toString($phone_number)))) { + throw new InvalidArgumentException("invalid value for \$phone_number when calling FailureWebhook., must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets error_code + * + * @return string|null + */ + public function getErrorCode(): ?string + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param string|null $error_code An error code indicating what error was encountered. This code can be interpreted as an HTTP status code in regards to the error that was encountered. + * + * @return $this + */ + public function setErrorCode(?string $error_code): static + { + if (is_null($error_code)) { + throw new InvalidArgumentException('non-nullable error_code cannot be null'); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets error_message + * + * @return string|null + */ + public function getErrorMessage(): ?string + { + return $this->container['error_message']; + } + + /** + * Sets error_message + * + * @param string|null $error_message A description of the error that was encountered. + * + * @return $this + */ + public function setErrorMessage(?string $error_message): static + { + if (is_null($error_message)) { + throw new InvalidArgumentException('non-nullable error_message cannot be null'); + } + $this->container['error_message'] = $error_message; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors(): ?array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors Details of the errors that were encountered when processing the request. + * + * @return $this + */ + public function setErrors(?array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets internal_ticket_number + * + * @return string|null + */ + public function getInternalTicketNumber(): ?string + { + return $this->container['internal_ticket_number']; + } + + /** + * Sets internal_ticket_number + * + * @param string|null $internal_ticket_number Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + * + * @return $this + */ + public function setInternalTicketNumber(?string $internal_ticket_number): static + { + if (is_null($internal_ticket_number)) { + throw new InvalidArgumentException('non-nullable internal_ticket_number cannot be null'); + } + $this->container['internal_ticket_number'] = $internal_ticket_number; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FieldError.php b/src/Model/FieldError.php new file mode 100644 index 0000000..ef837d4 --- /dev/null +++ b/src/Model/FieldError.php @@ -0,0 +1,418 @@ + + */ +class FieldError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'fieldError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'field_name' => 'string', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'field_name' => null, + 'description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'field_name' => false, + 'description' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'field_name' => 'fieldName', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'field_name' => 'setFieldName', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'field_name' => 'getFieldName', + 'description' => 'getDescription' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('field_name', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets field_name + * + * @return string|null + */ + public function getFieldName(): ?string + { + return $this->container['field_name']; + } + + /** + * Sets field_name + * + * @param string|null $field_name The name of the field that contains the error + * + * @return $this + */ + public function setFieldName(?string $field_name): static + { + if (is_null($field_name)) { + throw new InvalidArgumentException('non-nullable field_name cannot be null'); + } + $this->container['field_name'] = $field_name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The error associated with the field + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/FileFormatEnum.php b/src/Model/FileFormatEnum.php new file mode 100644 index 0000000..0eb6d1b --- /dev/null +++ b/src/Model/FileFormatEnum.php @@ -0,0 +1,46 @@ + + */ +class GatherCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'gatherCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'digits' => 'string', + 'call_url' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'parent_call_id' => 'string', + 'terminating_digit' => 'string', + 'transfer_caller_id' => 'string', + 'transfer_to' => 'string', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'digits' => null, + 'call_url' => 'uri', + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'parent_call_id' => null, + 'terminating_digit' => null, + 'transfer_caller_id' => null, + 'transfer_to' => null, + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'digits' => false, + 'call_url' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'parent_call_id' => false, + 'terminating_digit' => false, + 'transfer_caller_id' => false, + 'transfer_to' => false, + 'tag' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'digits' => 'digits', + 'call_url' => 'callUrl', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'parent_call_id' => 'parentCallId', + 'terminating_digit' => 'terminatingDigit', + 'transfer_caller_id' => 'transferCallerId', + 'transfer_to' => 'transferTo', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'digits' => 'setDigits', + 'call_url' => 'setCallUrl', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'parent_call_id' => 'setParentCallId', + 'terminating_digit' => 'setTerminatingDigit', + 'transfer_caller_id' => 'setTransferCallerId', + 'transfer_to' => 'setTransferTo', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'digits' => 'getDigits', + 'call_url' => 'getCallUrl', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'parent_call_id' => 'getParentCallId', + 'terminating_digit' => 'getTerminatingDigit', + 'transfer_caller_id' => 'getTransferCallerId', + 'transfer_to' => 'getTransferTo', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('digits', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('parent_call_id', $data ?? [], null); + $this->setIfExists('terminating_digit', $data ?? [], null); + $this->setIfExists('transfer_caller_id', $data ?? [], null); + $this->setIfExists('transfer_to', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets digits + * + * @return string|null + */ + public function getDigits(): ?string + { + return $this->container['digits']; + } + + /** + * Sets digits + * + * @param string|null $digits (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 $this + */ + public function setDigits(?string $digits): static + { + if (is_null($digits)) { + throw new InvalidArgumentException('non-nullable digits cannot be null'); + } + $this->container['digits'] = $digits; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets parent_call_id + * + * @return string|null + */ + public function getParentCallId(): ?string + { + return $this->container['parent_call_id']; + } + + /** + * Sets parent_call_id + * + * @param string|null $parent_call_id (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. + * + * @return $this + */ + public function setParentCallId(?string $parent_call_id): static + { + if (is_null($parent_call_id)) { + throw new InvalidArgumentException('non-nullable parent_call_id cannot be null'); + } + $this->container['parent_call_id'] = $parent_call_id; + + return $this; + } + + /** + * Gets terminating_digit + * + * @return string|null + */ + public function getTerminatingDigit(): ?string + { + return $this->container['terminating_digit']; + } + + /** + * Sets terminating_digit + * + * @param string|null $terminating_digit (optional) The digit the user pressed to end the gather. Empty string value if no terminating digit was pressed. + * + * @return $this + */ + public function setTerminatingDigit(?string $terminating_digit): static + { + if (is_null($terminating_digit)) { + throw new InvalidArgumentException('non-nullable terminating_digit cannot be null'); + } + $this->container['terminating_digit'] = $terminating_digit; + + return $this; + } + + /** + * Gets transfer_caller_id + * + * @return string|null + */ + public function getTransferCallerId(): ?string + { + return $this->container['transfer_caller_id']; + } + + /** + * Sets transfer_caller_id + * + * @param string|null $transfer_caller_id The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferCallerId(?string $transfer_caller_id): static + { + if (is_null($transfer_caller_id)) { + throw new InvalidArgumentException('non-nullable transfer_caller_id cannot be null'); + } + $this->container['transfer_caller_id'] = $transfer_caller_id; + + return $this; + } + + /** + * Gets transfer_to + * + * @return string|null + */ + public function getTransferTo(): ?string + { + return $this->container['transfer_to']; + } + + /** + * Sets transfer_to + * + * @param string|null $transfer_to The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferTo(?string $transfer_to): static + { + if (is_null($transfer_to)) { + throw new InvalidArgumentException('non-nullable transfer_to cannot be null'); + } + $this->container['transfer_to'] = $transfer_to; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/GetAsyncBulkLookupResponse.php b/src/Model/GetAsyncBulkLookupResponse.php new file mode 100644 index 0000000..5f29a02 --- /dev/null +++ b/src/Model/GetAsyncBulkLookupResponse.php @@ -0,0 +1,452 @@ + + */ +class GetAsyncBulkLookupResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getAsyncBulkLookupResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'links' => '\Bandwidth\Model\LinkSchema[]', + 'data' => '\Bandwidth\Model\GetAsyncBulkLookupResponseData', + 'errors' => '\Bandwidth\Model\LookupErrorSchema[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'links' => null, + 'data' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'links' => false, + 'data' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'links' => 'links', + 'data' => 'data', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'links' => 'setLinks', + 'data' => 'setData', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'links' => 'getLinks', + 'data' => 'getData', + 'errors' => 'getErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return \Bandwidth\Model\LinkSchema[]|null + */ + public function getLinks(): ?array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Bandwidth\Model\LinkSchema[]|null $links links + * + * @return $this + */ + public function setLinks(?array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets data + * + * @return \Bandwidth\Model\GetAsyncBulkLookupResponseData|null + */ + public function getData(): ?\Bandwidth\Model\GetAsyncBulkLookupResponseData + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Bandwidth\Model\GetAsyncBulkLookupResponseData|null $data data + * + * @return $this + */ + public function setData(?\Bandwidth\Model\GetAsyncBulkLookupResponseData $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets errors + * + * @return \Bandwidth\Model\LookupErrorSchema[]|null + */ + public function getErrors(): ?array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Bandwidth\Model\LookupErrorSchema[]|null $errors errors + * + * @return $this + */ + public function setErrors(?array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/GetAsyncBulkLookupResponseData.php b/src/Model/GetAsyncBulkLookupResponseData.php new file mode 100644 index 0000000..3bc9d5c --- /dev/null +++ b/src/Model/GetAsyncBulkLookupResponseData.php @@ -0,0 +1,453 @@ + + */ +class GetAsyncBulkLookupResponseData implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'getAsyncBulkLookupResponse_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'request_id' => 'string', + 'status' => '\Bandwidth\Model\InProgressLookupStatusEnum', + 'results' => '\Bandwidth\Model\LookupResult[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'request_id' => 'uuid', + 'status' => null, + 'results' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'request_id' => false, + 'status' => false, + 'results' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'request_id' => 'requestId', + 'status' => 'status', + 'results' => 'results' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'request_id' => 'setRequestId', + 'status' => 'setStatus', + 'results' => 'setResults' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'request_id' => 'getRequestId', + 'status' => 'getStatus', + 'results' => 'getResults' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('request_id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('results', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId(): ?string + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id The phone number lookup request ID from Bandwidth. + * + * @return $this + */ + public function setRequestId(?string $request_id): static + { + if (is_null($request_id)) { + throw new InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + + /** + * Gets status + * + * @return \Bandwidth\Model\InProgressLookupStatusEnum|null + */ + public function getStatus(): ?\Bandwidth\Model\InProgressLookupStatusEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\InProgressLookupStatusEnum|null $status status + * + * @return $this + */ + public function setStatus(?\Bandwidth\Model\InProgressLookupStatusEnum $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets results + * + * @return \Bandwidth\Model\LookupResult[]|null + */ + public function getResults(): ?array + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \Bandwidth\Model\LookupResult[]|null $results The carrier information results for the specified telephone number. + * + * @return $this + */ + public function setResults(?array $results): static + { + if (is_null($results)) { + throw new InvalidArgumentException('non-nullable results cannot be null'); + } + $this->container['results'] = $results; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/InProgressLookupStatusEnum.php b/src/Model/InProgressLookupStatusEnum.php new file mode 100644 index 0000000..b54a8ff --- /dev/null +++ b/src/Model/InProgressLookupStatusEnum.php @@ -0,0 +1,49 @@ + + */ +class InboundCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'inboundCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'time' => '\DateTime', + 'type' => '\Bandwidth\Model\InboundCallbackTypeEnum', + 'to' => 'string', + 'description' => 'string', + 'message' => '\Bandwidth\Model\InboundCallbackMessage', + 'carrier_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'time' => 'date-time', + 'type' => null, + 'to' => null, + 'description' => null, + 'message' => null, + 'carrier_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'time' => false, + 'type' => false, + 'to' => false, + 'description' => false, + 'message' => false, + 'carrier_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'time' => 'time', + 'type' => 'type', + 'to' => 'to', + 'description' => 'description', + 'message' => 'message', + 'carrier_name' => 'carrierName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'time' => 'setTime', + 'type' => 'setType', + 'to' => 'setTo', + 'description' => 'setDescription', + 'message' => 'setMessage', + 'carrier_name' => 'setCarrierName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'time' => 'getTime', + 'type' => 'getType', + 'to' => 'getTo', + 'description' => 'getDescription', + 'message' => 'getMessage', + 'carrier_name' => 'getCarrierName' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('carrier_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['time'] === null) { + $invalidProperties[] = "'time' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['description'] === null) { + $invalidProperties[] = "'description' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time + * + * @return \DateTime + */ + public function getTime(): \DateTime + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param \DateTime $time time + * + * @return $this + */ + public function setTime(\DateTime $time): static + { + if (is_null($time)) { + throw new InvalidArgumentException('non-nullable time cannot be null'); + } + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets type + * + * @return \Bandwidth\Model\InboundCallbackTypeEnum + */ + public function getType(): \Bandwidth\Model\InboundCallbackTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\InboundCallbackTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\InboundCallbackTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets to + * + * @return string + */ + public function getTo(): string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. + * + * @return $this + */ + public function setTo(string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets description + * + * @return string + */ + public function getDescription(): string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description A detailed description of the event described by the callback. + * + * @return $this + */ + public function setDescription(string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets message + * + * @return \Bandwidth\Model\InboundCallbackMessage + */ + public function getMessage(): \Bandwidth\Model\InboundCallbackMessage + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param \Bandwidth\Model\InboundCallbackMessage $message message + * + * @return $this + */ + public function setMessage(\Bandwidth\Model\InboundCallbackMessage $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets carrier_name + * + * @return string|null + */ + public function getCarrierName(): ?string + { + return $this->container['carrier_name']; + } + + /** + * Sets carrier_name + * + * @param string|null $carrier_name The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. + * + * @return $this + */ + public function setCarrierName(?string $carrier_name): static + { + if (is_null($carrier_name)) { + throw new InvalidArgumentException('non-nullable carrier_name cannot be null'); + } + $this->container['carrier_name'] = $carrier_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/InboundCallbackMessage.php b/src/Model/InboundCallbackMessage.php new file mode 100644 index 0000000..a984eb3 --- /dev/null +++ b/src/Model/InboundCallbackMessage.php @@ -0,0 +1,919 @@ + + */ +class InboundCallbackMessage implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'inboundCallbackMessage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'owner' => 'string', + 'application_id' => 'string', + 'time' => '\DateTime', + 'segment_count' => 'int', + 'direction' => '\Bandwidth\Model\MessageDirectionEnum', + 'to' => 'string[]', + 'from' => 'string', + 'text' => 'string', + 'tag' => 'string', + 'media' => 'string[]', + 'priority' => '\Bandwidth\Model\PriorityEnum', + 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum', + 'content' => '\Bandwidth\Model\MultiChannelMessageContent', + 'suggestion_response' => '\Bandwidth\Model\RbmSuggestionResponse', + 'location_response' => '\Bandwidth\Model\RbmLocationResponse' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'owner' => null, + 'application_id' => null, + 'time' => 'date-time', + 'segment_count' => null, + 'direction' => null, + 'to' => null, + 'from' => null, + 'text' => null, + 'tag' => null, + 'media' => 'uri', + 'priority' => null, + 'channel' => null, + 'content' => null, + 'suggestion_response' => null, + 'location_response' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'owner' => false, + 'application_id' => false, + 'time' => false, + 'segment_count' => false, + 'direction' => false, + 'to' => false, + 'from' => false, + 'text' => false, + 'tag' => false, + 'media' => false, + 'priority' => false, + 'channel' => false, + 'content' => false, + 'suggestion_response' => false, + 'location_response' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'owner' => 'owner', + 'application_id' => 'applicationId', + 'time' => 'time', + 'segment_count' => 'segmentCount', + 'direction' => 'direction', + 'to' => 'to', + 'from' => 'from', + 'text' => 'text', + 'tag' => 'tag', + 'media' => 'media', + 'priority' => 'priority', + 'channel' => 'channel', + 'content' => 'content', + 'suggestion_response' => 'suggestionResponse', + 'location_response' => 'locationResponse' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'owner' => 'setOwner', + 'application_id' => 'setApplicationId', + 'time' => 'setTime', + 'segment_count' => 'setSegmentCount', + 'direction' => 'setDirection', + 'to' => 'setTo', + 'from' => 'setFrom', + 'text' => 'setText', + 'tag' => 'setTag', + 'media' => 'setMedia', + 'priority' => 'setPriority', + 'channel' => 'setChannel', + 'content' => 'setContent', + 'suggestion_response' => 'setSuggestionResponse', + 'location_response' => 'setLocationResponse' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'owner' => 'getOwner', + 'application_id' => 'getApplicationId', + 'time' => 'getTime', + 'segment_count' => 'getSegmentCount', + 'direction' => 'getDirection', + 'to' => 'getTo', + 'from' => 'getFrom', + 'text' => 'getText', + 'tag' => 'getTag', + 'media' => 'getMedia', + 'priority' => 'getPriority', + 'channel' => 'getChannel', + 'content' => 'getContent', + 'suggestion_response' => 'getSuggestionResponse', + 'location_response' => 'getLocationResponse' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('owner', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('time', $data ?? [], null); + $this->setIfExists('segment_count', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('media', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('suggestion_response', $data ?? [], null); + $this->setIfExists('location_response', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['owner'] === null) { + $invalidProperties[] = "'owner' can't be null"; + } + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['time'] === null) { + $invalidProperties[] = "'time' can't be null"; + } + if ($this->container['segment_count'] === null) { + $invalidProperties[] = "'segment_count' can't be null"; + } + if ($this->container['direction'] === null) { + $invalidProperties[] = "'direction' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id A unique identifier of the message. + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets owner + * + * @return string + */ + public function getOwner(): string + { + return $this->container['owner']; + } + + /** + * Sets owner + * + * @param string $owner The Bandwidth phone number or alphanumeric identifier associated with the message. + * + * @return $this + */ + public function setOwner(string $owner): static + { + if (is_null($owner)) { + throw new InvalidArgumentException('non-nullable owner cannot be null'); + } + $this->container['owner'] = $owner; + + return $this; + } + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The ID of the Application your from number or senderId is associated with in the Bandwidth App. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets time + * + * @return \DateTime + */ + public function getTime(): \DateTime + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param \DateTime $time time + * + * @return $this + */ + public function setTime(\DateTime $time): static + { + if (is_null($time)) { + throw new InvalidArgumentException('non-nullable time cannot be null'); + } + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets segment_count + * + * @return int + */ + public function getSegmentCount(): int + { + return $this->container['segment_count']; + } + + /** + * Sets segment_count + * + * @param int $segment_count The number of segments the user's message is broken into before sending over carrier networks. + * + * @return $this + */ + public function setSegmentCount(int $segment_count): static + { + if (is_null($segment_count)) { + throw new InvalidArgumentException('non-nullable segment_count cannot be null'); + } + $this->container['segment_count'] = $segment_count; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\MessageDirectionEnum + */ + public function getDirection(): \Bandwidth\Model\MessageDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\MessageDirectionEnum $direction direction + * + * @return $this + */ + public function setDirection(\Bandwidth\Model\MessageDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets to + * + * @return string[] + */ + public function getTo(): array + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to The phone number recipients of the message. + * + * @return $this + */ + public function setTo(array $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from The Bandwidth phone number or alphanumeric identifier the message was sent from. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText(): ?string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text text + * + * @return $this + */ + public function setText(?string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A custom string that will be included in callback events of the message. Max 1024 characters. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets media + * + * @return string[]|null + */ + public function getMedia(): ?array + { + return $this->container['media']; + } + + /** + * Sets media + * + * @param string[]|null $media Optional media, not applicable for sms + * + * @return $this + */ + public function setMedia(?array $media): static + { + if (is_null($media)) { + throw new InvalidArgumentException('non-nullable media cannot be null'); + } + $this->container['media'] = $media; + + return $this; + } + + /** + * Gets priority + * + * @return \Bandwidth\Model\PriorityEnum|null + */ + public function getPriority(): ?\Bandwidth\Model\PriorityEnum + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param \Bandwidth\Model\PriorityEnum|null $priority priority + * + * @return $this + */ + public function setPriority(?\Bandwidth\Model\PriorityEnum $priority): static + { + if (is_null($priority)) { + throw new InvalidArgumentException('non-nullable priority cannot be null'); + } + $this->container['priority'] = $priority; + + return $this; + } + + /** + * Gets channel + * + * @return \Bandwidth\Model\MultiChannelMessageChannelEnum|null + */ + public function getChannel(): ?\Bandwidth\Model\MultiChannelMessageChannelEnum + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Bandwidth\Model\MultiChannelMessageChannelEnum|null $channel channel + * + * @return $this + */ + public function setChannel(?\Bandwidth\Model\MultiChannelMessageChannelEnum $channel): static + { + if (is_null($channel)) { + throw new InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets content + * + * @return \Bandwidth\Model\MultiChannelMessageContent|null + */ + public function getContent(): ?\Bandwidth\Model\MultiChannelMessageContent + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Bandwidth\Model\MultiChannelMessageContent|null $content content + * + * @return $this + */ + public function setContent(?\Bandwidth\Model\MultiChannelMessageContent $content): static + { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets suggestion_response + * + * @return \Bandwidth\Model\RbmSuggestionResponse|null + */ + public function getSuggestionResponse(): ?\Bandwidth\Model\RbmSuggestionResponse + { + return $this->container['suggestion_response']; + } + + /** + * Sets suggestion_response + * + * @param \Bandwidth\Model\RbmSuggestionResponse|null $suggestion_response suggestion_response + * + * @return $this + */ + public function setSuggestionResponse(?\Bandwidth\Model\RbmSuggestionResponse $suggestion_response): static + { + if (is_null($suggestion_response)) { + throw new InvalidArgumentException('non-nullable suggestion_response cannot be null'); + } + $this->container['suggestion_response'] = $suggestion_response; + + return $this; + } + + /** + * Gets location_response + * + * @return \Bandwidth\Model\RbmLocationResponse|null + */ + public function getLocationResponse(): ?\Bandwidth\Model\RbmLocationResponse + { + return $this->container['location_response']; + } + + /** + * Sets location_response + * + * @param \Bandwidth\Model\RbmLocationResponse|null $location_response location_response + * + * @return $this + */ + public function setLocationResponse(?\Bandwidth\Model\RbmLocationResponse $location_response): static + { + if (is_null($location_response)) { + throw new InvalidArgumentException('non-nullable location_response cannot be null'); + } + $this->container['location_response'] = $location_response; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/InboundCallbackTypeEnum.php b/src/Model/InboundCallbackTypeEnum.php new file mode 100644 index 0000000..b0c9463 --- /dev/null +++ b/src/Model/InboundCallbackTypeEnum.php @@ -0,0 +1,48 @@ + + */ +class InitiateCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'initiateCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'start_time' => '\DateTime', + 'diversion' => '\Bandwidth\Model\Diversion', + 'stir_shaken' => '\Bandwidth\Model\StirShaken', + 'uui' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'start_time' => 'date-time', + 'diversion' => null, + 'stir_shaken' => null, + 'uui' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'start_time' => false, + 'diversion' => false, + 'stir_shaken' => false, + 'uui' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'start_time' => 'startTime', + 'diversion' => 'diversion', + 'stir_shaken' => 'stirShaken', + 'uui' => 'uui' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'start_time' => 'setStartTime', + 'diversion' => 'setDiversion', + 'stir_shaken' => 'setStirShaken', + 'uui' => 'setUui' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'start_time' => 'getStartTime', + 'diversion' => 'getDiversion', + 'stir_shaken' => 'getStirShaken', + 'uui' => 'getUui' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('diversion', $data ?? [], null); + $this->setIfExists('stir_shaken', $data ?? [], null); + $this->setIfExists('uui', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['uui']) && (mb_strlen($this->container['uui']) > 256)) { + $invalidProperties[] = "invalid value for 'uui', the character length must be smaller than or equal to 256."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets diversion + * + * @return \Bandwidth\Model\Diversion|null + */ + public function getDiversion(): ?\Bandwidth\Model\Diversion + { + return $this->container['diversion']; + } + + /** + * Sets diversion + * + * @param \Bandwidth\Model\Diversion|null $diversion diversion + * + * @return $this + */ + public function setDiversion(?\Bandwidth\Model\Diversion $diversion): static + { + if (is_null($diversion)) { + throw new InvalidArgumentException('non-nullable diversion cannot be null'); + } + $this->container['diversion'] = $diversion; + + return $this; + } + + /** + * Gets stir_shaken + * + * @return \Bandwidth\Model\StirShaken|null + */ + public function getStirShaken(): ?\Bandwidth\Model\StirShaken + { + return $this->container['stir_shaken']; + } + + /** + * Sets stir_shaken + * + * @param \Bandwidth\Model\StirShaken|null $stir_shaken stir_shaken + * + * @return $this + */ + public function setStirShaken(?\Bandwidth\Model\StirShaken $stir_shaken): static + { + if (is_null($stir_shaken)) { + throw new InvalidArgumentException('non-nullable stir_shaken cannot be null'); + } + $this->container['stir_shaken'] = $stir_shaken; + + return $this; + } + + /** + * Gets uui + * + * @return string|null + */ + public function getUui(): ?string + { + return $this->container['uui']; + } + + /** + * Sets uui + * + * @param string|null $uui 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`, `jwt` and `hex` encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters. + * + * @return $this + */ + public function setUui(?string $uui): static + { + if (is_null($uui)) { + throw new InvalidArgumentException('non-nullable uui cannot be null'); + } + if ((mb_strlen($uui) > 256)) { + throw new InvalidArgumentException('invalid length for $uui when calling InitiateCallback., must be smaller than or equal to 256.'); + } + + $this->container['uui'] = $uui; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LatestMessageDeliveryStatusEnum.php b/src/Model/LatestMessageDeliveryStatusEnum.php new file mode 100644 index 0000000..aa02724 --- /dev/null +++ b/src/Model/LatestMessageDeliveryStatusEnum.php @@ -0,0 +1,50 @@ + + */ +class Link implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'link'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'rel' => 'string', + 'href' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'rel' => null, + 'href' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'rel' => false, + 'href' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'rel' => 'rel', + 'href' => 'href' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'rel' => 'setRel', + 'href' => 'setHref' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'rel' => 'getRel', + 'href' => 'getHref' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('rel', $data ?? [], null); + $this->setIfExists('href', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets rel + * + * @return string|null + */ + public function getRel(): ?string + { + return $this->container['rel']; + } + + /** + * Sets rel + * + * @param string|null $rel rel + * + * @return $this + */ + public function setRel(?string $rel): static + { + if (is_null($rel)) { + throw new InvalidArgumentException('non-nullable rel cannot be null'); + } + $this->container['rel'] = $rel; + + return $this; + } + + /** + * Gets href + * + * @return string|null + */ + public function getHref(): ?string + { + return $this->container['href']; + } + + /** + * Sets href + * + * @param string|null $href href + * + * @return $this + */ + public function setHref(?string $href): static + { + if (is_null($href)) { + throw new InvalidArgumentException('non-nullable href cannot be null'); + } + $this->container['href'] = $href; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LinkSchema.php b/src/Model/LinkSchema.php new file mode 100644 index 0000000..3bb93a7 --- /dev/null +++ b/src/Model/LinkSchema.php @@ -0,0 +1,452 @@ + + */ +class LinkSchema implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'linkSchema'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'href' => 'string', + 'rel' => 'string', + 'method' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'href' => null, + 'rel' => null, + 'method' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'href' => false, + 'rel' => false, + 'method' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'href' => 'href', + 'rel' => 'rel', + 'method' => 'method' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'href' => 'setHref', + 'rel' => 'setRel', + 'method' => 'setMethod' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'href' => 'getHref', + 'rel' => 'getRel', + 'method' => 'getMethod' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('href', $data ?? [], null); + $this->setIfExists('rel', $data ?? [], null); + $this->setIfExists('method', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets href + * + * @return string|null + */ + public function getHref(): ?string + { + return $this->container['href']; + } + + /** + * Sets href + * + * @param string|null $href URI of the link. + * + * @return $this + */ + public function setHref(?string $href): static + { + if (is_null($href)) { + throw new InvalidArgumentException('non-nullable href cannot be null'); + } + $this->container['href'] = $href; + + return $this; + } + + /** + * Gets rel + * + * @return string|null + */ + public function getRel(): ?string + { + return $this->container['rel']; + } + + /** + * Sets rel + * + * @param string|null $rel Specifies the relationship between this link and the resource. + * + * @return $this + */ + public function setRel(?string $rel): static + { + if (is_null($rel)) { + throw new InvalidArgumentException('non-nullable rel cannot be null'); + } + $this->container['rel'] = $rel; + + return $this; + } + + /** + * Gets method + * + * @return string|null + */ + public function getMethod(): ?string + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string|null $method HTTP method to be used. + * + * @return $this + */ + public function setMethod(?string $method): static + { + if (is_null($method)) { + throw new InvalidArgumentException('non-nullable method cannot be null'); + } + $this->container['method'] = $method; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LinksObject.php b/src/Model/LinksObject.php new file mode 100644 index 0000000..941a1c1 --- /dev/null +++ b/src/Model/LinksObject.php @@ -0,0 +1,486 @@ + + */ +class LinksObject implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'linksObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'first' => 'string', + 'next' => 'string', + 'previous' => 'string', + 'last' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'first' => null, + 'next' => null, + 'previous' => null, + 'last' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'first' => false, + 'next' => false, + 'previous' => false, + 'last' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'first' => 'first', + 'next' => 'next', + 'previous' => 'previous', + 'last' => 'last' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'first' => 'setFirst', + 'next' => 'setNext', + 'previous' => 'setPrevious', + 'last' => 'setLast' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'first' => 'getFirst', + 'next' => 'getNext', + 'previous' => 'getPrevious', + 'last' => 'getLast' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('first', $data ?? [], null); + $this->setIfExists('next', $data ?? [], null); + $this->setIfExists('previous', $data ?? [], null); + $this->setIfExists('last', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets first + * + * @return string|null + */ + public function getFirst(): ?string + { + return $this->container['first']; + } + + /** + * Sets first + * + * @param string|null $first The first (or only) page of results matching the query. + * + * @return $this + */ + public function setFirst(?string $first): static + { + if (is_null($first)) { + throw new InvalidArgumentException('non-nullable first cannot be null'); + } + $this->container['first'] = $first; + + return $this; + } + + /** + * Gets next + * + * @return string|null + */ + public function getNext(): ?string + { + return $this->container['next']; + } + + /** + * Sets next + * + * @param string|null $next If more results exist than specified by 'size', this link returns the next page of 'size' results. + * + * @return $this + */ + public function setNext(?string $next): static + { + if (is_null($next)) { + throw new InvalidArgumentException('non-nullable next cannot be null'); + } + $this->container['next'] = $next; + + return $this; + } + + /** + * Gets previous + * + * @return string|null + */ + public function getPrevious(): ?string + { + return $this->container['previous']; + } + + /** + * Sets previous + * + * @param string|null $previous If the results are more than one page, this link returns the previous page of 'size' results. + * + * @return $this + */ + public function setPrevious(?string $previous): static + { + if (is_null($previous)) { + throw new InvalidArgumentException('non-nullable previous cannot be null'); + } + $this->container['previous'] = $previous; + + return $this; + } + + /** + * Gets last + * + * @return string|null + */ + public function getLast(): ?string + { + return $this->container['last']; + } + + /** + * Sets last + * + * @param string|null $last If more results exist than specified by 'size', this link return the last page of result. + * + * @return $this + */ + public function setLast(?string $last): static + { + if (is_null($last)) { + throw new InvalidArgumentException('non-nullable last cannot be null'); + } + $this->container['last'] = $last; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ListEndpointsResponse.php b/src/Model/ListEndpointsResponse.php new file mode 100644 index 0000000..d34df68 --- /dev/null +++ b/src/Model/ListEndpointsResponse.php @@ -0,0 +1,495 @@ + + */ +class ListEndpointsResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'listEndpointsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'links' => '\Bandwidth\Model\BrtcLink[]', + 'page' => '\Bandwidth\Model\Page', + 'data' => '\Bandwidth\Model\Endpoints[]', + 'errors' => '\Bandwidth\Model\BrtcError[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'links' => null, + 'page' => null, + 'data' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'links' => false, + 'page' => false, + 'data' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'links' => 'links', + 'page' => 'page', + 'data' => 'data', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'links' => 'setLinks', + 'page' => 'setPage', + 'data' => 'setData', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'links' => 'getLinks', + 'page' => 'getPage', + 'data' => 'getData', + 'errors' => 'getErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('page', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['links'] === null) { + $invalidProperties[] = "'links' can't be null"; + } + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return \Bandwidth\Model\BrtcLink[] + */ + public function getLinks(): array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Bandwidth\Model\BrtcLink[] $links links + * + * @return $this + */ + public function setLinks(array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets page + * + * @return \Bandwidth\Model\Page|null + */ + public function getPage(): ?\Bandwidth\Model\Page + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param \Bandwidth\Model\Page|null $page page + * + * @return $this + */ + public function setPage(?\Bandwidth\Model\Page $page): static + { + if (is_null($page)) { + throw new InvalidArgumentException('non-nullable page cannot be null'); + } + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets data + * + * @return \Bandwidth\Model\Endpoints[] + */ + public function getData(): array + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Bandwidth\Model\Endpoints[] $data data + * + * @return $this + */ + public function setData(array $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets errors + * + * @return \Bandwidth\Model\BrtcError[] + */ + public function getErrors(): array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Bandwidth\Model\BrtcError[] $errors errors + * + * @return $this + */ + public function setErrors(array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ListMessageDirectionEnum.php b/src/Model/ListMessageDirectionEnum.php new file mode 100644 index 0000000..0872877 --- /dev/null +++ b/src/Model/ListMessageDirectionEnum.php @@ -0,0 +1,46 @@ + + */ +class ListMessageItem implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'listMessageItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'message_id' => 'string', + 'account_id' => 'string', + 'source_tn' => 'string', + 'destination_tn' => 'string', + 'message_status' => '\Bandwidth\Model\MessageStatusEnum', + 'message_direction' => '\Bandwidth\Model\ListMessageDirectionEnum', + 'message_type' => '\Bandwidth\Model\MessageTypeEnum', + 'segment_count' => 'int', + 'error_code' => 'int', + 'receive_time' => '\DateTime', + 'carrier_name' => 'string', + 'message_size' => 'int', + 'message_length' => 'int', + 'attachment_count' => 'int', + 'recipient_count' => 'int', + 'campaign_class' => 'string', + 'campaign_id' => 'string', + 'bw_latency' => 'int', + 'carrier_latency' => 'int', + 'calling_number_country_a3' => 'string', + 'called_number_country_a3' => 'string', + 'product' => 'string', + 'location' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'message_id' => null, + 'account_id' => null, + 'source_tn' => null, + 'destination_tn' => null, + 'message_status' => null, + 'message_direction' => null, + 'message_type' => null, + 'segment_count' => null, + 'error_code' => null, + 'receive_time' => 'date-time', + 'carrier_name' => null, + 'message_size' => null, + 'message_length' => null, + 'attachment_count' => null, + 'recipient_count' => null, + 'campaign_class' => null, + 'campaign_id' => null, + 'bw_latency' => null, + 'carrier_latency' => null, + 'calling_number_country_a3' => null, + 'called_number_country_a3' => null, + 'product' => null, + 'location' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'message_id' => false, + 'account_id' => false, + 'source_tn' => false, + 'destination_tn' => false, + 'message_status' => false, + 'message_direction' => false, + 'message_type' => false, + 'segment_count' => false, + 'error_code' => false, + 'receive_time' => false, + 'carrier_name' => true, + 'message_size' => true, + 'message_length' => false, + 'attachment_count' => true, + 'recipient_count' => true, + 'campaign_class' => true, + 'campaign_id' => true, + 'bw_latency' => true, + 'carrier_latency' => true, + 'calling_number_country_a3' => true, + 'called_number_country_a3' => true, + 'product' => true, + 'location' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'message_id' => 'messageId', + 'account_id' => 'accountId', + 'source_tn' => 'sourceTn', + 'destination_tn' => 'destinationTn', + 'message_status' => 'messageStatus', + 'message_direction' => 'messageDirection', + 'message_type' => 'messageType', + 'segment_count' => 'segmentCount', + 'error_code' => 'errorCode', + 'receive_time' => 'receiveTime', + 'carrier_name' => 'carrierName', + 'message_size' => 'messageSize', + 'message_length' => 'messageLength', + 'attachment_count' => 'attachmentCount', + 'recipient_count' => 'recipientCount', + 'campaign_class' => 'campaignClass', + 'campaign_id' => 'campaignId', + 'bw_latency' => 'bwLatency', + 'carrier_latency' => 'carrierLatency', + 'calling_number_country_a3' => 'callingNumberCountryA3', + 'called_number_country_a3' => 'calledNumberCountryA3', + 'product' => 'product', + 'location' => 'location' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'message_id' => 'setMessageId', + 'account_id' => 'setAccountId', + 'source_tn' => 'setSourceTn', + 'destination_tn' => 'setDestinationTn', + 'message_status' => 'setMessageStatus', + 'message_direction' => 'setMessageDirection', + 'message_type' => 'setMessageType', + 'segment_count' => 'setSegmentCount', + 'error_code' => 'setErrorCode', + 'receive_time' => 'setReceiveTime', + 'carrier_name' => 'setCarrierName', + 'message_size' => 'setMessageSize', + 'message_length' => 'setMessageLength', + 'attachment_count' => 'setAttachmentCount', + 'recipient_count' => 'setRecipientCount', + 'campaign_class' => 'setCampaignClass', + 'campaign_id' => 'setCampaignId', + 'bw_latency' => 'setBwLatency', + 'carrier_latency' => 'setCarrierLatency', + 'calling_number_country_a3' => 'setCallingNumberCountryA3', + 'called_number_country_a3' => 'setCalledNumberCountryA3', + 'product' => 'setProduct', + 'location' => 'setLocation' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'message_id' => 'getMessageId', + 'account_id' => 'getAccountId', + 'source_tn' => 'getSourceTn', + 'destination_tn' => 'getDestinationTn', + 'message_status' => 'getMessageStatus', + 'message_direction' => 'getMessageDirection', + 'message_type' => 'getMessageType', + 'segment_count' => 'getSegmentCount', + 'error_code' => 'getErrorCode', + 'receive_time' => 'getReceiveTime', + 'carrier_name' => 'getCarrierName', + 'message_size' => 'getMessageSize', + 'message_length' => 'getMessageLength', + 'attachment_count' => 'getAttachmentCount', + 'recipient_count' => 'getRecipientCount', + 'campaign_class' => 'getCampaignClass', + 'campaign_id' => 'getCampaignId', + 'bw_latency' => 'getBwLatency', + 'carrier_latency' => 'getCarrierLatency', + 'calling_number_country_a3' => 'getCallingNumberCountryA3', + 'called_number_country_a3' => 'getCalledNumberCountryA3', + 'product' => 'getProduct', + 'location' => 'getLocation' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('source_tn', $data ?? [], null); + $this->setIfExists('destination_tn', $data ?? [], null); + $this->setIfExists('message_status', $data ?? [], null); + $this->setIfExists('message_direction', $data ?? [], null); + $this->setIfExists('message_type', $data ?? [], null); + $this->setIfExists('segment_count', $data ?? [], null); + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('receive_time', $data ?? [], null); + $this->setIfExists('carrier_name', $data ?? [], null); + $this->setIfExists('message_size', $data ?? [], null); + $this->setIfExists('message_length', $data ?? [], null); + $this->setIfExists('attachment_count', $data ?? [], null); + $this->setIfExists('recipient_count', $data ?? [], null); + $this->setIfExists('campaign_class', $data ?? [], null); + $this->setIfExists('campaign_id', $data ?? [], null); + $this->setIfExists('bw_latency', $data ?? [], null); + $this->setIfExists('carrier_latency', $data ?? [], null); + $this->setIfExists('calling_number_country_a3', $data ?? [], null); + $this->setIfExists('called_number_country_a3', $data ?? [], null); + $this->setIfExists('product', $data ?? [], null); + $this->setIfExists('location', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string|null + */ + public function getMessageId(): ?string + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string|null $message_id The message id + * + * @return $this + */ + public function setMessageId(?string $message_id): static + { + if (is_null($message_id)) { + throw new InvalidArgumentException('non-nullable message_id cannot be null'); + } + $this->container['message_id'] = $message_id; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The account id associated with this message. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets source_tn + * + * @return string|null + */ + public function getSourceTn(): ?string + { + return $this->container['source_tn']; + } + + /** + * Sets source_tn + * + * @param string|null $source_tn The source phone number of the message. + * + * @return $this + */ + public function setSourceTn(?string $source_tn): static + { + if (is_null($source_tn)) { + throw new InvalidArgumentException('non-nullable source_tn cannot be null'); + } + $this->container['source_tn'] = $source_tn; + + return $this; + } + + /** + * Gets destination_tn + * + * @return string|null + */ + public function getDestinationTn(): ?string + { + return $this->container['destination_tn']; + } + + /** + * Sets destination_tn + * + * @param string|null $destination_tn The recipient phone number of the message. + * + * @return $this + */ + public function setDestinationTn(?string $destination_tn): static + { + if (is_null($destination_tn)) { + throw new InvalidArgumentException('non-nullable destination_tn cannot be null'); + } + $this->container['destination_tn'] = $destination_tn; + + return $this; + } + + /** + * Gets message_status + * + * @return \Bandwidth\Model\MessageStatusEnum|null + */ + public function getMessageStatus(): ?\Bandwidth\Model\MessageStatusEnum + { + return $this->container['message_status']; + } + + /** + * Sets message_status + * + * @param \Bandwidth\Model\MessageStatusEnum|null $message_status message_status + * + * @return $this + */ + public function setMessageStatus(?\Bandwidth\Model\MessageStatusEnum $message_status): static + { + if (is_null($message_status)) { + throw new InvalidArgumentException('non-nullable message_status cannot be null'); + } + $this->container['message_status'] = $message_status; + + return $this; + } + + /** + * Gets message_direction + * + * @return \Bandwidth\Model\ListMessageDirectionEnum|null + */ + public function getMessageDirection(): ?\Bandwidth\Model\ListMessageDirectionEnum + { + return $this->container['message_direction']; + } + + /** + * Sets message_direction + * + * @param \Bandwidth\Model\ListMessageDirectionEnum|null $message_direction message_direction + * + * @return $this + */ + public function setMessageDirection(?\Bandwidth\Model\ListMessageDirectionEnum $message_direction): static + { + if (is_null($message_direction)) { + throw new InvalidArgumentException('non-nullable message_direction cannot be null'); + } + $this->container['message_direction'] = $message_direction; + + return $this; + } + + /** + * Gets message_type + * + * @return \Bandwidth\Model\MessageTypeEnum|null + */ + public function getMessageType(): ?\Bandwidth\Model\MessageTypeEnum + { + return $this->container['message_type']; + } + + /** + * Sets message_type + * + * @param \Bandwidth\Model\MessageTypeEnum|null $message_type message_type + * + * @return $this + */ + public function setMessageType(?\Bandwidth\Model\MessageTypeEnum $message_type): static + { + if (is_null($message_type)) { + throw new InvalidArgumentException('non-nullable message_type cannot be null'); + } + $this->container['message_type'] = $message_type; + + return $this; + } + + /** + * Gets segment_count + * + * @return int|null + */ + public function getSegmentCount(): ?int + { + return $this->container['segment_count']; + } + + /** + * Sets segment_count + * + * @param int|null $segment_count The number of segments the user's message is broken into before sending over carrier networks. + * + * @return $this + */ + public function setSegmentCount(?int $segment_count): static + { + if (is_null($segment_count)) { + throw new InvalidArgumentException('non-nullable segment_count cannot be null'); + } + $this->container['segment_count'] = $segment_count; + + return $this; + } + + /** + * Gets error_code + * + * @return int|null + */ + public function getErrorCode(): ?int + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param int|null $error_code The numeric error code of the message. + * + * @return $this + */ + public function setErrorCode(?int $error_code): static + { + if (is_null($error_code)) { + throw new InvalidArgumentException('non-nullable error_code cannot be null'); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets receive_time + * + * @return \DateTime|null + */ + public function getReceiveTime(): ?\DateTime + { + return $this->container['receive_time']; + } + + /** + * Sets receive_time + * + * @param \DateTime|null $receive_time The ISO 8601 datetime of the message. + * + * @return $this + */ + public function setReceiveTime(?\DateTime $receive_time): static + { + if (is_null($receive_time)) { + throw new InvalidArgumentException('non-nullable receive_time cannot be null'); + } + $this->container['receive_time'] = $receive_time; + + return $this; + } + + /** + * Gets carrier_name + * + * @return string|null + */ + public function getCarrierName(): ?string + { + return $this->container['carrier_name']; + } + + /** + * Sets carrier_name + * + * @param string|null $carrier_name The name of the carrier. Not currently supported for MMS coming soon. + * + * @return $this + */ + public function setCarrierName(?string $carrier_name): static + { + if (is_null($carrier_name)) { + array_push($this->openAPINullablesSetToNull, 'carrier_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('carrier_name', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['carrier_name'] = $carrier_name; + + return $this; + } + + /** + * Gets message_size + * + * @return int|null + */ + public function getMessageSize(): ?int + { + return $this->container['message_size']; + } + + /** + * Sets message_size + * + * @param int|null $message_size The size of the message including message content and headers. + * + * @return $this + */ + public function setMessageSize(?int $message_size): static + { + if (is_null($message_size)) { + array_push($this->openAPINullablesSetToNull, 'message_size'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message_size', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['message_size'] = $message_size; + + return $this; + } + + /** + * Gets message_length + * + * @return int|null + */ + public function getMessageLength(): ?int + { + return $this->container['message_length']; + } + + /** + * Sets message_length + * + * @param int|null $message_length The length of the message content. + * + * @return $this + */ + public function setMessageLength(?int $message_length): static + { + if (is_null($message_length)) { + throw new InvalidArgumentException('non-nullable message_length cannot be null'); + } + $this->container['message_length'] = $message_length; + + return $this; + } + + /** + * Gets attachment_count + * + * @return int|null + */ + public function getAttachmentCount(): ?int + { + return $this->container['attachment_count']; + } + + /** + * Sets attachment_count + * + * @param int|null $attachment_count The number of attachments the message has. + * + * @return $this + */ + public function setAttachmentCount(?int $attachment_count): static + { + if (is_null($attachment_count)) { + array_push($this->openAPINullablesSetToNull, 'attachment_count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attachment_count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['attachment_count'] = $attachment_count; + + return $this; + } + + /** + * Gets recipient_count + * + * @return int|null + */ + public function getRecipientCount(): ?int + { + return $this->container['recipient_count']; + } + + /** + * Sets recipient_count + * + * @param int|null $recipient_count The number of recipients the message has. + * + * @return $this + */ + public function setRecipientCount(?int $recipient_count): static + { + if (is_null($recipient_count)) { + array_push($this->openAPINullablesSetToNull, 'recipient_count'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('recipient_count', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['recipient_count'] = $recipient_count; + + return $this; + } + + /** + * Gets campaign_class + * + * @return string|null + */ + public function getCampaignClass(): ?string + { + return $this->container['campaign_class']; + } + + /** + * Sets campaign_class + * + * @param string|null $campaign_class The campaign class of the message if it has one. + * + * @return $this + */ + public function setCampaignClass(?string $campaign_class): static + { + if (is_null($campaign_class)) { + array_push($this->openAPINullablesSetToNull, 'campaign_class'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign_class', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign_class'] = $campaign_class; + + return $this; + } + + /** + * Gets campaign_id + * + * @return string|null + */ + public function getCampaignId(): ?string + { + return $this->container['campaign_id']; + } + + /** + * Sets campaign_id + * + * @param string|null $campaign_id The campaign ID of the message if it has one. + * + * @return $this + */ + public function setCampaignId(?string $campaign_id): static + { + if (is_null($campaign_id)) { + array_push($this->openAPINullablesSetToNull, 'campaign_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('campaign_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['campaign_id'] = $campaign_id; + + return $this; + } + + /** + * Gets bw_latency + * + * @return int|null + */ + public function getBwLatency(): ?int + { + return $this->container['bw_latency']; + } + + /** + * Sets bw_latency + * + * @param int|null $bw_latency The Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled. + * + * @return $this + */ + public function setBwLatency(?int $bw_latency): static + { + if (is_null($bw_latency)) { + array_push($this->openAPINullablesSetToNull, 'bw_latency'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bw_latency', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['bw_latency'] = $bw_latency; + + return $this; + } + + /** + * Gets carrier_latency + * + * @return int|null + */ + public function getCarrierLatency(): ?int + { + return $this->container['carrier_latency']; + } + + /** + * Sets carrier_latency + * + * @param int|null $carrier_latency The carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled. + * + * @return $this + */ + public function setCarrierLatency(?int $carrier_latency): static + { + if (is_null($carrier_latency)) { + array_push($this->openAPINullablesSetToNull, 'carrier_latency'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('carrier_latency', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['carrier_latency'] = $carrier_latency; + + return $this; + } + + /** + * Gets calling_number_country_a3 + * + * @return string|null + */ + public function getCallingNumberCountryA3(): ?string + { + return $this->container['calling_number_country_a3']; + } + + /** + * Sets calling_number_country_a3 + * + * @param string|null $calling_number_country_a3 The A3 country code of the calling number. + * + * @return $this + */ + public function setCallingNumberCountryA3(?string $calling_number_country_a3): static + { + if (is_null($calling_number_country_a3)) { + array_push($this->openAPINullablesSetToNull, 'calling_number_country_a3'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('calling_number_country_a3', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['calling_number_country_a3'] = $calling_number_country_a3; + + return $this; + } + + /** + * Gets called_number_country_a3 + * + * @return string|null + */ + public function getCalledNumberCountryA3(): ?string + { + return $this->container['called_number_country_a3']; + } + + /** + * Sets called_number_country_a3 + * + * @param string|null $called_number_country_a3 The A3 country code of the called number. + * + * @return $this + */ + public function setCalledNumberCountryA3(?string $called_number_country_a3): static + { + if (is_null($called_number_country_a3)) { + array_push($this->openAPINullablesSetToNull, 'called_number_country_a3'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('called_number_country_a3', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['called_number_country_a3'] = $called_number_country_a3; + + return $this; + } + + /** + * Gets product + * + * @return string|null + */ + public function getProduct(): ?string + { + return $this->container['product']; + } + + /** + * Sets product + * + * @param string|null $product The messaging product associated with the message. + * + * @return $this + */ + public function setProduct(?string $product): static + { + if (is_null($product)) { + array_push($this->openAPINullablesSetToNull, 'product'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('product', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['product'] = $product; + + return $this; + } + + /** + * Gets location + * + * @return string|null + */ + public function getLocation(): ?string + { + return $this->container['location']; + } + + /** + * Sets location + * + * @param string|null $location The location ID associated with this message. + * + * @return $this + */ + public function setLocation(?string $location): static + { + if (is_null($location)) { + array_push($this->openAPINullablesSetToNull, 'location'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('location', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['location'] = $location; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LookupErrorResponse.php b/src/Model/LookupErrorResponse.php new file mode 100644 index 0000000..56544af --- /dev/null +++ b/src/Model/LookupErrorResponse.php @@ -0,0 +1,452 @@ + + */ +class LookupErrorResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'lookupErrorResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'links' => '\Bandwidth\Model\LinkSchema[]', + 'data' => 'object', + 'errors' => '\Bandwidth\Model\LookupErrorSchema[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'links' => null, + 'data' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'links' => false, + 'data' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'links' => 'links', + 'data' => 'data', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'links' => 'setLinks', + 'data' => 'setData', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'links' => 'getLinks', + 'data' => 'getData', + 'errors' => 'getErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return \Bandwidth\Model\LinkSchema[]|null + */ + public function getLinks(): ?array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Bandwidth\Model\LinkSchema[]|null $links links + * + * @return $this + */ + public function setLinks(?array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets data + * + * @return object|null + */ + public function getData(): ?object + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param object|null $data The phone number lookup response data + * + * @return $this + */ + public function setData(?object $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets errors + * + * @return \Bandwidth\Model\LookupErrorSchema[]|null + */ + public function getErrors(): ?array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Bandwidth\Model\LookupErrorSchema[]|null $errors errors + * + * @return $this + */ + public function setErrors(?array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LookupErrorSchema.php b/src/Model/LookupErrorSchema.php new file mode 100644 index 0000000..d11ec7d --- /dev/null +++ b/src/Model/LookupErrorSchema.php @@ -0,0 +1,495 @@ + + */ +class LookupErrorSchema implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'lookupErrorSchema'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'code' => 'string', + 'description' => 'string', + 'type' => 'string', + 'meta' => '\Bandwidth\Model\LookupErrorSchemaMeta' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'code' => null, + 'description' => null, + 'type' => null, + 'meta' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false, + 'description' => false, + 'type' => false, + 'meta' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'code' => 'code', + 'description' => 'description', + 'type' => 'type', + 'meta' => 'meta' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'code' => 'setCode', + 'description' => 'setDescription', + 'type' => 'setType', + 'meta' => 'setMeta' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'code' => 'getCode', + 'description' => 'getDescription', + 'type' => 'getType', + 'meta' => 'getMeta' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('meta', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + if ($this->container['description'] === null) { + $invalidProperties[] = "'description' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets code + * + * @return string + */ + public function getCode(): string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code Validation error code + * + * @return $this + */ + public function setCode(string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets description + * + * @return string + */ + public function getDescription(): string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description Description of validation error + * + * @return $this + */ + public function setDescription(string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type Type of validation error + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets meta + * + * @return \Bandwidth\Model\LookupErrorSchemaMeta|null + */ + public function getMeta(): ?\Bandwidth\Model\LookupErrorSchemaMeta + { + return $this->container['meta']; + } + + /** + * Sets meta + * + * @param \Bandwidth\Model\LookupErrorSchemaMeta|null $meta meta + * + * @return $this + */ + public function setMeta(?\Bandwidth\Model\LookupErrorSchemaMeta $meta): static + { + if (is_null($meta)) { + throw new InvalidArgumentException('non-nullable meta cannot be null'); + } + $this->container['meta'] = $meta; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LookupErrorSchemaMeta.php b/src/Model/LookupErrorSchemaMeta.php new file mode 100644 index 0000000..acf43a9 --- /dev/null +++ b/src/Model/LookupErrorSchemaMeta.php @@ -0,0 +1,452 @@ + + */ +class LookupErrorSchemaMeta implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'lookupErrorSchema_meta'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'phone_numbers' => 'string[]', + 'message' => 'string', + 'code' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'phone_numbers' => null, + 'message' => null, + 'code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'phone_numbers' => false, + 'message' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'phone_numbers' => 'phoneNumbers', + 'message' => 'message', + 'code' => 'code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'phone_numbers' => 'setPhoneNumbers', + 'message' => 'setMessage', + 'code' => 'setCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'phone_numbers' => 'getPhoneNumbers', + 'message' => 'getMessage', + 'code' => 'getCode' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('phone_numbers', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets phone_numbers + * + * @return string[]|null + */ + public function getPhoneNumbers(): ?array + { + return $this->container['phone_numbers']; + } + + /** + * Sets phone_numbers + * + * @param string[]|null $phone_numbers phone_numbers + * + * @return $this + */ + public function setPhoneNumbers(?array $phone_numbers): static + { + if (is_null($phone_numbers)) { + throw new InvalidArgumentException('non-nullable phone_numbers cannot be null'); + } + $this->container['phone_numbers'] = $phone_numbers; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage(): ?string + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message Message describing the error + * + * @return $this + */ + public function setMessage(?string $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets code + * + * @return int|null + */ + public function getCode(): ?int + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param int|null $code Error code associated with the message + * + * @return $this + */ + public function setCode(?int $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/LookupResult.php b/src/Model/LookupResult.php new file mode 100644 index 0000000..de8a322 --- /dev/null +++ b/src/Model/LookupResult.php @@ -0,0 +1,759 @@ + + */ +class LookupResult implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'lookupResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'phone_number' => 'string', + 'line_type' => '\Bandwidth\Model\LineTypeEnum', + 'messaging_provider' => 'string', + 'voice_provider' => 'string', + 'country_code_a3' => 'string', + 'deactivation_reporter' => 'string', + 'deactivation_date' => 'string', + 'deactivation_event' => '\Bandwidth\Model\DeactivationEventEnum', + 'latest_message_delivery_status' => '\Bandwidth\Model\LatestMessageDeliveryStatusEnum', + 'initial_message_delivery_status_date' => '\DateTime', + 'latest_message_delivery_status_date' => '\DateTime', + 'rcs_enabled' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'phone_number' => null, + 'line_type' => null, + 'messaging_provider' => null, + 'voice_provider' => null, + 'country_code_a3' => null, + 'deactivation_reporter' => null, + 'deactivation_date' => 'date-time-local', + 'deactivation_event' => null, + 'latest_message_delivery_status' => null, + 'initial_message_delivery_status_date' => 'date', + 'latest_message_delivery_status_date' => 'date', + 'rcs_enabled' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'phone_number' => false, + 'line_type' => false, + 'messaging_provider' => false, + 'voice_provider' => false, + 'country_code_a3' => false, + 'deactivation_reporter' => false, + 'deactivation_date' => false, + 'deactivation_event' => false, + 'latest_message_delivery_status' => false, + 'initial_message_delivery_status_date' => false, + 'latest_message_delivery_status_date' => false, + 'rcs_enabled' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'phone_number' => 'phoneNumber', + 'line_type' => 'lineType', + 'messaging_provider' => 'messagingProvider', + 'voice_provider' => 'voiceProvider', + 'country_code_a3' => 'countryCodeA3', + 'deactivation_reporter' => 'deactivationReporter', + 'deactivation_date' => 'deactivationDate', + 'deactivation_event' => 'deactivationEvent', + 'latest_message_delivery_status' => 'latestMessageDeliveryStatus', + 'initial_message_delivery_status_date' => 'initialMessageDeliveryStatusDate', + 'latest_message_delivery_status_date' => 'latestMessageDeliveryStatusDate', + 'rcs_enabled' => 'rcsEnabled' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'phone_number' => 'setPhoneNumber', + 'line_type' => 'setLineType', + 'messaging_provider' => 'setMessagingProvider', + 'voice_provider' => 'setVoiceProvider', + 'country_code_a3' => 'setCountryCodeA3', + 'deactivation_reporter' => 'setDeactivationReporter', + 'deactivation_date' => 'setDeactivationDate', + 'deactivation_event' => 'setDeactivationEvent', + 'latest_message_delivery_status' => 'setLatestMessageDeliveryStatus', + 'initial_message_delivery_status_date' => 'setInitialMessageDeliveryStatusDate', + 'latest_message_delivery_status_date' => 'setLatestMessageDeliveryStatusDate', + 'rcs_enabled' => 'setRcsEnabled' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'phone_number' => 'getPhoneNumber', + 'line_type' => 'getLineType', + 'messaging_provider' => 'getMessagingProvider', + 'voice_provider' => 'getVoiceProvider', + 'country_code_a3' => 'getCountryCodeA3', + 'deactivation_reporter' => 'getDeactivationReporter', + 'deactivation_date' => 'getDeactivationDate', + 'deactivation_event' => 'getDeactivationEvent', + 'latest_message_delivery_status' => 'getLatestMessageDeliveryStatus', + 'initial_message_delivery_status_date' => 'getInitialMessageDeliveryStatusDate', + 'latest_message_delivery_status_date' => 'getLatestMessageDeliveryStatusDate', + 'rcs_enabled' => 'getRcsEnabled' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('line_type', $data ?? [], null); + $this->setIfExists('messaging_provider', $data ?? [], null); + $this->setIfExists('voice_provider', $data ?? [], null); + $this->setIfExists('country_code_a3', $data ?? [], null); + $this->setIfExists('deactivation_reporter', $data ?? [], null); + $this->setIfExists('deactivation_date', $data ?? [], null); + $this->setIfExists('deactivation_event', $data ?? [], null); + $this->setIfExists('latest_message_delivery_status', $data ?? [], null); + $this->setIfExists('initial_message_delivery_status_date', $data ?? [], null); + $this->setIfExists('latest_message_delivery_status_date', $data ?? [], null); + $this->setIfExists('rcs_enabled', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets phone_number + * + * @return string|null + */ + public function getPhoneNumber(): ?string + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string|null $phone_number The telephone number in E.164 format. + * + * @return $this + */ + public function setPhoneNumber(?string $phone_number): static + { + if (is_null($phone_number)) { + throw new InvalidArgumentException('non-nullable phone_number cannot be null'); + } + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets line_type + * + * @return \Bandwidth\Model\LineTypeEnum|null + */ + public function getLineType(): ?\Bandwidth\Model\LineTypeEnum + { + return $this->container['line_type']; + } + + /** + * Sets line_type + * + * @param \Bandwidth\Model\LineTypeEnum|null $line_type line_type + * + * @return $this + */ + public function setLineType(?\Bandwidth\Model\LineTypeEnum $line_type): static + { + if (is_null($line_type)) { + throw new InvalidArgumentException('non-nullable line_type cannot be null'); + } + $this->container['line_type'] = $line_type; + + return $this; + } + + /** + * Gets messaging_provider + * + * @return string|null + */ + public function getMessagingProvider(): ?string + { + return $this->container['messaging_provider']; + } + + /** + * Sets messaging_provider + * + * @param string|null $messaging_provider The messaging service provider of the telephone number. + * + * @return $this + */ + public function setMessagingProvider(?string $messaging_provider): static + { + if (is_null($messaging_provider)) { + throw new InvalidArgumentException('non-nullable messaging_provider cannot be null'); + } + $this->container['messaging_provider'] = $messaging_provider; + + return $this; + } + + /** + * Gets voice_provider + * + * @return string|null + */ + public function getVoiceProvider(): ?string + { + return $this->container['voice_provider']; + } + + /** + * Sets voice_provider + * + * @param string|null $voice_provider The voice service provider of the telephone number. + * + * @return $this + */ + public function setVoiceProvider(?string $voice_provider): static + { + if (is_null($voice_provider)) { + throw new InvalidArgumentException('non-nullable voice_provider cannot be null'); + } + $this->container['voice_provider'] = $voice_provider; + + return $this; + } + + /** + * Gets country_code_a3 + * + * @return string|null + */ + public function getCountryCodeA3(): ?string + { + return $this->container['country_code_a3']; + } + + /** + * Sets country_code_a3 + * + * @param string|null $country_code_a3 The country code of the telephone number in ISO 3166-1 alpha-3 format. + * + * @return $this + */ + public function setCountryCodeA3(?string $country_code_a3): static + { + if (is_null($country_code_a3)) { + throw new InvalidArgumentException('non-nullable country_code_a3 cannot be null'); + } + $this->container['country_code_a3'] = $country_code_a3; + + return $this; + } + + /** + * Gets deactivation_reporter + * + * @return string|null + */ + public function getDeactivationReporter(): ?string + { + return $this->container['deactivation_reporter']; + } + + /** + * Sets deactivation_reporter + * + * @param string|null $deactivation_reporter [DNI-Only](#section/DNI-Only). The carrier that reported a deactivation event for this phone number. + * + * @return $this + */ + public function setDeactivationReporter(?string $deactivation_reporter): static + { + if (is_null($deactivation_reporter)) { + throw new InvalidArgumentException('non-nullable deactivation_reporter cannot be null'); + } + $this->container['deactivation_reporter'] = $deactivation_reporter; + + return $this; + } + + /** + * Gets deactivation_date + * + * @return string|null + */ + public function getDeactivationDate(): ?string + { + return $this->container['deactivation_date']; + } + + /** + * Sets deactivation_date + * + * @param string|null $deactivation_date [DNI-Only](#section/DNI-Only). The datetime the carrier reported a deactivation event. + * + * @return $this + */ + public function setDeactivationDate(?string $deactivation_date): static + { + if (is_null($deactivation_date)) { + throw new InvalidArgumentException('non-nullable deactivation_date cannot be null'); + } + $this->container['deactivation_date'] = $deactivation_date; + + return $this; + } + + /** + * Gets deactivation_event + * + * @return \Bandwidth\Model\DeactivationEventEnum|null + */ + public function getDeactivationEvent(): ?\Bandwidth\Model\DeactivationEventEnum + { + return $this->container['deactivation_event']; + } + + /** + * Sets deactivation_event + * + * @param \Bandwidth\Model\DeactivationEventEnum|null $deactivation_event deactivation_event + * + * @return $this + */ + public function setDeactivationEvent(?\Bandwidth\Model\DeactivationEventEnum $deactivation_event): static + { + if (is_null($deactivation_event)) { + throw new InvalidArgumentException('non-nullable deactivation_event cannot be null'); + } + $this->container['deactivation_event'] = $deactivation_event; + + return $this; + } + + /** + * Gets latest_message_delivery_status + * + * @return \Bandwidth\Model\LatestMessageDeliveryStatusEnum|null + */ + public function getLatestMessageDeliveryStatus(): ?\Bandwidth\Model\LatestMessageDeliveryStatusEnum + { + return $this->container['latest_message_delivery_status']; + } + + /** + * Sets latest_message_delivery_status + * + * @param \Bandwidth\Model\LatestMessageDeliveryStatusEnum|null $latest_message_delivery_status latest_message_delivery_status + * + * @return $this + */ + public function setLatestMessageDeliveryStatus(?\Bandwidth\Model\LatestMessageDeliveryStatusEnum $latest_message_delivery_status): static + { + if (is_null($latest_message_delivery_status)) { + throw new InvalidArgumentException('non-nullable latest_message_delivery_status cannot be null'); + } + $this->container['latest_message_delivery_status'] = $latest_message_delivery_status; + + return $this; + } + + /** + * Gets initial_message_delivery_status_date + * + * @return \DateTime|null + */ + public function getInitialMessageDeliveryStatusDate(): ?\DateTime + { + return $this->container['initial_message_delivery_status_date']; + } + + /** + * Sets initial_message_delivery_status_date + * + * @param \DateTime|null $initial_message_delivery_status_date [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes. + * + * @return $this + */ + public function setInitialMessageDeliveryStatusDate(?\DateTime $initial_message_delivery_status_date): static + { + if (is_null($initial_message_delivery_status_date)) { + throw new InvalidArgumentException('non-nullable initial_message_delivery_status_date cannot be null'); + } + $this->container['initial_message_delivery_status_date'] = $initial_message_delivery_status_date; + + return $this; + } + + /** + * Gets latest_message_delivery_status_date + * + * @return \DateTime|null + */ + public function getLatestMessageDeliveryStatusDate(): ?\DateTime + { + return $this->container['latest_message_delivery_status_date']; + } + + /** + * Sets latest_message_delivery_status_date + * + * @param \DateTime|null $latest_message_delivery_status_date [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes. + * + * @return $this + */ + public function setLatestMessageDeliveryStatusDate(?\DateTime $latest_message_delivery_status_date): static + { + if (is_null($latest_message_delivery_status_date)) { + throw new InvalidArgumentException('non-nullable latest_message_delivery_status_date cannot be null'); + } + $this->container['latest_message_delivery_status_date'] = $latest_message_delivery_status_date; + + return $this; + } + + /** + * Gets rcs_enabled + * + * @return bool|null + */ + public function getRcsEnabled(): ?bool + { + return $this->container['rcs_enabled']; + } + + /** + * Sets rcs_enabled + * + * @param bool|null $rcs_enabled [RCS-Only](#section/RCS-Only). Indicates whether the phone number is capable of receiving RCS messages. Value will be null if account has RCS, but no value was returned. Absent when account does not have RCS. + * + * @return $this + */ + public function setRcsEnabled(?bool $rcs_enabled): static + { + if (is_null($rcs_enabled)) { + throw new InvalidArgumentException('non-nullable rcs_enabled cannot be null'); + } + $this->container['rcs_enabled'] = $rcs_enabled; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MachineDetectionCompleteCallback.php b/src/Model/MachineDetectionCompleteCallback.php new file mode 100644 index 0000000..3143a5b --- /dev/null +++ b/src/Model/MachineDetectionCompleteCallback.php @@ -0,0 +1,855 @@ + + */ +class MachineDetectionCompleteCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'machineDetectionCompleteCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'tag' => 'string', + 'machine_detection_result' => '\Bandwidth\Model\MachineDetectionResult' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'tag' => null, + 'machine_detection_result' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'tag' => true, + 'machine_detection_result' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'tag' => 'tag', + 'machine_detection_result' => 'machineDetectionResult' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'tag' => 'setTag', + 'machine_detection_result' => 'setMachineDetectionResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'tag' => 'getTag', + 'machine_detection_result' => 'getMachineDetectionResult' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('machine_detection_result', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets machine_detection_result + * + * @return \Bandwidth\Model\MachineDetectionResult|null + */ + public function getMachineDetectionResult(): ?\Bandwidth\Model\MachineDetectionResult + { + return $this->container['machine_detection_result']; + } + + /** + * Sets machine_detection_result + * + * @param \Bandwidth\Model\MachineDetectionResult|null $machine_detection_result machine_detection_result + * + * @return $this + */ + public function setMachineDetectionResult(?\Bandwidth\Model\MachineDetectionResult $machine_detection_result): static + { + if (is_null($machine_detection_result)) { + array_push($this->openAPINullablesSetToNull, 'machine_detection_result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('machine_detection_result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['machine_detection_result'] = $machine_detection_result; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MachineDetectionConfiguration.php b/src/Model/MachineDetectionConfiguration.php new file mode 100644 index 0000000..7f10821 --- /dev/null +++ b/src/Model/MachineDetectionConfiguration.php @@ -0,0 +1,1007 @@ + + */ +class MachineDetectionConfiguration implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'machineDetectionConfiguration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'mode' => '\Bandwidth\Model\MachineDetectionModeEnum', + 'detection_timeout' => 'float', + 'silence_timeout' => 'float', + 'speech_threshold' => 'float', + 'speech_end_threshold' => 'float', + 'machine_speech_end_threshold' => 'float', + 'delay_result' => 'bool', + 'callback_url' => 'string', + 'callback_method' => '\Bandwidth\Model\CallbackMethodEnum', + 'username' => 'string', + 'password' => 'string', + 'fallback_url' => 'string', + 'fallback_method' => '\Bandwidth\Model\CallbackMethodEnum', + 'fallback_username' => 'string', + 'fallback_password' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'mode' => null, + 'detection_timeout' => 'double', + 'silence_timeout' => 'double', + 'speech_threshold' => 'double', + 'speech_end_threshold' => 'double', + 'machine_speech_end_threshold' => 'double', + 'delay_result' => null, + 'callback_url' => 'uri', + 'callback_method' => null, + 'username' => null, + 'password' => null, + 'fallback_url' => 'uri', + 'fallback_method' => null, + 'fallback_username' => null, + 'fallback_password' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'mode' => false, + 'detection_timeout' => true, + 'silence_timeout' => true, + 'speech_threshold' => true, + 'speech_end_threshold' => true, + 'machine_speech_end_threshold' => true, + 'delay_result' => true, + 'callback_url' => true, + 'callback_method' => true, + 'username' => true, + 'password' => true, + 'fallback_url' => true, + 'fallback_method' => true, + 'fallback_username' => true, + 'fallback_password' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'mode' => 'mode', + 'detection_timeout' => 'detectionTimeout', + 'silence_timeout' => 'silenceTimeout', + 'speech_threshold' => 'speechThreshold', + 'speech_end_threshold' => 'speechEndThreshold', + 'machine_speech_end_threshold' => 'machineSpeechEndThreshold', + 'delay_result' => 'delayResult', + 'callback_url' => 'callbackUrl', + 'callback_method' => 'callbackMethod', + 'username' => 'username', + 'password' => 'password', + 'fallback_url' => 'fallbackUrl', + 'fallback_method' => 'fallbackMethod', + 'fallback_username' => 'fallbackUsername', + 'fallback_password' => 'fallbackPassword' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'mode' => 'setMode', + 'detection_timeout' => 'setDetectionTimeout', + 'silence_timeout' => 'setSilenceTimeout', + 'speech_threshold' => 'setSpeechThreshold', + 'speech_end_threshold' => 'setSpeechEndThreshold', + 'machine_speech_end_threshold' => 'setMachineSpeechEndThreshold', + 'delay_result' => 'setDelayResult', + 'callback_url' => 'setCallbackUrl', + 'callback_method' => 'setCallbackMethod', + 'username' => 'setUsername', + 'password' => 'setPassword', + 'fallback_url' => 'setFallbackUrl', + 'fallback_method' => 'setFallbackMethod', + 'fallback_username' => 'setFallbackUsername', + 'fallback_password' => 'setFallbackPassword' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'mode' => 'getMode', + 'detection_timeout' => 'getDetectionTimeout', + 'silence_timeout' => 'getSilenceTimeout', + 'speech_threshold' => 'getSpeechThreshold', + 'speech_end_threshold' => 'getSpeechEndThreshold', + 'machine_speech_end_threshold' => 'getMachineSpeechEndThreshold', + 'delay_result' => 'getDelayResult', + 'callback_url' => 'getCallbackUrl', + 'callback_method' => 'getCallbackMethod', + 'username' => 'getUsername', + 'password' => 'getPassword', + 'fallback_url' => 'getFallbackUrl', + 'fallback_method' => 'getFallbackMethod', + 'fallback_username' => 'getFallbackUsername', + 'fallback_password' => 'getFallbackPassword' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('mode', $data ?? [], null); + $this->setIfExists('detection_timeout', $data ?? [], 15); + $this->setIfExists('silence_timeout', $data ?? [], 10); + $this->setIfExists('speech_threshold', $data ?? [], 10); + $this->setIfExists('speech_end_threshold', $data ?? [], 5); + $this->setIfExists('machine_speech_end_threshold', $data ?? [], null); + $this->setIfExists('delay_result', $data ?? [], false); + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('callback_method', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('fallback_url', $data ?? [], null); + $this->setIfExists('fallback_method', $data ?? [], null); + $this->setIfExists('fallback_username', $data ?? [], null); + $this->setIfExists('fallback_password', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['callback_url']) && (mb_strlen($this->container['callback_url']) > 2048)) { + $invalidProperties[] = "invalid value for 'callback_url', the character length must be smaller than or equal to 2048."; + } + + if (!is_null($this->container['username']) && (mb_strlen($this->container['username']) > 1024)) { + $invalidProperties[] = "invalid value for 'username', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) > 1024)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['fallback_url']) && (mb_strlen($this->container['fallback_url']) > 2048)) { + $invalidProperties[] = "invalid value for 'fallback_url', the character length must be smaller than or equal to 2048."; + } + + if (!is_null($this->container['fallback_username']) && (mb_strlen($this->container['fallback_username']) > 1024)) { + $invalidProperties[] = "invalid value for 'fallback_username', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['fallback_password']) && (mb_strlen($this->container['fallback_password']) > 1024)) { + $invalidProperties[] = "invalid value for 'fallback_password', the character length must be smaller than or equal to 1024."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mode + * + * @return \Bandwidth\Model\MachineDetectionModeEnum|null + */ + public function getMode(): ?\Bandwidth\Model\MachineDetectionModeEnum + { + return $this->container['mode']; + } + + /** + * Sets mode + * + * @param \Bandwidth\Model\MachineDetectionModeEnum|null $mode mode + * + * @return $this + */ + public function setMode(?\Bandwidth\Model\MachineDetectionModeEnum $mode): static + { + if (is_null($mode)) { + throw new InvalidArgumentException('non-nullable mode cannot be null'); + } + $this->container['mode'] = $mode; + + return $this; + } + + /** + * Gets detection_timeout + * + * @return float|null + */ + public function getDetectionTimeout(): ?float + { + return $this->container['detection_timeout']; + } + + /** + * Sets detection_timeout + * + * @param float|null $detection_timeout 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 $this + */ + public function setDetectionTimeout(?float $detection_timeout): static + { + if (is_null($detection_timeout)) { + array_push($this->openAPINullablesSetToNull, 'detection_timeout'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('detection_timeout', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['detection_timeout'] = $detection_timeout; + + return $this; + } + + /** + * Gets silence_timeout + * + * @return float|null + */ + public function getSilenceTimeout(): ?float + { + return $this->container['silence_timeout']; + } + + /** + * Sets silence_timeout + * + * @param float|null $silence_timeout If no speech is detected in this period, a callback with a 'silence' result is sent. + * + * @return $this + */ + public function setSilenceTimeout(?float $silence_timeout): static + { + if (is_null($silence_timeout)) { + array_push($this->openAPINullablesSetToNull, 'silence_timeout'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('silence_timeout', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['silence_timeout'] = $silence_timeout; + + return $this; + } + + /** + * Gets speech_threshold + * + * @return float|null + */ + public function getSpeechThreshold(): ?float + { + return $this->container['speech_threshold']; + } + + /** + * Sets speech_threshold + * + * @param float|null $speech_threshold 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 $this + */ + public function setSpeechThreshold(?float $speech_threshold): static + { + if (is_null($speech_threshold)) { + array_push($this->openAPINullablesSetToNull, 'speech_threshold'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('speech_threshold', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['speech_threshold'] = $speech_threshold; + + return $this; + } + + /** + * Gets speech_end_threshold + * + * @return float|null + */ + public function getSpeechEndThreshold(): ?float + { + return $this->container['speech_end_threshold']; + } + + /** + * Sets speech_end_threshold + * + * @param float|null $speech_end_threshold Amount of silence (in seconds) before assuming the callee has finished speaking. + * + * @return $this + */ + public function setSpeechEndThreshold(?float $speech_end_threshold): static + { + if (is_null($speech_end_threshold)) { + array_push($this->openAPINullablesSetToNull, 'speech_end_threshold'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('speech_end_threshold', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['speech_end_threshold'] = $speech_end_threshold; + + return $this; + } + + /** + * Gets machine_speech_end_threshold + * + * @return float|null + */ + public function getMachineSpeechEndThreshold(): ?float + { + return $this->container['machine_speech_end_threshold']; + } + + /** + * Sets machine_speech_end_threshold + * + * @param float|null $machine_speech_end_threshold 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 $this + */ + public function setMachineSpeechEndThreshold(?float $machine_speech_end_threshold): static + { + if (is_null($machine_speech_end_threshold)) { + array_push($this->openAPINullablesSetToNull, 'machine_speech_end_threshold'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('machine_speech_end_threshold', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['machine_speech_end_threshold'] = $machine_speech_end_threshold; + + return $this; + } + + /** + * Gets delay_result + * + * @return bool|null + */ + public function getDelayResult(): ?bool + { + return $this->container['delay_result']; + } + + /** + * Sets delay_result + * + * @param bool|null $delay_result 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 $this + */ + public function setDelayResult(?bool $delay_result): static + { + if (is_null($delay_result)) { + array_push($this->openAPINullablesSetToNull, 'delay_result'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('delay_result', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['delay_result'] = $delay_result; + + return $this; + } + + /** + * Gets callback_url + * + * @return string|null + */ + public function getCallbackUrl(): ?string + { + return $this->container['callback_url']; + } + + /** + * Sets callback_url + * + * @param string|null $callback_url The URL to send the 'machineDetectionComplete' webhook when the detection is completed. Only for 'async' mode. + * + * @return $this + */ + public function setCallbackUrl(?string $callback_url): static + { + if (is_null($callback_url)) { + array_push($this->openAPINullablesSetToNull, 'callback_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('callback_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($callback_url) && (mb_strlen($callback_url) > 2048)) { + throw new InvalidArgumentException('invalid length for $callback_url when calling MachineDetectionConfiguration., must be smaller than or equal to 2048.'); + } + + $this->container['callback_url'] = $callback_url; + + return $this; + } + + /** + * Gets callback_method + * + * @return \Bandwidth\Model\CallbackMethodEnum|null + */ + public function getCallbackMethod(): ?\Bandwidth\Model\CallbackMethodEnum + { + return $this->container['callback_method']; + } + + /** + * Sets callback_method + * + * @param \Bandwidth\Model\CallbackMethodEnum|null $callback_method callback_method + * + * @return $this + */ + public function setCallbackMethod(?\Bandwidth\Model\CallbackMethodEnum $callback_method): static + { + if (is_null($callback_method)) { + array_push($this->openAPINullablesSetToNull, 'callback_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('callback_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['callback_method'] = $callback_method; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username Basic auth username. + * + * @return $this + */ + public function setUsername(?string $username): static + { + if (is_null($username)) { + array_push($this->openAPINullablesSetToNull, 'username'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('username', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($username) && (mb_strlen($username) > 1024)) { + throw new InvalidArgumentException('invalid length for $username when calling MachineDetectionConfiguration., must be smaller than or equal to 1024.'); + } + + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password Basic auth password. + * + * @return $this + */ + public function setPassword(?string $password): static + { + if (is_null($password)) { + array_push($this->openAPINullablesSetToNull, 'password'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('password', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($password) && (mb_strlen($password) > 1024)) { + throw new InvalidArgumentException('invalid length for $password when calling MachineDetectionConfiguration., must be smaller than or equal to 1024.'); + } + + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets fallback_url + * + * @return string|null + */ + public function getFallbackUrl(): ?string + { + return $this->container['fallback_url']; + } + + /** + * Sets fallback_url + * + * @param string|null $fallback_url A fallback URL which, if provided, will be used to retry the machine detection complete webhook delivery in case `callbackUrl` fails to respond + * + * @return $this + */ + public function setFallbackUrl(?string $fallback_url): static + { + if (is_null($fallback_url)) { + array_push($this->openAPINullablesSetToNull, 'fallback_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($fallback_url) && (mb_strlen($fallback_url) > 2048)) { + throw new InvalidArgumentException('invalid length for $fallback_url when calling MachineDetectionConfiguration., must be smaller than or equal to 2048.'); + } + + $this->container['fallback_url'] = $fallback_url; + + return $this; + } + + /** + * Gets fallback_method + * + * @return \Bandwidth\Model\CallbackMethodEnum|null + */ + public function getFallbackMethod(): ?\Bandwidth\Model\CallbackMethodEnum + { + return $this->container['fallback_method']; + } + + /** + * Sets fallback_method + * + * @param \Bandwidth\Model\CallbackMethodEnum|null $fallback_method fallback_method + * + * @return $this + */ + public function setFallbackMethod(?\Bandwidth\Model\CallbackMethodEnum $fallback_method): static + { + if (is_null($fallback_method)) { + array_push($this->openAPINullablesSetToNull, 'fallback_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['fallback_method'] = $fallback_method; + + return $this; + } + + /** + * Gets fallback_username + * + * @return string|null + */ + public function getFallbackUsername(): ?string + { + return $this->container['fallback_username']; + } + + /** + * Sets fallback_username + * + * @param string|null $fallback_username Basic auth username. + * + * @return $this + */ + public function setFallbackUsername(?string $fallback_username): static + { + if (is_null($fallback_username)) { + array_push($this->openAPINullablesSetToNull, 'fallback_username'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_username', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($fallback_username) && (mb_strlen($fallback_username) > 1024)) { + throw new InvalidArgumentException('invalid length for $fallback_username when calling MachineDetectionConfiguration., must be smaller than or equal to 1024.'); + } + + $this->container['fallback_username'] = $fallback_username; + + return $this; + } + + /** + * Gets fallback_password + * + * @return string|null + */ + public function getFallbackPassword(): ?string + { + return $this->container['fallback_password']; + } + + /** + * Sets fallback_password + * + * @param string|null $fallback_password Basic auth password. + * + * @return $this + */ + public function setFallbackPassword(?string $fallback_password): static + { + if (is_null($fallback_password)) { + array_push($this->openAPINullablesSetToNull, 'fallback_password'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_password', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($fallback_password) && (mb_strlen($fallback_password) > 1024)) { + throw new InvalidArgumentException('invalid length for $fallback_password when calling MachineDetectionConfiguration., must be smaller than or equal to 1024.'); + } + + $this->container['fallback_password'] = $fallback_password; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MachineDetectionModeEnum.php b/src/Model/MachineDetectionModeEnum.php new file mode 100644 index 0000000..e02b887 --- /dev/null +++ b/src/Model/MachineDetectionModeEnum.php @@ -0,0 +1,46 @@ + + */ +class MachineDetectionResult implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'machineDetectionResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'value' => 'string', + 'duration' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'value' => null, + 'duration' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'value' => false, + 'duration' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'value' => 'value', + 'duration' => 'duration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'value' => 'setValue', + 'duration' => 'setDuration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'value' => 'getValue', + 'duration' => 'getDuration' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets value + * + * @return string|null + */ + public function getValue(): ?string + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value Possible values are answering-machine, human, silence, timeout, or error. + * + * @return $this + */ + public function setValue(?string $value): static + { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets duration + * + * @return string|null + */ + public function getDuration(): ?string + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param string|null $duration The amount of time it took to determine the result. + * + * @return $this + */ + public function setDuration(?string $duration): static + { + if (is_null($duration)) { + throw new InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Media.php b/src/Model/Media.php new file mode 100644 index 0000000..2dc01f5 --- /dev/null +++ b/src/Model/Media.php @@ -0,0 +1,452 @@ + + */ +class Media implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'media'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'content' => 'string', + 'content_length' => 'int', + 'media_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'content' => null, + 'content_length' => null, + 'media_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'content' => false, + 'content_length' => false, + 'media_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'content' => 'content', + 'content_length' => 'contentLength', + 'media_name' => 'mediaName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'content' => 'setContent', + 'content_length' => 'setContentLength', + 'media_name' => 'setMediaName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'content' => 'getContent', + 'content_length' => 'getContentLength', + 'media_name' => 'getMediaName' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('content_length', $data ?? [], null); + $this->setIfExists('media_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return string|null + */ + public function getContent(): ?string + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param string|null $content content + * + * @return $this + */ + public function setContent(?string $content): static + { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets content_length + * + * @return int|null + */ + public function getContentLength(): ?int + { + return $this->container['content_length']; + } + + /** + * Sets content_length + * + * @param int|null $content_length content_length + * + * @return $this + */ + public function setContentLength(?int $content_length): static + { + if (is_null($content_length)) { + throw new InvalidArgumentException('non-nullable content_length cannot be null'); + } + $this->container['content_length'] = $content_length; + + return $this; + } + + /** + * Gets media_name + * + * @return string|null + */ + public function getMediaName(): ?string + { + return $this->container['media_name']; + } + + /** + * Sets media_name + * + * @param string|null $media_name media_name + * + * @return $this + */ + public function setMediaName(?string $media_name): static + { + if (is_null($media_name)) { + throw new InvalidArgumentException('non-nullable media_name cannot be null'); + } + $this->container['media_name'] = $media_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Message.php b/src/Model/Message.php new file mode 100644 index 0000000..342c4a4 --- /dev/null +++ b/src/Model/Message.php @@ -0,0 +1,794 @@ + + */ +class Message implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'message'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'owner' => 'string', + 'application_id' => 'string', + 'time' => '\DateTime', + 'segment_count' => 'int', + 'direction' => '\Bandwidth\Model\MessageDirectionEnum', + 'to' => 'string[]', + 'from' => 'string', + 'media' => 'string[]', + 'text' => 'string', + 'tag' => 'string', + 'priority' => '\Bandwidth\Model\PriorityEnum', + 'expiration' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'owner' => null, + 'application_id' => null, + 'time' => 'date-time', + 'segment_count' => null, + 'direction' => null, + 'to' => null, + 'from' => null, + 'media' => null, + 'text' => null, + 'tag' => null, + 'priority' => null, + 'expiration' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'owner' => false, + 'application_id' => false, + 'time' => false, + 'segment_count' => false, + 'direction' => false, + 'to' => false, + 'from' => false, + 'media' => false, + 'text' => false, + 'tag' => false, + 'priority' => false, + 'expiration' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'owner' => 'owner', + 'application_id' => 'applicationId', + 'time' => 'time', + 'segment_count' => 'segmentCount', + 'direction' => 'direction', + 'to' => 'to', + 'from' => 'from', + 'media' => 'media', + 'text' => 'text', + 'tag' => 'tag', + 'priority' => 'priority', + 'expiration' => 'expiration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'owner' => 'setOwner', + 'application_id' => 'setApplicationId', + 'time' => 'setTime', + 'segment_count' => 'setSegmentCount', + 'direction' => 'setDirection', + 'to' => 'setTo', + 'from' => 'setFrom', + 'media' => 'setMedia', + 'text' => 'setText', + 'tag' => 'setTag', + 'priority' => 'setPriority', + 'expiration' => 'setExpiration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'owner' => 'getOwner', + 'application_id' => 'getApplicationId', + 'time' => 'getTime', + 'segment_count' => 'getSegmentCount', + 'direction' => 'getDirection', + 'to' => 'getTo', + 'from' => 'getFrom', + 'media' => 'getMedia', + 'text' => 'getText', + 'tag' => 'getTag', + 'priority' => 'getPriority', + 'expiration' => 'getExpiration' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('owner', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('time', $data ?? [], null); + $this->setIfExists('segment_count', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('media', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + $this->setIfExists('expiration', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The id of the message. + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets owner + * + * @return string|null + */ + public function getOwner(): ?string + { + return $this->container['owner']; + } + + /** + * Sets owner + * + * @param string|null $owner The Bandwidth phone number associated with the message. + * + * @return $this + */ + public function setOwner(?string $owner): static + { + if (is_null($owner)) { + throw new InvalidArgumentException('non-nullable owner cannot be null'); + } + $this->container['owner'] = $owner; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The ID of the Application your from number or senderId is associated with in the Bandwidth App. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets time + * + * @return \DateTime|null + */ + public function getTime(): ?\DateTime + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param \DateTime|null $time The datetime stamp of the message in ISO 8601 + * + * @return $this + */ + public function setTime(?\DateTime $time): static + { + if (is_null($time)) { + throw new InvalidArgumentException('non-nullable time cannot be null'); + } + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets segment_count + * + * @return int|null + */ + public function getSegmentCount(): ?int + { + return $this->container['segment_count']; + } + + /** + * Sets segment_count + * + * @param int|null $segment_count The number of segments the user's message is broken into before sending over carrier networks. + * + * @return $this + */ + public function setSegmentCount(?int $segment_count): static + { + if (is_null($segment_count)) { + throw new InvalidArgumentException('non-nullable segment_count cannot be null'); + } + $this->container['segment_count'] = $segment_count; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\MessageDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\MessageDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\MessageDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\MessageDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets to + * + * @return string[]|null + */ + public function getTo(): ?array + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[]|null $to The phone number recipients of the message. + * + * @return $this + */ + public function setTo(?array $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The phone number the message was sent from. + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets media + * + * @return string[]|null + */ + public function getMedia(): ?array + { + return $this->container['media']; + } + + /** + * Sets media + * + * @param string[]|null $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 $this + */ + public function setMedia(?array $media): static + { + if (is_null($media)) { + throw new InvalidArgumentException('non-nullable media cannot be null'); + } + + $this->container['media'] = $media; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText(): ?string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text The contents of the message. + * + * @return $this + */ + public function setText(?string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A custom string that will be included in callback events of the message. Max 1024 characters. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets priority + * + * @return \Bandwidth\Model\PriorityEnum|null + */ + public function getPriority(): ?\Bandwidth\Model\PriorityEnum + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param \Bandwidth\Model\PriorityEnum|null $priority priority + * + * @return $this + */ + public function setPriority(?\Bandwidth\Model\PriorityEnum $priority): static + { + if (is_null($priority)) { + throw new InvalidArgumentException('non-nullable priority cannot be null'); + } + $this->container['priority'] = $priority; + + return $this; + } + + /** + * Gets expiration + * + * @return \DateTime|null + */ + public function getExpiration(): ?\DateTime + { + return $this->container['expiration']; + } + + /** + * Sets expiration + * + * @param \DateTime|null $expiration 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. + * + * @return $this + */ + public function setExpiration(?\DateTime $expiration): static + { + if (is_null($expiration)) { + throw new InvalidArgumentException('non-nullable expiration cannot be null'); + } + $this->container['expiration'] = $expiration; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MessageDirectionEnum.php b/src/Model/MessageDirectionEnum.php new file mode 100644 index 0000000..d94ab97 --- /dev/null +++ b/src/Model/MessageDirectionEnum.php @@ -0,0 +1,46 @@ + + */ +class MessageRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'messageRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'application_id' => 'string', + 'to' => 'string[]', + 'from' => 'string', + 'text' => 'string', + 'media' => 'string[]', + 'tag' => 'string', + 'priority' => '\Bandwidth\Model\PriorityEnum', + 'expiration' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'application_id' => null, + 'to' => null, + 'from' => null, + 'text' => null, + 'media' => 'uri', + 'tag' => null, + 'priority' => null, + 'expiration' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'application_id' => false, + 'to' => false, + 'from' => false, + 'text' => false, + 'media' => false, + 'tag' => false, + 'priority' => false, + 'expiration' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'application_id' => 'applicationId', + 'to' => 'to', + 'from' => 'from', + 'text' => 'text', + 'media' => 'media', + 'tag' => 'tag', + 'priority' => 'priority', + 'expiration' => 'expiration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'application_id' => 'setApplicationId', + 'to' => 'setTo', + 'from' => 'setFrom', + 'text' => 'setText', + 'media' => 'setMedia', + 'tag' => 'setTag', + 'priority' => 'setPriority', + 'expiration' => 'setExpiration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'application_id' => 'getApplicationId', + 'to' => 'getTo', + 'from' => 'getFrom', + 'text' => 'getText', + 'media' => 'getMedia', + 'tag' => 'getTag', + 'priority' => 'getPriority', + 'expiration' => 'getExpiration' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('media', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + $this->setIfExists('expiration', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if (!is_null($this->container['text']) && (mb_strlen($this->container['text']) > 2048)) { + $invalidProperties[] = "invalid value for 'text', the character length must be smaller than or equal to 2048."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The ID of the Application your from number or senderId is associated with in the Bandwidth App. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets to + * + * @return string[] + */ + public function getTo(): array + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to The phone number(s) the message should be sent to in E164 format. + * + * @return $this + */ + public function setTo(array $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText(): ?string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text The contents of the text message. Must be 2048 characters or less. + * + * @return $this + */ + public function setText(?string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + if ((mb_strlen($text) > 2048)) { + throw new InvalidArgumentException('invalid length for $text when calling MessageRequest., must be smaller than or equal to 2048.'); + } + + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets media + * + * @return string[]|null + */ + public function getMedia(): ?array + { + return $this->container['media']; + } + + /** + * Sets media + * + * @param string[]|null $media A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. + * + * @return $this + */ + public function setMedia(?array $media): static + { + if (is_null($media)) { + throw new InvalidArgumentException('non-nullable media cannot be null'); + } + $this->container['media'] = $media; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A custom string that will be included in callback events of the message. Max 1024 characters. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets priority + * + * @return \Bandwidth\Model\PriorityEnum|null + */ + public function getPriority(): ?\Bandwidth\Model\PriorityEnum + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param \Bandwidth\Model\PriorityEnum|null $priority priority + * + * @return $this + */ + public function setPriority(?\Bandwidth\Model\PriorityEnum $priority): static + { + if (is_null($priority)) { + throw new InvalidArgumentException('non-nullable priority cannot be null'); + } + $this->container['priority'] = $priority; + + return $this; + } + + /** + * Gets expiration + * + * @return \DateTime|null + */ + public function getExpiration(): ?\DateTime + { + return $this->container['expiration']; + } + + /** + * Sets expiration + * + * @param \DateTime|null $expiration 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. + * + * @return $this + */ + public function setExpiration(?\DateTime $expiration): static + { + if (is_null($expiration)) { + throw new InvalidArgumentException('non-nullable expiration cannot be null'); + } + $this->container['expiration'] = $expiration; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MessageStatusEnum.php b/src/Model/MessageStatusEnum.php new file mode 100644 index 0000000..127429b --- /dev/null +++ b/src/Model/MessageStatusEnum.php @@ -0,0 +1,58 @@ + + */ +class MessagesList implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'messagesList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'total_count' => 'int', + 'page_info' => '\Bandwidth\Model\PageInfo', + 'messages' => '\Bandwidth\Model\ListMessageItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'total_count' => null, + 'page_info' => null, + 'messages' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'total_count' => false, + 'page_info' => false, + 'messages' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'total_count' => 'totalCount', + 'page_info' => 'pageInfo', + 'messages' => 'messages' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'total_count' => 'setTotalCount', + 'page_info' => 'setPageInfo', + 'messages' => 'setMessages' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'total_count' => 'getTotalCount', + 'page_info' => 'getPageInfo', + 'messages' => 'getMessages' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('total_count', $data ?? [], null); + $this->setIfExists('page_info', $data ?? [], null); + $this->setIfExists('messages', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets total_count + * + * @return int|null + */ + public function getTotalCount(): ?int + { + return $this->container['total_count']; + } + + /** + * Sets total_count + * + * @param int|null $total_count 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 $this + */ + public function setTotalCount(?int $total_count): static + { + if (is_null($total_count)) { + throw new InvalidArgumentException('non-nullable total_count cannot be null'); + } + $this->container['total_count'] = $total_count; + + return $this; + } + + /** + * Gets page_info + * + * @return \Bandwidth\Model\PageInfo|null + */ + public function getPageInfo(): ?\Bandwidth\Model\PageInfo + { + return $this->container['page_info']; + } + + /** + * Sets page_info + * + * @param \Bandwidth\Model\PageInfo|null $page_info page_info + * + * @return $this + */ + public function setPageInfo(?\Bandwidth\Model\PageInfo $page_info): static + { + if (is_null($page_info)) { + throw new InvalidArgumentException('non-nullable page_info cannot be null'); + } + $this->container['page_info'] = $page_info; + + return $this; + } + + /** + * Gets messages + * + * @return \Bandwidth\Model\ListMessageItem[]|null + */ + public function getMessages(): ?array + { + return $this->container['messages']; + } + + /** + * Sets messages + * + * @param \Bandwidth\Model\ListMessageItem[]|null $messages messages + * + * @return $this + */ + public function setMessages(?array $messages): static + { + if (is_null($messages)) { + throw new InvalidArgumentException('non-nullable messages cannot be null'); + } + $this->container['messages'] = $messages; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MessagingCodeResponse.php b/src/Model/MessagingCodeResponse.php new file mode 100644 index 0000000..c13a209 --- /dev/null +++ b/src/Model/MessagingCodeResponse.php @@ -0,0 +1,384 @@ + + */ +class MessagingCodeResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'messagingCodeResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'message_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'message_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'message_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'message_id' => 'messageId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'message_id' => 'setMessageId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'message_id' => 'getMessageId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message_id + * + * @return string|null + */ + public function getMessageId(): ?string + { + return $this->container['message_id']; + } + + /** + * Sets message_id + * + * @param string|null $message_id Messaging API Message ID. + * + * @return $this + */ + public function setMessageId(?string $message_id): static + { + if (is_null($message_id)) { + throw new InvalidArgumentException('non-nullable message_id cannot be null'); + } + $this->container['message_id'] = $message_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MessagingRequestError.php b/src/Model/MessagingRequestError.php new file mode 100644 index 0000000..604027f --- /dev/null +++ b/src/Model/MessagingRequestError.php @@ -0,0 +1,424 @@ + + */ +class MessagingRequestError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'messagingRequestError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'description' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'description' => 'getDescription' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['description'] === null) { + $invalidProperties[] = "'description' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType(): string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type type + * + * @return $this + */ + public function setType(string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets description + * + * @return string + */ + public function getDescription(): string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description description + * + * @return $this + */ + public function setDescription(string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MfaForbiddenRequestError.php b/src/Model/MfaForbiddenRequestError.php new file mode 100644 index 0000000..464e0a8 --- /dev/null +++ b/src/Model/MfaForbiddenRequestError.php @@ -0,0 +1,384 @@ + + */ +class MfaForbiddenRequestError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'mfaForbiddenRequestError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'message' => 'getMessage' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage(): ?string + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message The message containing the reason behind the request being forbidden. + * + * @return $this + */ + public function setMessage(?string $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MfaRequestError.php b/src/Model/MfaRequestError.php new file mode 100644 index 0000000..df92c8e --- /dev/null +++ b/src/Model/MfaRequestError.php @@ -0,0 +1,418 @@ + + */ +class MfaRequestError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'mfaRequestError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'error' => 'string', + 'request_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'error' => null, + 'request_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'error' => false, + 'request_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'error' => 'error', + 'request_id' => 'requestId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'error' => 'setError', + 'request_id' => 'setRequestId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'error' => 'getError', + 'request_id' => 'getRequestId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('request_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error + * + * @return string|null + */ + public function getError(): ?string + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error A message describing the error with your request. + * + * @return $this + */ + public function setError(?string $error): static + { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets request_id + * + * @return string|null + */ + public function getRequestId(): ?string + { + return $this->container['request_id']; + } + + /** + * Sets request_id + * + * @param string|null $request_id The associated requestId from AWS. + * + * @return $this + */ + public function setRequestId(?string $request_id): static + { + if (is_null($request_id)) { + throw new InvalidArgumentException('non-nullable request_id cannot be null'); + } + $this->container['request_id'] = $request_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MfaUnauthorizedRequestError.php b/src/Model/MfaUnauthorizedRequestError.php new file mode 100644 index 0000000..efff3de --- /dev/null +++ b/src/Model/MfaUnauthorizedRequestError.php @@ -0,0 +1,384 @@ + + */ +class MfaUnauthorizedRequestError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'mfaUnauthorizedRequestError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'message' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'message' => 'getMessage' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets message + * + * @return string|null + */ + public function getMessage(): ?string + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message Unauthorized + * + * @return $this + */ + public function setMessage(?string $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MmsMessageContent.php b/src/Model/MmsMessageContent.php new file mode 100644 index 0000000..52be96e --- /dev/null +++ b/src/Model/MmsMessageContent.php @@ -0,0 +1,426 @@ + + */ +class MmsMessageContent implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'mmsMessageContent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'text' => 'string', + 'media' => '\Bandwidth\Model\MmsMessageContentFile[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'text' => null, + 'media' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'text' => false, + 'media' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'text' => 'text', + 'media' => 'media' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'text' => 'setText', + 'media' => 'setMedia' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'text' => 'getText', + 'media' => 'getMedia' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('media', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['text']) && (mb_strlen($this->container['text']) > 2048)) { + $invalidProperties[] = "invalid value for 'text', the character length must be smaller than or equal to 2048."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets text + * + * @return string|null + */ + public function getText(): ?string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text The contents of the text message. Must be 2048 characters or less. + * + * @return $this + */ + public function setText(?string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + if ((mb_strlen($text) > 2048)) { + throw new InvalidArgumentException('invalid length for $text when calling MmsMessageContent., must be smaller than or equal to 2048.'); + } + + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets media + * + * @return \Bandwidth\Model\MmsMessageContentFile[]|null + */ + public function getMedia(): ?array + { + return $this->container['media']; + } + + /** + * Sets media + * + * @param \Bandwidth\Model\MmsMessageContentFile[]|null $media media + * + * @return $this + */ + public function setMedia(?array $media): static + { + if (is_null($media)) { + throw new InvalidArgumentException('non-nullable media cannot be null'); + } + $this->container['media'] = $media; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MmsMessageContentFile.php b/src/Model/MmsMessageContentFile.php new file mode 100644 index 0000000..d8fbec0 --- /dev/null +++ b/src/Model/MmsMessageContentFile.php @@ -0,0 +1,395 @@ + + */ +class MmsMessageContentFile implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'mmsMessageContentFile'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'file_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'file_url' => 'uri' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'file_url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'file_url' => 'fileUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'file_url' => 'setFileUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'file_url' => 'getFileUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('file_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['file_url'] === null) { + $invalidProperties[] = "'file_url' can't be null"; + } + if ((mb_strlen($this->container['file_url']) > 1000)) { + $invalidProperties[] = "invalid value for 'file_url', the character length must be smaller than or equal to 1000."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets file_url + * + * @return string + */ + public function getFileUrl(): string + { + return $this->container['file_url']; + } + + /** + * Sets file_url + * + * @param string $file_url The URL of a media attachment. For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see more at [Bandwidth Support](https://www.bandwidth.com/support/en/articles/12823216-what-are-the-mms-file-size-limits) for more details. + * + * @return $this + */ + public function setFileUrl(string $file_url): static + { + if (is_null($file_url)) { + throw new InvalidArgumentException('non-nullable file_url cannot be null'); + } + if ((mb_strlen($file_url) > 1000)) { + throw new InvalidArgumentException('invalid length for $file_url when calling MmsMessageContentFile., must be smaller than or equal to 1000.'); + } + + $this->container['file_url'] = $file_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ModelInterface.php b/src/Model/ModelInterface.php new file mode 100644 index 0000000..7e84d05 --- /dev/null +++ b/src/Model/ModelInterface.php @@ -0,0 +1,112 @@ + + */ + public static function openAPITypes(): array; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats(): array; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap(): array; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters(): array; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters(): array; + + /** + * Show all the invalid properties with reasons. + * + * @return string[] invalid properties with reasons + */ + public function listInvalidProperties(): array; + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid(): bool; + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; +} diff --git a/src/Model/MultiChannelAction.php b/src/Model/MultiChannelAction.php new file mode 100644 index 0000000..13fe978 --- /dev/null +++ b/src/Model/MultiChannelAction.php @@ -0,0 +1,92 @@ + '\Bandwidth\Model\MultiChannelActionCalendarEvent', + 'DIAL_PHONE' => '\Bandwidth\Model\RbmActionDial', + 'OPEN_URL' => '\Bandwidth\Model\RbmActionOpenUrl', + 'REPLY' => '\Bandwidth\Model\RbmActionBase', + 'REQUEST_LOCATION' => '\Bandwidth\Model\RbmActionBase', + 'SHOW_LOCATION' => '\Bandwidth\Model\RbmActionViewLocation' + ]; + } +} + + diff --git a/src/Model/MultiChannelActionCalendarEvent.php b/src/Model/MultiChannelActionCalendarEvent.php new file mode 100644 index 0000000..f549ea1 --- /dev/null +++ b/src/Model/MultiChannelActionCalendarEvent.php @@ -0,0 +1,631 @@ + + */ +class MultiChannelActionCalendarEvent implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelActionCalendarEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => '\Bandwidth\Model\RbmActionTypeEnum', + 'text' => 'string', + 'postback_data' => 'string', + 'title' => 'string', + 'start_time' => '\DateTime', + 'end_time' => '\DateTime', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'text' => null, + 'postback_data' => 'byte', + 'title' => null, + 'start_time' => 'date-time', + 'end_time' => 'date-time', + 'description' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'text' => false, + 'postback_data' => false, + 'title' => false, + 'start_time' => false, + 'end_time' => false, + 'description' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'text' => 'text', + 'postback_data' => 'postbackData', + 'title' => 'title', + 'start_time' => 'startTime', + 'end_time' => 'endTime', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'text' => 'setText', + 'postback_data' => 'setPostbackData', + 'title' => 'setTitle', + 'start_time' => 'setStartTime', + 'end_time' => 'setEndTime', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'text' => 'getText', + 'postback_data' => 'getPostbackData', + 'title' => 'getTitle', + 'start_time' => 'getStartTime', + 'end_time' => 'getEndTime', + 'description' => 'getDescription' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('postback_data', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + if ((mb_strlen($this->container['text']) > 25)) { + $invalidProperties[] = "invalid value for 'text', the character length must be smaller than or equal to 25."; + } + + if ($this->container['postback_data'] === null) { + $invalidProperties[] = "'postback_data' can't be null"; + } + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ((mb_strlen($this->container['title']) > 100)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 100."; + } + + if ($this->container['start_time'] === null) { + $invalidProperties[] = "'start_time' can't be null"; + } + if ($this->container['end_time'] === null) { + $invalidProperties[] = "'end_time' can't be null"; + } + if (!is_null($this->container['description']) && (mb_strlen($this->container['description']) > 500)) { + $invalidProperties[] = "invalid value for 'description', the character length must be smaller than or equal to 500."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \Bandwidth\Model\RbmActionTypeEnum + */ + public function getType(): \Bandwidth\Model\RbmActionTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\RbmActionTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\RbmActionTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets text + * + * @return string + */ + public function getText(): string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Displayed text for user to click + * + * @return $this + */ + public function setText(string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + if ((mb_strlen($text) > 25)) { + throw new InvalidArgumentException('invalid length for $text when calling MultiChannelActionCalendarEvent., must be smaller than or equal to 25.'); + } + + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets postback_data + * + * @return string + */ + public function getPostbackData(): string + { + return $this->container['postback_data']; + } + + /** + * Sets postback_data + * + * @param string $postback_data Base64 payload the customer receives when the reply is clicked. + * + * @return $this + */ + public function setPostbackData(string $postback_data): static + { + if (is_null($postback_data)) { + throw new InvalidArgumentException('non-nullable postback_data cannot be null'); + } + + $this->container['postback_data'] = $postback_data; + + return $this; + } + + /** + * Gets title + * + * @return string + */ + public function getTitle(): string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title The title of the event. + * + * @return $this + */ + public function setTitle(string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if ((mb_strlen($title) > 100)) { + throw new InvalidArgumentException('invalid length for $title when calling MultiChannelActionCalendarEvent., must be smaller than or equal to 100.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime + */ + public function getStartTime(): \DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime $start_time The start time of the event. Must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. + * + * @return $this + */ + public function setStartTime(\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets end_time + * + * @return \DateTime + */ + public function getEndTime(): \DateTime + { + return $this->container['end_time']; + } + + /** + * Sets end_time + * + * @param \DateTime $end_time The end time of the event. Must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. + * + * @return $this + */ + public function setEndTime(\DateTime $end_time): static + { + if (is_null($end_time)) { + throw new InvalidArgumentException('non-nullable end_time cannot be null'); + } + $this->container['end_time'] = $end_time; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The description of the event. + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + if ((mb_strlen($description) > 500)) { + throw new InvalidArgumentException('invalid length for $description when calling MultiChannelActionCalendarEvent., must be smaller than or equal to 500.'); + } + + $this->container['description'] = $description; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelChannelListMMSObject.php b/src/Model/MultiChannelChannelListMMSObject.php new file mode 100644 index 0000000..9029f7c --- /dev/null +++ b/src/Model/MultiChannelChannelListMMSObject.php @@ -0,0 +1,498 @@ + + */ +class MultiChannelChannelListMMSObject implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelChannelListMMSObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'from' => 'string', + 'application_id' => 'string', + 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum', + 'content' => '\Bandwidth\Model\MmsMessageContent' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'from' => null, + 'application_id' => null, + 'channel' => null, + 'content' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'from' => false, + 'application_id' => false, + 'channel' => false, + 'content' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'from' => 'from', + 'application_id' => 'applicationId', + 'channel' => 'channel', + 'content' => 'content' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'from' => 'setFrom', + 'application_id' => 'setApplicationId', + 'channel' => 'setChannel', + 'content' => 'setContent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'from' => 'getFrom', + 'application_id' => 'getApplicationId', + 'channel' => 'getChannel', + 'content' => 'getContent' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['channel'] === null) { + $invalidProperties[] = "'channel' can't be null"; + } + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from The sender ID of the message. This could be an alphanumeric sender ID. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The ID of the Application your from number or senderId is associated with in the Bandwidth App. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets channel + * + * @return \Bandwidth\Model\MultiChannelMessageChannelEnum + */ + public function getChannel(): \Bandwidth\Model\MultiChannelMessageChannelEnum + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Bandwidth\Model\MultiChannelMessageChannelEnum $channel channel + * + * @return $this + */ + public function setChannel(\Bandwidth\Model\MultiChannelMessageChannelEnum $channel): static + { + if (is_null($channel)) { + throw new InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets content + * + * @return \Bandwidth\Model\MmsMessageContent + */ + public function getContent(): \Bandwidth\Model\MmsMessageContent + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Bandwidth\Model\MmsMessageContent $content content + * + * @return $this + */ + public function setContent(\Bandwidth\Model\MmsMessageContent $content): static + { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelChannelListMMSResponseObject.php b/src/Model/MultiChannelChannelListMMSResponseObject.php new file mode 100644 index 0000000..5ee73f5 --- /dev/null +++ b/src/Model/MultiChannelChannelListMMSResponseObject.php @@ -0,0 +1,535 @@ + + */ +class MultiChannelChannelListMMSResponseObject implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelChannelListMMSResponseObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'from' => 'string', + 'application_id' => 'string', + 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum', + 'content' => '\Bandwidth\Model\MmsMessageContent', + 'owner' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'from' => null, + 'application_id' => null, + 'channel' => null, + 'content' => null, + 'owner' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'from' => false, + 'application_id' => false, + 'channel' => false, + 'content' => false, + 'owner' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'from' => 'from', + 'application_id' => 'applicationId', + 'channel' => 'channel', + 'content' => 'content', + 'owner' => 'owner' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'from' => 'setFrom', + 'application_id' => 'setApplicationId', + 'channel' => 'setChannel', + 'content' => 'setContent', + 'owner' => 'setOwner' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'from' => 'getFrom', + 'application_id' => 'getApplicationId', + 'channel' => 'getChannel', + 'content' => 'getContent', + 'owner' => 'getOwner' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('owner', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['channel'] === null) { + $invalidProperties[] = "'channel' can't be null"; + } + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + if ($this->container['owner'] === null) { + $invalidProperties[] = "'owner' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from The sender ID of the message. This could be an alphanumeric sender ID. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The ID of the Application your from number or senderId is associated with in the Bandwidth App. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets channel + * + * @return \Bandwidth\Model\MultiChannelMessageChannelEnum + */ + public function getChannel(): \Bandwidth\Model\MultiChannelMessageChannelEnum + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Bandwidth\Model\MultiChannelMessageChannelEnum $channel channel + * + * @return $this + */ + public function setChannel(\Bandwidth\Model\MultiChannelMessageChannelEnum $channel): static + { + if (is_null($channel)) { + throw new InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets content + * + * @return \Bandwidth\Model\MmsMessageContent + */ + public function getContent(): \Bandwidth\Model\MmsMessageContent + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Bandwidth\Model\MmsMessageContent $content content + * + * @return $this + */ + public function setContent(\Bandwidth\Model\MmsMessageContent $content): static + { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets owner + * + * @return string + */ + public function getOwner(): string + { + return $this->container['owner']; + } + + /** + * Sets owner + * + * @param string $owner The Bandwidth senderId associated with the message. Identical to 'from'. + * + * @return $this + */ + public function setOwner(string $owner): static + { + if (is_null($owner)) { + throw new InvalidArgumentException('non-nullable owner cannot be null'); + } + $this->container['owner'] = $owner; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelChannelListObjectBase.php b/src/Model/MultiChannelChannelListObjectBase.php new file mode 100644 index 0000000..7b8f574 --- /dev/null +++ b/src/Model/MultiChannelChannelListObjectBase.php @@ -0,0 +1,461 @@ + + */ +class MultiChannelChannelListObjectBase implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelChannelListObjectBase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'from' => 'string', + 'application_id' => 'string', + 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'from' => null, + 'application_id' => null, + 'channel' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'from' => false, + 'application_id' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'from' => 'from', + 'application_id' => 'applicationId', + 'channel' => 'channel' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'from' => 'setFrom', + 'application_id' => 'setApplicationId', + 'channel' => 'setChannel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'from' => 'getFrom', + 'application_id' => 'getApplicationId', + 'channel' => 'getChannel' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['channel'] === null) { + $invalidProperties[] = "'channel' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from The sender ID of the message. This could be an alphanumeric sender ID. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The ID of the Application your from number or senderId is associated with in the Bandwidth App. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets channel + * + * @return \Bandwidth\Model\MultiChannelMessageChannelEnum + */ + public function getChannel(): \Bandwidth\Model\MultiChannelMessageChannelEnum + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Bandwidth\Model\MultiChannelMessageChannelEnum $channel channel + * + * @return $this + */ + public function setChannel(\Bandwidth\Model\MultiChannelMessageChannelEnum $channel): static + { + if (is_null($channel)) { + throw new InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelChannelListOwnerObject.php b/src/Model/MultiChannelChannelListOwnerObject.php new file mode 100644 index 0000000..40f6d0a --- /dev/null +++ b/src/Model/MultiChannelChannelListOwnerObject.php @@ -0,0 +1,387 @@ + + */ +class MultiChannelChannelListOwnerObject implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelChannelListOwnerObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'owner' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'owner' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'owner' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'owner' => 'owner' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'owner' => 'setOwner' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'owner' => 'getOwner' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('owner', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['owner'] === null) { + $invalidProperties[] = "'owner' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets owner + * + * @return string + */ + public function getOwner(): string + { + return $this->container['owner']; + } + + /** + * Sets owner + * + * @param string $owner The Bandwidth senderId associated with the message. Identical to 'from'. + * + * @return $this + */ + public function setOwner(string $owner): static + { + if (is_null($owner)) { + throw new InvalidArgumentException('non-nullable owner cannot be null'); + } + $this->container['owner'] = $owner; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelChannelListRBMObject.php b/src/Model/MultiChannelChannelListRBMObject.php new file mode 100644 index 0000000..98b31be --- /dev/null +++ b/src/Model/MultiChannelChannelListRBMObject.php @@ -0,0 +1,498 @@ + + */ +class MultiChannelChannelListRBMObject implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelChannelListRBMObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'from' => 'string', + 'application_id' => 'string', + 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum', + 'content' => '\Bandwidth\Model\MultiChannelChannelListRBMObjectAllOfContent' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'from' => null, + 'application_id' => null, + 'channel' => null, + 'content' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'from' => false, + 'application_id' => false, + 'channel' => false, + 'content' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'from' => 'from', + 'application_id' => 'applicationId', + 'channel' => 'channel', + 'content' => 'content' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'from' => 'setFrom', + 'application_id' => 'setApplicationId', + 'channel' => 'setChannel', + 'content' => 'setContent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'from' => 'getFrom', + 'application_id' => 'getApplicationId', + 'channel' => 'getChannel', + 'content' => 'getContent' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['channel'] === null) { + $invalidProperties[] = "'channel' can't be null"; + } + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from The sender ID of the message. This could be an alphanumeric sender ID. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The ID of the Application your from number or senderId is associated with in the Bandwidth App. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets channel + * + * @return \Bandwidth\Model\MultiChannelMessageChannelEnum + */ + public function getChannel(): \Bandwidth\Model\MultiChannelMessageChannelEnum + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Bandwidth\Model\MultiChannelMessageChannelEnum $channel channel + * + * @return $this + */ + public function setChannel(\Bandwidth\Model\MultiChannelMessageChannelEnum $channel): static + { + if (is_null($channel)) { + throw new InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets content + * + * @return \Bandwidth\Model\RbmMessageContentText|\Bandwidth\Model\RbmMessageMedia|\Bandwidth\Model\RbmStandaloneCard|\Bandwidth\Model\RbmMessageCarouselCard + */ + public function getContent(): \Bandwidth\Model\RbmMessageContentText|\Bandwidth\Model\RbmMessageMedia|\Bandwidth\Model\RbmStandaloneCard|\Bandwidth\Model\RbmMessageCarouselCard + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Bandwidth\Model\RbmMessageContentText|\Bandwidth\Model\RbmMessageMedia|\Bandwidth\Model\RbmStandaloneCard|\Bandwidth\Model\RbmMessageCarouselCard $content content + * + * @return $this + */ + public function setContent(\Bandwidth\Model\RbmMessageContentText|\Bandwidth\Model\RbmMessageMedia|\Bandwidth\Model\RbmStandaloneCard|\Bandwidth\Model\RbmMessageCarouselCard $content): static + { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelChannelListRBMObjectAllOfContent.php b/src/Model/MultiChannelChannelListRBMObjectAllOfContent.php new file mode 100644 index 0000000..130515a --- /dev/null +++ b/src/Model/MultiChannelChannelListRBMObjectAllOfContent.php @@ -0,0 +1,86 @@ + + */ +class MultiChannelChannelListRBMResponseObject implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelChannelListRBMResponseObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'from' => 'string', + 'application_id' => 'string', + 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum', + 'content' => '\Bandwidth\Model\MultiChannelChannelListRBMObjectAllOfContent', + 'owner' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'from' => null, + 'application_id' => null, + 'channel' => null, + 'content' => null, + 'owner' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'from' => false, + 'application_id' => false, + 'channel' => false, + 'content' => false, + 'owner' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'from' => 'from', + 'application_id' => 'applicationId', + 'channel' => 'channel', + 'content' => 'content', + 'owner' => 'owner' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'from' => 'setFrom', + 'application_id' => 'setApplicationId', + 'channel' => 'setChannel', + 'content' => 'setContent', + 'owner' => 'setOwner' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'from' => 'getFrom', + 'application_id' => 'getApplicationId', + 'channel' => 'getChannel', + 'content' => 'getContent', + 'owner' => 'getOwner' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('owner', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['channel'] === null) { + $invalidProperties[] = "'channel' can't be null"; + } + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + if ($this->container['owner'] === null) { + $invalidProperties[] = "'owner' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from The sender ID of the message. This could be an alphanumeric sender ID. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The ID of the Application your from number or senderId is associated with in the Bandwidth App. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets channel + * + * @return \Bandwidth\Model\MultiChannelMessageChannelEnum + */ + public function getChannel(): \Bandwidth\Model\MultiChannelMessageChannelEnum + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Bandwidth\Model\MultiChannelMessageChannelEnum $channel channel + * + * @return $this + */ + public function setChannel(\Bandwidth\Model\MultiChannelMessageChannelEnum $channel): static + { + if (is_null($channel)) { + throw new InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets content + * + * @return \Bandwidth\Model\RbmMessageContentText|\Bandwidth\Model\RbmMessageMedia|\Bandwidth\Model\RbmStandaloneCard|\Bandwidth\Model\RbmMessageCarouselCard + */ + public function getContent(): \Bandwidth\Model\RbmMessageContentText|\Bandwidth\Model\RbmMessageMedia|\Bandwidth\Model\RbmStandaloneCard|\Bandwidth\Model\RbmMessageCarouselCard + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Bandwidth\Model\RbmMessageContentText|\Bandwidth\Model\RbmMessageMedia|\Bandwidth\Model\RbmStandaloneCard|\Bandwidth\Model\RbmMessageCarouselCard $content content + * + * @return $this + */ + public function setContent(\Bandwidth\Model\RbmMessageContentText|\Bandwidth\Model\RbmMessageMedia|\Bandwidth\Model\RbmStandaloneCard|\Bandwidth\Model\RbmMessageCarouselCard $content): static + { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets owner + * + * @return string + */ + public function getOwner(): string + { + return $this->container['owner']; + } + + /** + * Sets owner + * + * @param string $owner The Bandwidth senderId associated with the message. Identical to 'from'. + * + * @return $this + */ + public function setOwner(string $owner): static + { + if (is_null($owner)) { + throw new InvalidArgumentException('non-nullable owner cannot be null'); + } + $this->container['owner'] = $owner; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelChannelListRequestObject.php b/src/Model/MultiChannelChannelListRequestObject.php new file mode 100644 index 0000000..3d4fe32 --- /dev/null +++ b/src/Model/MultiChannelChannelListRequestObject.php @@ -0,0 +1,87 @@ + '\Bandwidth\Model\MultiChannelChannelListMMSObject', + 'RBM' => '\Bandwidth\Model\MultiChannelChannelListRBMObject', + 'SMS' => '\Bandwidth\Model\MultiChannelChannelListSMSObject' + ]; + } +} + + diff --git a/src/Model/MultiChannelChannelListResponseObject.php b/src/Model/MultiChannelChannelListResponseObject.php new file mode 100644 index 0000000..64ef5a1 --- /dev/null +++ b/src/Model/MultiChannelChannelListResponseObject.php @@ -0,0 +1,87 @@ + '\Bandwidth\Model\MultiChannelChannelListMMSResponseObject', + 'RBM' => '\Bandwidth\Model\MultiChannelChannelListRBMResponseObject', + 'SMS' => '\Bandwidth\Model\MultiChannelChannelListSMSResponseObject' + ]; + } +} + + diff --git a/src/Model/MultiChannelChannelListSMSObject.php b/src/Model/MultiChannelChannelListSMSObject.php new file mode 100644 index 0000000..787223a --- /dev/null +++ b/src/Model/MultiChannelChannelListSMSObject.php @@ -0,0 +1,498 @@ + + */ +class MultiChannelChannelListSMSObject implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelChannelListSMSObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'from' => 'string', + 'application_id' => 'string', + 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum', + 'content' => '\Bandwidth\Model\SmsMessageContent' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'from' => null, + 'application_id' => null, + 'channel' => null, + 'content' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'from' => false, + 'application_id' => false, + 'channel' => false, + 'content' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'from' => 'from', + 'application_id' => 'applicationId', + 'channel' => 'channel', + 'content' => 'content' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'from' => 'setFrom', + 'application_id' => 'setApplicationId', + 'channel' => 'setChannel', + 'content' => 'setContent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'from' => 'getFrom', + 'application_id' => 'getApplicationId', + 'channel' => 'getChannel', + 'content' => 'getContent' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['channel'] === null) { + $invalidProperties[] = "'channel' can't be null"; + } + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from The sender ID of the message. This could be an alphanumeric sender ID. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The ID of the Application your from number or senderId is associated with in the Bandwidth App. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets channel + * + * @return \Bandwidth\Model\MultiChannelMessageChannelEnum + */ + public function getChannel(): \Bandwidth\Model\MultiChannelMessageChannelEnum + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Bandwidth\Model\MultiChannelMessageChannelEnum $channel channel + * + * @return $this + */ + public function setChannel(\Bandwidth\Model\MultiChannelMessageChannelEnum $channel): static + { + if (is_null($channel)) { + throw new InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets content + * + * @return \Bandwidth\Model\SmsMessageContent + */ + public function getContent(): \Bandwidth\Model\SmsMessageContent + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Bandwidth\Model\SmsMessageContent $content content + * + * @return $this + */ + public function setContent(\Bandwidth\Model\SmsMessageContent $content): static + { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelChannelListSMSResponseObject.php b/src/Model/MultiChannelChannelListSMSResponseObject.php new file mode 100644 index 0000000..8f76878 --- /dev/null +++ b/src/Model/MultiChannelChannelListSMSResponseObject.php @@ -0,0 +1,535 @@ + + */ +class MultiChannelChannelListSMSResponseObject implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelChannelListSMSResponseObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'from' => 'string', + 'application_id' => 'string', + 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum', + 'content' => '\Bandwidth\Model\SmsMessageContent', + 'owner' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'from' => null, + 'application_id' => null, + 'channel' => null, + 'content' => null, + 'owner' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'from' => false, + 'application_id' => false, + 'channel' => false, + 'content' => false, + 'owner' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'from' => 'from', + 'application_id' => 'applicationId', + 'channel' => 'channel', + 'content' => 'content', + 'owner' => 'owner' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'from' => 'setFrom', + 'application_id' => 'setApplicationId', + 'channel' => 'setChannel', + 'content' => 'setContent', + 'owner' => 'setOwner' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'from' => 'getFrom', + 'application_id' => 'getApplicationId', + 'channel' => 'getChannel', + 'content' => 'getContent', + 'owner' => 'getOwner' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('owner', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['channel'] === null) { + $invalidProperties[] = "'channel' can't be null"; + } + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; + } + if ($this->container['owner'] === null) { + $invalidProperties[] = "'owner' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from The sender ID of the message. This could be an alphanumeric sender ID. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The ID of the Application your from number or senderId is associated with in the Bandwidth App. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets channel + * + * @return \Bandwidth\Model\MultiChannelMessageChannelEnum + */ + public function getChannel(): \Bandwidth\Model\MultiChannelMessageChannelEnum + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Bandwidth\Model\MultiChannelMessageChannelEnum $channel channel + * + * @return $this + */ + public function setChannel(\Bandwidth\Model\MultiChannelMessageChannelEnum $channel): static + { + if (is_null($channel)) { + throw new InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets content + * + * @return \Bandwidth\Model\SmsMessageContent + */ + public function getContent(): \Bandwidth\Model\SmsMessageContent + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param \Bandwidth\Model\SmsMessageContent $content content + * + * @return $this + */ + public function setContent(\Bandwidth\Model\SmsMessageContent $content): static + { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } + $this->container['content'] = $content; + + return $this; + } + + /** + * Gets owner + * + * @return string + */ + public function getOwner(): string + { + return $this->container['owner']; + } + + /** + * Sets owner + * + * @param string $owner The Bandwidth senderId associated with the message. Identical to 'from'. + * + * @return $this + */ + public function setOwner(string $owner): static + { + if (is_null($owner)) { + throw new InvalidArgumentException('non-nullable owner cannot be null'); + } + $this->container['owner'] = $owner; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelError.php b/src/Model/MultiChannelError.php new file mode 100644 index 0000000..128e9a1 --- /dev/null +++ b/src/Model/MultiChannelError.php @@ -0,0 +1,459 @@ + + */ +class MultiChannelError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'links' => '\Bandwidth\Model\Link[]', + 'data' => 'object', + 'errors' => '\Bandwidth\Model\ErrorObject[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'links' => null, + 'data' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'links' => false, + 'data' => true, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'links' => 'links', + 'data' => 'data', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'links' => 'setLinks', + 'data' => 'setData', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'links' => 'getLinks', + 'data' => 'getData', + 'errors' => 'getErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return \Bandwidth\Model\Link[]|null + */ + public function getLinks(): ?array + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Bandwidth\Model\Link[]|null $links links + * + * @return $this + */ + public function setLinks(?array $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets data + * + * @return object|null + */ + public function getData(): ?object + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param object|null $data data + * + * @return $this + */ + public function setData(?object $data): static + { + if (is_null($data)) { + array_push($this->openAPINullablesSetToNull, 'data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('data', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets errors + * + * @return \Bandwidth\Model\ErrorObject[]|null + */ + public function getErrors(): ?array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Bandwidth\Model\ErrorObject[]|null $errors errors + * + * @return $this + */ + public function setErrors(?array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelMessageChannelEnum.php b/src/Model/MultiChannelMessageChannelEnum.php new file mode 100644 index 0000000..75b8865 --- /dev/null +++ b/src/Model/MultiChannelMessageChannelEnum.php @@ -0,0 +1,48 @@ + + */ +class MultiChannelMessageContent implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelMessageContent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'text' => 'string', + 'media' => '\Bandwidth\Model\RbmMessageContentFile' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'text' => null, + 'media' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'text' => false, + 'media' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'text' => 'text', + 'media' => 'media' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'text' => 'setText', + 'media' => 'setMedia' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'text' => 'getText', + 'media' => 'getMedia' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('media', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets text + * + * @return string|null + */ + public function getText(): ?string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text text + * + * @return $this + */ + public function setText(?string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets media + * + * @return \Bandwidth\Model\RbmMessageContentFile|null + */ + public function getMedia(): ?\Bandwidth\Model\RbmMessageContentFile + { + return $this->container['media']; + } + + /** + * Sets media + * + * @param \Bandwidth\Model\RbmMessageContentFile|null $media media + * + * @return $this + */ + public function setMedia(?\Bandwidth\Model\RbmMessageContentFile $media): static + { + if (is_null($media)) { + throw new InvalidArgumentException('non-nullable media cannot be null'); + } + $this->container['media'] = $media; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelMessageRequest.php b/src/Model/MultiChannelMessageRequest.php new file mode 100644 index 0000000..71d6624 --- /dev/null +++ b/src/Model/MultiChannelMessageRequest.php @@ -0,0 +1,534 @@ + + */ +class MultiChannelMessageRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelMessageRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'to' => 'string', + 'channel_list' => '\Bandwidth\Model\MultiChannelChannelListRequestObject[]', + 'tag' => 'string', + 'priority' => '\Bandwidth\Model\PriorityEnum', + 'expiration' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'to' => null, + 'channel_list' => null, + 'tag' => null, + 'priority' => null, + 'expiration' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'to' => false, + 'channel_list' => false, + 'tag' => false, + 'priority' => false, + 'expiration' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'to' => 'to', + 'channel_list' => 'channelList', + 'tag' => 'tag', + 'priority' => 'priority', + 'expiration' => 'expiration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'to' => 'setTo', + 'channel_list' => 'setChannelList', + 'tag' => 'setTag', + 'priority' => 'setPriority', + 'expiration' => 'setExpiration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'to' => 'getTo', + 'channel_list' => 'getChannelList', + 'tag' => 'getTag', + 'priority' => 'getPriority', + 'expiration' => 'getExpiration' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('channel_list', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + $this->setIfExists('expiration', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['channel_list'] === null) { + $invalidProperties[] = "'channel_list' can't be null"; + } + if ((count($this->container['channel_list']) > 4)) { + $invalidProperties[] = "invalid value for 'channel_list', number of items must be less than or equal to 4."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to + * + * @return string + */ + public function getTo(): string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to The phone number the message should be sent to in E164 format. + * + * @return $this + */ + public function setTo(string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets channel_list + * + * @return (\Bandwidth\Model\MultiChannelChannelListRBMObject|\Bandwidth\Model\MultiChannelChannelListSMSObject|\Bandwidth\Model\MultiChannelChannelListMMSObject)[] + */ + public function getChannelList(): array + { + return $this->container['channel_list']; + } + + /** + * Sets channel_list + * + * @param (\Bandwidth\Model\MultiChannelChannelListRBMObject|\Bandwidth\Model\MultiChannelChannelListSMSObject|\Bandwidth\Model\MultiChannelChannelListMMSObject)[] $channel_list A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored. + * + * @return $this + */ + public function setChannelList(array $channel_list): static + { + if (is_null($channel_list)) { + throw new InvalidArgumentException('non-nullable channel_list cannot be null'); + } + if ((count($channel_list) > 4)) { + throw new InvalidArgumentException('invalid value for $channel_list when calling MultiChannelMessageRequest., number of items must be less than or equal to 4.'); + } + $this->container['channel_list'] = $channel_list; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A custom string that will be included in callback events of the message. Max 1024 characters. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets priority + * + * @return \Bandwidth\Model\PriorityEnum|null + */ + public function getPriority(): ?\Bandwidth\Model\PriorityEnum + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param \Bandwidth\Model\PriorityEnum|null $priority priority + * + * @return $this + */ + public function setPriority(?\Bandwidth\Model\PriorityEnum $priority): static + { + if (is_null($priority)) { + throw new InvalidArgumentException('non-nullable priority cannot be null'); + } + $this->container['priority'] = $priority; + + return $this; + } + + /** + * Gets expiration + * + * @return \DateTime|null + */ + public function getExpiration(): ?\DateTime + { + return $this->container['expiration']; + } + + /** + * Sets expiration + * + * @param \DateTime|null $expiration 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. + * + * @return $this + */ + public function setExpiration(?\DateTime $expiration): static + { + if (is_null($expiration)) { + throw new InvalidArgumentException('non-nullable expiration cannot be null'); + } + $this->container['expiration'] = $expiration; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/MultiChannelMessageResponseData.php b/src/Model/MultiChannelMessageResponseData.php new file mode 100644 index 0000000..a2d8230 --- /dev/null +++ b/src/Model/MultiChannelMessageResponseData.php @@ -0,0 +1,646 @@ + + */ +class MultiChannelMessageResponseData implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'multiChannelMessageResponseData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'time' => '\DateTime', + 'direction' => '\Bandwidth\Model\MessageDirectionEnum', + 'to' => 'string[]', + 'channel_list' => '\Bandwidth\Model\MultiChannelChannelListResponseObject[]', + 'tag' => 'string', + 'priority' => '\Bandwidth\Model\PriorityEnum', + 'expiration' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'time' => 'date-time', + 'direction' => null, + 'to' => null, + 'channel_list' => null, + 'tag' => null, + 'priority' => null, + 'expiration' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'time' => false, + 'direction' => false, + 'to' => false, + 'channel_list' => false, + 'tag' => false, + 'priority' => false, + 'expiration' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'time' => 'time', + 'direction' => 'direction', + 'to' => 'to', + 'channel_list' => 'channelList', + 'tag' => 'tag', + 'priority' => 'priority', + 'expiration' => 'expiration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'time' => 'setTime', + 'direction' => 'setDirection', + 'to' => 'setTo', + 'channel_list' => 'setChannelList', + 'tag' => 'setTag', + 'priority' => 'setPriority', + 'expiration' => 'setExpiration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'time' => 'getTime', + 'direction' => 'getDirection', + 'to' => 'getTo', + 'channel_list' => 'getChannelList', + 'tag' => 'getTag', + 'priority' => 'getPriority', + 'expiration' => 'getExpiration' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('time', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('channel_list', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + $this->setIfExists('expiration', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['time'] === null) { + $invalidProperties[] = "'time' can't be null"; + } + if ($this->container['direction'] === null) { + $invalidProperties[] = "'direction' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['channel_list'] === null) { + $invalidProperties[] = "'channel_list' can't be null"; + } + if ((count($this->container['channel_list']) > 4)) { + $invalidProperties[] = "invalid value for 'channel_list', number of items must be less than or equal to 4."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The ID of the message. + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets time + * + * @return \DateTime + */ + public function getTime(): \DateTime + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param \DateTime $time The time the message was received by the Bandwidth API. + * + * @return $this + */ + public function setTime(\DateTime $time): static + { + if (is_null($time)) { + throw new InvalidArgumentException('non-nullable time cannot be null'); + } + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\MessageDirectionEnum + */ + public function getDirection(): \Bandwidth\Model\MessageDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\MessageDirectionEnum $direction direction + * + * @return $this + */ + public function setDirection(\Bandwidth\Model\MessageDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets to + * + * @return string[] + */ + public function getTo(): array + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to The destination phone number(s) of the message, in E164 format. + * + * @return $this + */ + public function setTo(array $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets channel_list + * + * @return (\Bandwidth\Model\MultiChannelChannelListRBMResponseObject|\Bandwidth\Model\MultiChannelChannelListSMSResponseObject|\Bandwidth\Model\MultiChannelChannelListMMSResponseObject)[] + */ + public function getChannelList(): array + { + return $this->container['channel_list']; + } + + /** + * Sets channel_list + * + * @param (\Bandwidth\Model\MultiChannelChannelListRBMResponseObject|\Bandwidth\Model\MultiChannelChannelListSMSResponseObject|\Bandwidth\Model\MultiChannelChannelListMMSResponseObject)[] $channel_list A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored. + * + * @return $this + */ + public function setChannelList(array $channel_list): static + { + if (is_null($channel_list)) { + throw new InvalidArgumentException('non-nullable channel_list cannot be null'); + } + if ((count($channel_list) > 4)) { + throw new InvalidArgumentException('invalid value for $channel_list when calling MultiChannelMessageResponseData., number of items must be less than or equal to 4.'); + } + $this->container['channel_list'] = $channel_list; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A custom string that will be included in callback events of the message. Max 1024 characters. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets priority + * + * @return \Bandwidth\Model\PriorityEnum|null + */ + public function getPriority(): ?\Bandwidth\Model\PriorityEnum + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param \Bandwidth\Model\PriorityEnum|null $priority priority + * + * @return $this + */ + public function setPriority(?\Bandwidth\Model\PriorityEnum $priority): static + { + if (is_null($priority)) { + throw new InvalidArgumentException('non-nullable priority cannot be null'); + } + $this->container['priority'] = $priority; + + return $this; + } + + /** + * Gets expiration + * + * @return \DateTime|null + */ + public function getExpiration(): ?\DateTime + { + return $this->container['expiration']; + } + + /** + * Sets expiration + * + * @param \DateTime|null $expiration 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. + * + * @return $this + */ + public function setExpiration(?\DateTime $expiration): static + { + if (is_null($expiration)) { + throw new InvalidArgumentException('non-nullable expiration cannot be null'); + } + $this->container['expiration'] = $expiration; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/OneOfInterface.php b/src/Model/OneOfInterface.php new file mode 100644 index 0000000..b01b20b --- /dev/null +++ b/src/Model/OneOfInterface.php @@ -0,0 +1,66 @@ + + */ + public static function getOneOfDiscriminatorMappings(): array; +} diff --git a/src/Model/OptInWorkflow.php b/src/Model/OptInWorkflow.php new file mode 100644 index 0000000..5576b03 --- /dev/null +++ b/src/Model/OptInWorkflow.php @@ -0,0 +1,495 @@ + + */ +class OptInWorkflow implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'optInWorkflow'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'description' => 'string', + 'image_urls' => 'string[]', + 'confirmation_response' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'description' => null, + 'image_urls' => null, + 'confirmation_response' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'description' => false, + 'image_urls' => false, + 'confirmation_response' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'description' => 'description', + 'image_urls' => 'imageUrls', + 'confirmation_response' => 'confirmationResponse' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'description' => 'setDescription', + 'image_urls' => 'setImageUrls', + 'confirmation_response' => 'setConfirmationResponse' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'description' => 'getDescription', + 'image_urls' => 'getImageUrls', + 'confirmation_response' => 'getConfirmationResponse' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('image_urls', $data ?? [], null); + $this->setIfExists('confirmation_response', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['description'] === null) { + $invalidProperties[] = "'description' can't be null"; + } + if ((mb_strlen($this->container['description']) > 500)) { + $invalidProperties[] = "invalid value for 'description', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['description']) < 1)) { + $invalidProperties[] = "invalid value for 'description', the character length must be bigger than or equal to 1."; + } + + if ($this->container['image_urls'] === null) { + $invalidProperties[] = "'image_urls' can't be null"; + } + if (!is_null($this->container['confirmation_response']) && (mb_strlen($this->container['confirmation_response']) > 500)) { + $invalidProperties[] = "invalid value for 'confirmation_response', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['confirmation_response']) && (mb_strlen($this->container['confirmation_response']) < 0)) { + $invalidProperties[] = "invalid value for 'confirmation_response', the character length must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets description + * + * @return string + */ + public function getDescription(): string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description description + * + * @return $this + */ + public function setDescription(string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + if ((mb_strlen($description) > 500)) { + throw new InvalidArgumentException('invalid length for $description when calling OptInWorkflow., must be smaller than or equal to 500.'); + } + if ((mb_strlen($description) < 1)) { + throw new InvalidArgumentException('invalid length for $description when calling OptInWorkflow., must be bigger than or equal to 1.'); + } + + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets image_urls + * + * @return string[] + */ + public function getImageUrls(): array + { + return $this->container['image_urls']; + } + + /** + * Sets image_urls + * + * @param string[] $image_urls image_urls + * + * @return $this + */ + public function setImageUrls(array $image_urls): static + { + if (is_null($image_urls)) { + throw new InvalidArgumentException('non-nullable image_urls cannot be null'); + } + $this->container['image_urls'] = $image_urls; + + return $this; + } + + /** + * Gets confirmation_response + * + * @return string|null + */ + public function getConfirmationResponse(): ?string + { + return $this->container['confirmation_response']; + } + + /** + * Sets confirmation_response + * + * @param string|null $confirmation_response confirmation_response + * + * @return $this + */ + public function setConfirmationResponse(?string $confirmation_response): static + { + if (is_null($confirmation_response)) { + array_push($this->openAPINullablesSetToNull, 'confirmation_response'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('confirmation_response', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($confirmation_response) && (mb_strlen($confirmation_response) > 500)) { + throw new InvalidArgumentException('invalid length for $confirmation_response when calling OptInWorkflow., must be smaller than or equal to 500.'); + } + if (!is_null($confirmation_response) && (mb_strlen($confirmation_response) < 0)) { + throw new InvalidArgumentException('invalid length for $confirmation_response when calling OptInWorkflow., must be bigger than or equal to 0.'); + } + + $this->container['confirmation_response'] = $confirmation_response; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Page.php b/src/Model/Page.php new file mode 100644 index 0000000..1ebb9e0 --- /dev/null +++ b/src/Model/Page.php @@ -0,0 +1,521 @@ + + */ +class Page implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'page'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'page_size' => 'int', + 'total_elements' => 'int', + 'total_pages' => 'int', + 'page_number' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'page_size' => null, + 'total_elements' => null, + 'total_pages' => null, + 'page_number' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'page_size' => false, + 'total_elements' => false, + 'total_pages' => false, + 'page_number' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'page_size' => 'pageSize', + 'total_elements' => 'totalElements', + 'total_pages' => 'totalPages', + 'page_number' => 'pageNumber' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'page_size' => 'setPageSize', + 'total_elements' => 'setTotalElements', + 'total_pages' => 'setTotalPages', + 'page_number' => 'setPageNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'page_size' => 'getPageSize', + 'total_elements' => 'getTotalElements', + 'total_pages' => 'getTotalPages', + 'page_number' => 'getPageNumber' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('page_size', $data ?? [], null); + $this->setIfExists('total_elements', $data ?? [], null); + $this->setIfExists('total_pages', $data ?? [], null); + $this->setIfExists('page_number', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['page_size'] === null) { + $invalidProperties[] = "'page_size' can't be null"; + } + if (($this->container['page_size'] < 0)) { + $invalidProperties[] = "invalid value for 'page_size', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['total_elements']) && ($this->container['total_elements'] < 0)) { + $invalidProperties[] = "invalid value for 'total_elements', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['total_pages']) && ($this->container['total_pages'] < 0)) { + $invalidProperties[] = "invalid value for 'total_pages', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['page_number']) && ($this->container['page_number'] < 0)) { + $invalidProperties[] = "invalid value for 'page_number', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets page_size + * + * @return int + */ + public function getPageSize(): int + { + return $this->container['page_size']; + } + + /** + * Sets page_size + * + * @param int $page_size The number of items per page. + * + * @return $this + */ + public function setPageSize(int $page_size): static + { + if (is_null($page_size)) { + throw new InvalidArgumentException('non-nullable page_size cannot be null'); + } + if (($page_size < 0)) { + throw new InvalidArgumentException('invalid value for $page_size when calling Page., must be bigger than or equal to 0.'); + } + + $this->container['page_size'] = $page_size; + + return $this; + } + + /** + * Gets total_elements + * + * @return int|null + */ + public function getTotalElements(): ?int + { + return $this->container['total_elements']; + } + + /** + * Sets total_elements + * + * @param int|null $total_elements The total number of items. + * + * @return $this + */ + public function setTotalElements(?int $total_elements): static + { + if (is_null($total_elements)) { + throw new InvalidArgumentException('non-nullable total_elements cannot be null'); + } + if (($total_elements < 0)) { + throw new InvalidArgumentException('invalid value for $total_elements when calling Page., must be bigger than or equal to 0.'); + } + + $this->container['total_elements'] = $total_elements; + + return $this; + } + + /** + * Gets total_pages + * + * @return int|null + */ + public function getTotalPages(): ?int + { + return $this->container['total_pages']; + } + + /** + * Sets total_pages + * + * @param int|null $total_pages The total number of pages. + * + * @return $this + */ + public function setTotalPages(?int $total_pages): static + { + if (is_null($total_pages)) { + throw new InvalidArgumentException('non-nullable total_pages cannot be null'); + } + if (($total_pages < 0)) { + throw new InvalidArgumentException('invalid value for $total_pages when calling Page., must be bigger than or equal to 0.'); + } + + $this->container['total_pages'] = $total_pages; + + return $this; + } + + /** + * Gets page_number + * + * @return int|null + */ + public function getPageNumber(): ?int + { + return $this->container['page_number']; + } + + /** + * Sets page_number + * + * @param int|null $page_number The current page number. + * + * @return $this + */ + public function setPageNumber(?int $page_number): static + { + if (is_null($page_number)) { + throw new InvalidArgumentException('non-nullable page_number cannot be null'); + } + if (($page_number < 0)) { + throw new InvalidArgumentException('invalid value for $page_number when calling Page., must be bigger than or equal to 0.'); + } + + $this->container['page_number'] = $page_number; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/PageInfo.php b/src/Model/PageInfo.php new file mode 100644 index 0000000..53cee02 --- /dev/null +++ b/src/Model/PageInfo.php @@ -0,0 +1,486 @@ + + */ +class PageInfo implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'pageInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'prev_page' => 'string', + 'next_page' => 'string', + 'prev_page_token' => 'string', + 'next_page_token' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'prev_page' => null, + 'next_page' => null, + 'prev_page_token' => null, + 'next_page_token' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'prev_page' => false, + 'next_page' => false, + 'prev_page_token' => false, + 'next_page_token' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'prev_page' => 'prevPage', + 'next_page' => 'nextPage', + 'prev_page_token' => 'prevPageToken', + 'next_page_token' => 'nextPageToken' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'prev_page' => 'setPrevPage', + 'next_page' => 'setNextPage', + 'prev_page_token' => 'setPrevPageToken', + 'next_page_token' => 'setNextPageToken' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'prev_page' => 'getPrevPage', + 'next_page' => 'getNextPage', + 'prev_page_token' => 'getPrevPageToken', + 'next_page_token' => 'getNextPageToken' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('prev_page', $data ?? [], null); + $this->setIfExists('next_page', $data ?? [], null); + $this->setIfExists('prev_page_token', $data ?? [], null); + $this->setIfExists('next_page_token', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets prev_page + * + * @return string|null + */ + public function getPrevPage(): ?string + { + return $this->container['prev_page']; + } + + /** + * Sets prev_page + * + * @param string|null $prev_page The link to the previous page for pagination. + * + * @return $this + */ + public function setPrevPage(?string $prev_page): static + { + if (is_null($prev_page)) { + throw new InvalidArgumentException('non-nullable prev_page cannot be null'); + } + $this->container['prev_page'] = $prev_page; + + return $this; + } + + /** + * Gets next_page + * + * @return string|null + */ + public function getNextPage(): ?string + { + return $this->container['next_page']; + } + + /** + * Sets next_page + * + * @param string|null $next_page The link to the next page for pagination. + * + * @return $this + */ + public function setNextPage(?string $next_page): static + { + if (is_null($next_page)) { + throw new InvalidArgumentException('non-nullable next_page cannot be null'); + } + $this->container['next_page'] = $next_page; + + return $this; + } + + /** + * Gets prev_page_token + * + * @return string|null + */ + public function getPrevPageToken(): ?string + { + return $this->container['prev_page_token']; + } + + /** + * Sets prev_page_token + * + * @param string|null $prev_page_token The isolated pagination token for the previous page. + * + * @return $this + */ + public function setPrevPageToken(?string $prev_page_token): static + { + if (is_null($prev_page_token)) { + throw new InvalidArgumentException('non-nullable prev_page_token cannot be null'); + } + $this->container['prev_page_token'] = $prev_page_token; + + return $this; + } + + /** + * Gets next_page_token + * + * @return string|null + */ + public function getNextPageToken(): ?string + { + return $this->container['next_page_token']; + } + + /** + * Sets next_page_token + * + * @param string|null $next_page_token The isolated pagination token for the next page. + * + * @return $this + */ + public function setNextPageToken(?string $next_page_token): static + { + if (is_null($next_page_token)) { + throw new InvalidArgumentException('non-nullable next_page_token cannot be null'); + } + $this->container['next_page_token'] = $next_page_token; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/PriorityEnum.php b/src/Model/PriorityEnum.php new file mode 100644 index 0000000..9791454 --- /dev/null +++ b/src/Model/PriorityEnum.php @@ -0,0 +1,46 @@ + + */ +class RbmActionBase implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmActionBase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => '\Bandwidth\Model\RbmActionTypeEnum', + 'text' => 'string', + 'postback_data' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'text' => null, + 'postback_data' => 'byte' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'text' => false, + 'postback_data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'text' => 'text', + 'postback_data' => 'postbackData' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'text' => 'setText', + 'postback_data' => 'setPostbackData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'text' => 'getText', + 'postback_data' => 'getPostbackData' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('postback_data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + if ((mb_strlen($this->container['text']) > 25)) { + $invalidProperties[] = "invalid value for 'text', the character length must be smaller than or equal to 25."; + } + + if ($this->container['postback_data'] === null) { + $invalidProperties[] = "'postback_data' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \Bandwidth\Model\RbmActionTypeEnum + */ + public function getType(): \Bandwidth\Model\RbmActionTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\RbmActionTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\RbmActionTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets text + * + * @return string + */ + public function getText(): string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Displayed text for user to click + * + * @return $this + */ + public function setText(string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + if ((mb_strlen($text) > 25)) { + throw new InvalidArgumentException('invalid length for $text when calling RbmActionBase., must be smaller than or equal to 25.'); + } + + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets postback_data + * + * @return string + */ + public function getPostbackData(): string + { + return $this->container['postback_data']; + } + + /** + * Sets postback_data + * + * @param string $postback_data Base64 payload the customer receives when the reply is clicked. + * + * @return $this + */ + public function setPostbackData(string $postback_data): static + { + if (is_null($postback_data)) { + throw new InvalidArgumentException('non-nullable postback_data cannot be null'); + } + + $this->container['postback_data'] = $postback_data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmActionDial.php b/src/Model/RbmActionDial.php new file mode 100644 index 0000000..d9aa464 --- /dev/null +++ b/src/Model/RbmActionDial.php @@ -0,0 +1,507 @@ + + */ +class RbmActionDial implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmActionDial'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => '\Bandwidth\Model\RbmActionTypeEnum', + 'text' => 'string', + 'postback_data' => 'string', + 'phone_number' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'text' => null, + 'postback_data' => 'byte', + 'phone_number' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'text' => false, + 'postback_data' => false, + 'phone_number' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'text' => 'text', + 'postback_data' => 'postbackData', + 'phone_number' => 'phoneNumber' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'text' => 'setText', + 'postback_data' => 'setPostbackData', + 'phone_number' => 'setPhoneNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'text' => 'getText', + 'postback_data' => 'getPostbackData', + 'phone_number' => 'getPhoneNumber' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('postback_data', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + if ((mb_strlen($this->container['text']) > 25)) { + $invalidProperties[] = "invalid value for 'text', the character length must be smaller than or equal to 25."; + } + + if ($this->container['postback_data'] === null) { + $invalidProperties[] = "'postback_data' can't be null"; + } + if ($this->container['phone_number'] === null) { + $invalidProperties[] = "'phone_number' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \Bandwidth\Model\RbmActionTypeEnum + */ + public function getType(): \Bandwidth\Model\RbmActionTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\RbmActionTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\RbmActionTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets text + * + * @return string + */ + public function getText(): string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Displayed text for user to click + * + * @return $this + */ + public function setText(string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + if ((mb_strlen($text) > 25)) { + throw new InvalidArgumentException('invalid length for $text when calling RbmActionDial., must be smaller than or equal to 25.'); + } + + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets postback_data + * + * @return string + */ + public function getPostbackData(): string + { + return $this->container['postback_data']; + } + + /** + * Sets postback_data + * + * @param string $postback_data Base64 payload the customer receives when the reply is clicked. + * + * @return $this + */ + public function setPostbackData(string $postback_data): static + { + if (is_null($postback_data)) { + throw new InvalidArgumentException('non-nullable postback_data cannot be null'); + } + + $this->container['postback_data'] = $postback_data; + + return $this; + } + + /** + * Gets phone_number + * + * @return string + */ + public function getPhoneNumber(): string + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string $phone_number The phone number to dial. Must be E164 format. + * + * @return $this + */ + public function setPhoneNumber(string $phone_number): static + { + if (is_null($phone_number)) { + throw new InvalidArgumentException('non-nullable phone_number cannot be null'); + } + $this->container['phone_number'] = $phone_number; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmActionOpenUrl.php b/src/Model/RbmActionOpenUrl.php new file mode 100644 index 0000000..f4a3eda --- /dev/null +++ b/src/Model/RbmActionOpenUrl.php @@ -0,0 +1,583 @@ + + */ +class RbmActionOpenUrl implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmActionOpenUrl'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => '\Bandwidth\Model\RbmActionTypeEnum', + 'text' => 'string', + 'postback_data' => 'string', + 'url' => 'string', + 'application' => '\Bandwidth\Model\RbmOpenUrlEnum', + 'webview_view_mode' => '\Bandwidth\Model\RbmWebViewEnum' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'text' => null, + 'postback_data' => 'byte', + 'url' => 'uri', + 'application' => null, + 'webview_view_mode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'text' => false, + 'postback_data' => false, + 'url' => false, + 'application' => false, + 'webview_view_mode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'text' => 'text', + 'postback_data' => 'postbackData', + 'url' => 'url', + 'application' => 'application', + 'webview_view_mode' => 'webviewViewMode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'text' => 'setText', + 'postback_data' => 'setPostbackData', + 'url' => 'setUrl', + 'application' => 'setApplication', + 'webview_view_mode' => 'setWebviewViewMode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'text' => 'getText', + 'postback_data' => 'getPostbackData', + 'url' => 'getUrl', + 'application' => 'getApplication', + 'webview_view_mode' => 'getWebviewViewMode' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('postback_data', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('application', $data ?? [], null); + $this->setIfExists('webview_view_mode', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + if ((mb_strlen($this->container['text']) > 25)) { + $invalidProperties[] = "invalid value for 'text', the character length must be smaller than or equal to 25."; + } + + if ($this->container['postback_data'] === null) { + $invalidProperties[] = "'postback_data' can't be null"; + } + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + if ((mb_strlen($this->container['url']) > 2048)) { + $invalidProperties[] = "invalid value for 'url', the character length must be smaller than or equal to 2048."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \Bandwidth\Model\RbmActionTypeEnum + */ + public function getType(): \Bandwidth\Model\RbmActionTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\RbmActionTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\RbmActionTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets text + * + * @return string + */ + public function getText(): string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Displayed text for user to click + * + * @return $this + */ + public function setText(string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + if ((mb_strlen($text) > 25)) { + throw new InvalidArgumentException('invalid length for $text when calling RbmActionOpenUrl., must be smaller than or equal to 25.'); + } + + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets postback_data + * + * @return string + */ + public function getPostbackData(): string + { + return $this->container['postback_data']; + } + + /** + * Sets postback_data + * + * @param string $postback_data Base64 payload the customer receives when the reply is clicked. + * + * @return $this + */ + public function setPostbackData(string $postback_data): static + { + if (is_null($postback_data)) { + throw new InvalidArgumentException('non-nullable postback_data cannot be null'); + } + + $this->container['postback_data'] = $postback_data; + + return $this; + } + + /** + * Gets url + * + * @return string + */ + public function getUrl(): string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url The URL to open in browser. Must use http:// or https:// scheme. + * + * @return $this + */ + public function setUrl(string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + if ((mb_strlen($url) > 2048)) { + throw new InvalidArgumentException('invalid length for $url when calling RbmActionOpenUrl., must be smaller than or equal to 2048.'); + } + + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets application + * + * @return \Bandwidth\Model\RbmOpenUrlEnum|null + */ + public function getApplication(): ?\Bandwidth\Model\RbmOpenUrlEnum + { + return $this->container['application']; + } + + /** + * Sets application + * + * @param \Bandwidth\Model\RbmOpenUrlEnum|null $application application + * + * @return $this + */ + public function setApplication(?\Bandwidth\Model\RbmOpenUrlEnum $application): static + { + if (is_null($application)) { + throw new InvalidArgumentException('non-nullable application cannot be null'); + } + $this->container['application'] = $application; + + return $this; + } + + /** + * Gets webview_view_mode + * + * @return \Bandwidth\Model\RbmWebViewEnum|null + */ + public function getWebviewViewMode(): ?\Bandwidth\Model\RbmWebViewEnum + { + return $this->container['webview_view_mode']; + } + + /** + * Sets webview_view_mode + * + * @param \Bandwidth\Model\RbmWebViewEnum|null $webview_view_mode webview_view_mode + * + * @return $this + */ + public function setWebviewViewMode(?\Bandwidth\Model\RbmWebViewEnum $webview_view_mode): static + { + if (is_null($webview_view_mode)) { + throw new InvalidArgumentException('non-nullable webview_view_mode cannot be null'); + } + $this->container['webview_view_mode'] = $webview_view_mode; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmActionTypeEnum.php b/src/Model/RbmActionTypeEnum.php new file mode 100644 index 0000000..926da02 --- /dev/null +++ b/src/Model/RbmActionTypeEnum.php @@ -0,0 +1,53 @@ + + */ +class RbmActionViewLocation implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmActionViewLocation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => '\Bandwidth\Model\RbmActionTypeEnum', + 'text' => 'string', + 'postback_data' => 'string', + 'latitude' => 'float', + 'longitude' => 'float', + 'label' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'text' => null, + 'postback_data' => 'byte', + 'latitude' => 'double', + 'longitude' => 'double', + 'label' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'text' => false, + 'postback_data' => false, + 'latitude' => false, + 'longitude' => false, + 'label' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'text' => 'text', + 'postback_data' => 'postbackData', + 'latitude' => 'latitude', + 'longitude' => 'longitude', + 'label' => 'label' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'text' => 'setText', + 'postback_data' => 'setPostbackData', + 'latitude' => 'setLatitude', + 'longitude' => 'setLongitude', + 'label' => 'setLabel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'text' => 'getText', + 'postback_data' => 'getPostbackData', + 'latitude' => 'getLatitude', + 'longitude' => 'getLongitude', + 'label' => 'getLabel' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('postback_data', $data ?? [], null); + $this->setIfExists('latitude', $data ?? [], null); + $this->setIfExists('longitude', $data ?? [], null); + $this->setIfExists('label', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + if ((mb_strlen($this->container['text']) > 25)) { + $invalidProperties[] = "invalid value for 'text', the character length must be smaller than or equal to 25."; + } + + if ($this->container['postback_data'] === null) { + $invalidProperties[] = "'postback_data' can't be null"; + } + if ($this->container['latitude'] === null) { + $invalidProperties[] = "'latitude' can't be null"; + } + if ($this->container['longitude'] === null) { + $invalidProperties[] = "'longitude' can't be null"; + } + if (!is_null($this->container['label']) && (mb_strlen($this->container['label']) > 100)) { + $invalidProperties[] = "invalid value for 'label', the character length must be smaller than or equal to 100."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return \Bandwidth\Model\RbmActionTypeEnum + */ + public function getType(): \Bandwidth\Model\RbmActionTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\RbmActionTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\RbmActionTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets text + * + * @return string + */ + public function getText(): string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Displayed text for user to click + * + * @return $this + */ + public function setText(string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + if ((mb_strlen($text) > 25)) { + throw new InvalidArgumentException('invalid length for $text when calling RbmActionViewLocation., must be smaller than or equal to 25.'); + } + + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets postback_data + * + * @return string + */ + public function getPostbackData(): string + { + return $this->container['postback_data']; + } + + /** + * Sets postback_data + * + * @param string $postback_data Base64 payload the customer receives when the reply is clicked. + * + * @return $this + */ + public function setPostbackData(string $postback_data): static + { + if (is_null($postback_data)) { + throw new InvalidArgumentException('non-nullable postback_data cannot be null'); + } + + $this->container['postback_data'] = $postback_data; + + return $this; + } + + /** + * Gets latitude + * + * @return float + */ + public function getLatitude(): float + { + return $this->container['latitude']; + } + + /** + * Sets latitude + * + * @param float $latitude The latitude of the location. Must be in range [-90.000000, 90.000000]. + * + * @return $this + */ + public function setLatitude(float $latitude): static + { + if (is_null($latitude)) { + throw new InvalidArgumentException('non-nullable latitude cannot be null'); + } + $this->container['latitude'] = $latitude; + + return $this; + } + + /** + * Gets longitude + * + * @return float + */ + public function getLongitude(): float + { + return $this->container['longitude']; + } + + /** + * Sets longitude + * + * @param float $longitude The longitude of the location. Must be in range [-180.000000, 180.000000]. + * + * @return $this + */ + public function setLongitude(float $longitude): static + { + if (is_null($longitude)) { + throw new InvalidArgumentException('non-nullable longitude cannot be null'); + } + $this->container['longitude'] = $longitude; + + return $this; + } + + /** + * Gets label + * + * @return string|null + */ + public function getLabel(): ?string + { + return $this->container['label']; + } + + /** + * Sets label + * + * @param string|null $label The label of the location. + * + * @return $this + */ + public function setLabel(?string $label): static + { + if (is_null($label)) { + throw new InvalidArgumentException('non-nullable label cannot be null'); + } + if ((mb_strlen($label) > 100)) { + throw new InvalidArgumentException('invalid length for $label when calling RbmActionViewLocation., must be smaller than or equal to 100.'); + } + + $this->container['label'] = $label; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmCardContent.php b/src/Model/RbmCardContent.php new file mode 100644 index 0000000..17e3ddd --- /dev/null +++ b/src/Model/RbmCardContent.php @@ -0,0 +1,510 @@ + + */ +class RbmCardContent implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmCardContent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'title' => 'string', + 'description' => 'string', + 'media' => '\Bandwidth\Model\RbmCardContentMedia', + 'suggestions' => '\Bandwidth\Model\MultiChannelAction[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'title' => null, + 'description' => null, + 'media' => null, + 'suggestions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'title' => false, + 'description' => false, + 'media' => false, + 'suggestions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'title' => 'title', + 'description' => 'description', + 'media' => 'media', + 'suggestions' => 'suggestions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'title' => 'setTitle', + 'description' => 'setDescription', + 'media' => 'setMedia', + 'suggestions' => 'setSuggestions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'title' => 'getTitle', + 'description' => 'getDescription', + 'media' => 'getMedia', + 'suggestions' => 'getSuggestions' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('media', $data ?? [], null); + $this->setIfExists('suggestions', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) > 200)) { + $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 200."; + } + + if (!is_null($this->container['description']) && (mb_strlen($this->container['description']) > 2000)) { + $invalidProperties[] = "invalid value for 'description', the character length must be smaller than or equal to 2000."; + } + + if (!is_null($this->container['suggestions']) && (count($this->container['suggestions']) > 4)) { + $invalidProperties[] = "invalid value for 'suggestions', number of items must be less than or equal to 4."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle(): ?string + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the card. Must be 200 characters or less. + * + * @return $this + */ + public function setTitle(?string $title): static + { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if ((mb_strlen($title) > 200)) { + throw new InvalidArgumentException('invalid length for $title when calling RbmCardContent., must be smaller than or equal to 200.'); + } + + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The description of the card. Must be 2000 characters or less. + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + if ((mb_strlen($description) > 2000)) { + throw new InvalidArgumentException('invalid length for $description when calling RbmCardContent., must be smaller than or equal to 2000.'); + } + + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets media + * + * @return \Bandwidth\Model\RbmCardContentMedia|null + */ + public function getMedia(): ?\Bandwidth\Model\RbmCardContentMedia + { + return $this->container['media']; + } + + /** + * Sets media + * + * @param \Bandwidth\Model\RbmCardContentMedia|null $media media + * + * @return $this + */ + public function setMedia(?\Bandwidth\Model\RbmCardContentMedia $media): static + { + if (is_null($media)) { + throw new InvalidArgumentException('non-nullable media cannot be null'); + } + $this->container['media'] = $media; + + return $this; + } + + /** + * Gets suggestions + * + * @return (\Bandwidth\Model\RbmActionBase|\Bandwidth\Model\RbmActionDial|\Bandwidth\Model\RbmActionViewLocation|\Bandwidth\Model\MultiChannelActionCalendarEvent|\Bandwidth\Model\RbmActionOpenUrl)[]|null + */ + public function getSuggestions(): ?array + { + return $this->container['suggestions']; + } + + /** + * Sets suggestions + * + * @param (\Bandwidth\Model\RbmActionBase|\Bandwidth\Model\RbmActionDial|\Bandwidth\Model\RbmActionViewLocation|\Bandwidth\Model\MultiChannelActionCalendarEvent|\Bandwidth\Model\RbmActionOpenUrl)[]|null $suggestions An array of suggested actions for the recipient that will be displayed on the rich card. + * + * @return $this + */ + public function setSuggestions(?array $suggestions): static + { + if (is_null($suggestions)) { + throw new InvalidArgumentException('non-nullable suggestions cannot be null'); + } + if ((count($suggestions) > 4)) { + throw new InvalidArgumentException('invalid value for $suggestions when calling RbmCardContent., number of items must be less than or equal to 4.'); + } + $this->container['suggestions'] = $suggestions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmCardContentMedia.php b/src/Model/RbmCardContentMedia.php new file mode 100644 index 0000000..a2c0b47 --- /dev/null +++ b/src/Model/RbmCardContentMedia.php @@ -0,0 +1,474 @@ + + */ +class RbmCardContentMedia implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmCardContent_media'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'file_url' => 'string', + 'thumbnail_url' => 'string', + 'height' => '\Bandwidth\Model\RbmMediaHeightEnum' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'file_url' => 'uri', + 'thumbnail_url' => 'uri', + 'height' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'file_url' => false, + 'thumbnail_url' => false, + 'height' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'file_url' => 'fileUrl', + 'thumbnail_url' => 'thumbnailUrl', + 'height' => 'height' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'file_url' => 'setFileUrl', + 'thumbnail_url' => 'setThumbnailUrl', + 'height' => 'setHeight' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'file_url' => 'getFileUrl', + 'thumbnail_url' => 'getThumbnailUrl', + 'height' => 'getHeight' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('file_url', $data ?? [], null); + $this->setIfExists('thumbnail_url', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['file_url'] === null) { + $invalidProperties[] = "'file_url' can't be null"; + } + if ((mb_strlen($this->container['file_url']) > 1000)) { + $invalidProperties[] = "invalid value for 'file_url', the character length must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['thumbnail_url']) && (mb_strlen($this->container['thumbnail_url']) > 1000)) { + $invalidProperties[] = "invalid value for 'thumbnail_url', the character length must be smaller than or equal to 1000."; + } + + if ($this->container['height'] === null) { + $invalidProperties[] = "'height' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets file_url + * + * @return string + */ + public function getFileUrl(): string + { + return $this->container['file_url']; + } + + /** + * Sets file_url + * + * @param string $file_url The URL of the media file. 100MB is the maximum file size. + * + * @return $this + */ + public function setFileUrl(string $file_url): static + { + if (is_null($file_url)) { + throw new InvalidArgumentException('non-nullable file_url cannot be null'); + } + if ((mb_strlen($file_url) > 1000)) { + throw new InvalidArgumentException('invalid length for $file_url when calling RbmCardContentMedia., must be smaller than or equal to 1000.'); + } + + $this->container['file_url'] = $file_url; + + return $this; + } + + /** + * Gets thumbnail_url + * + * @return string|null + */ + public function getThumbnailUrl(): ?string + { + return $this->container['thumbnail_url']; + } + + /** + * Sets thumbnail_url + * + * @param string|null $thumbnail_url The URL of the thumbnail image. Applies only to video file media. + * + * @return $this + */ + public function setThumbnailUrl(?string $thumbnail_url): static + { + if (is_null($thumbnail_url)) { + throw new InvalidArgumentException('non-nullable thumbnail_url cannot be null'); + } + if ((mb_strlen($thumbnail_url) > 1000)) { + throw new InvalidArgumentException('invalid length for $thumbnail_url when calling RbmCardContentMedia., must be smaller than or equal to 1000.'); + } + + $this->container['thumbnail_url'] = $thumbnail_url; + + return $this; + } + + /** + * Gets height + * + * @return \Bandwidth\Model\RbmMediaHeightEnum + */ + public function getHeight(): \Bandwidth\Model\RbmMediaHeightEnum + { + return $this->container['height']; + } + + /** + * Sets height + * + * @param \Bandwidth\Model\RbmMediaHeightEnum $height height + * + * @return $this + */ + public function setHeight(\Bandwidth\Model\RbmMediaHeightEnum $height): static + { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } + $this->container['height'] = $height; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmLocationResponse.php b/src/Model/RbmLocationResponse.php new file mode 100644 index 0000000..9417565 --- /dev/null +++ b/src/Model/RbmLocationResponse.php @@ -0,0 +1,418 @@ + + */ +class RbmLocationResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmLocationResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'latitude' => 'float', + 'longitude' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'latitude' => 'double', + 'longitude' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'latitude' => false, + 'longitude' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'latitude' => 'latitude', + 'longitude' => 'longitude' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'latitude' => 'setLatitude', + 'longitude' => 'setLongitude' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'latitude' => 'getLatitude', + 'longitude' => 'getLongitude' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('latitude', $data ?? [], null); + $this->setIfExists('longitude', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets latitude + * + * @return float|null + */ + public function getLatitude(): ?float + { + return $this->container['latitude']; + } + + /** + * Sets latitude + * + * @param float|null $latitude The latitude of the client's location. + * + * @return $this + */ + public function setLatitude(?float $latitude): static + { + if (is_null($latitude)) { + throw new InvalidArgumentException('non-nullable latitude cannot be null'); + } + $this->container['latitude'] = $latitude; + + return $this; + } + + /** + * Gets longitude + * + * @return float|null + */ + public function getLongitude(): ?float + { + return $this->container['longitude']; + } + + /** + * Sets longitude + * + * @param float|null $longitude The longitude of the client's location. + * + * @return $this + */ + public function setLongitude(?float $longitude): static + { + if (is_null($longitude)) { + throw new InvalidArgumentException('non-nullable longitude cannot be null'); + } + $this->container['longitude'] = $longitude; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmMediaHeightEnum.php b/src/Model/RbmMediaHeightEnum.php new file mode 100644 index 0000000..d09e05a --- /dev/null +++ b/src/Model/RbmMediaHeightEnum.php @@ -0,0 +1,48 @@ + + */ +class RbmMessageCarouselCard implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmMessageCarouselCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'card_width' => '\Bandwidth\Model\CardWidthEnum', + 'card_contents' => '\Bandwidth\Model\RbmCardContent[]', + 'suggestions' => '\Bandwidth\Model\MultiChannelAction[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'card_width' => null, + 'card_contents' => null, + 'suggestions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'card_width' => false, + 'card_contents' => false, + 'suggestions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'card_width' => 'cardWidth', + 'card_contents' => 'cardContents', + 'suggestions' => 'suggestions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'card_width' => 'setCardWidth', + 'card_contents' => 'setCardContents', + 'suggestions' => 'setSuggestions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'card_width' => 'getCardWidth', + 'card_contents' => 'getCardContents', + 'suggestions' => 'getSuggestions' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('card_width', $data ?? [], null); + $this->setIfExists('card_contents', $data ?? [], null); + $this->setIfExists('suggestions', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['card_width'] === null) { + $invalidProperties[] = "'card_width' can't be null"; + } + if ($this->container['card_contents'] === null) { + $invalidProperties[] = "'card_contents' can't be null"; + } + if ((count($this->container['card_contents']) > 10)) { + $invalidProperties[] = "invalid value for 'card_contents', number of items must be less than or equal to 10."; + } + + if ((count($this->container['card_contents']) < 2)) { + $invalidProperties[] = "invalid value for 'card_contents', number of items must be greater than or equal to 2."; + } + + if (!is_null($this->container['suggestions']) && (count($this->container['suggestions']) > 11)) { + $invalidProperties[] = "invalid value for 'suggestions', number of items must be less than or equal to 11."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets card_width + * + * @return \Bandwidth\Model\CardWidthEnum + */ + public function getCardWidth(): \Bandwidth\Model\CardWidthEnum + { + return $this->container['card_width']; + } + + /** + * Sets card_width + * + * @param \Bandwidth\Model\CardWidthEnum $card_width card_width + * + * @return $this + */ + public function setCardWidth(\Bandwidth\Model\CardWidthEnum $card_width): static + { + if (is_null($card_width)) { + throw new InvalidArgumentException('non-nullable card_width cannot be null'); + } + $this->container['card_width'] = $card_width; + + return $this; + } + + /** + * Gets card_contents + * + * @return \Bandwidth\Model\RbmCardContent[] + */ + public function getCardContents(): array + { + return $this->container['card_contents']; + } + + /** + * Sets card_contents + * + * @param \Bandwidth\Model\RbmCardContent[] $card_contents card_contents + * + * @return $this + */ + public function setCardContents(array $card_contents): static + { + if (is_null($card_contents)) { + throw new InvalidArgumentException('non-nullable card_contents cannot be null'); + } + if ((count($card_contents) > 10)) { + throw new InvalidArgumentException('invalid value for $card_contents when calling RbmMessageCarouselCard., number of items must be less than or equal to 10.'); + } + if ((count($card_contents) < 2)) { + throw new InvalidArgumentException('invalid length for $card_contents when calling RbmMessageCarouselCard., number of items must be greater than or equal to 2.'); + } + $this->container['card_contents'] = $card_contents; + + return $this; + } + + /** + * Gets suggestions + * + * @return (\Bandwidth\Model\RbmActionBase|\Bandwidth\Model\RbmActionDial|\Bandwidth\Model\RbmActionViewLocation|\Bandwidth\Model\MultiChannelActionCalendarEvent|\Bandwidth\Model\RbmActionOpenUrl)[]|null + */ + public function getSuggestions(): ?array + { + return $this->container['suggestions']; + } + + /** + * Sets suggestions + * + * @param (\Bandwidth\Model\RbmActionBase|\Bandwidth\Model\RbmActionDial|\Bandwidth\Model\RbmActionViewLocation|\Bandwidth\Model\MultiChannelActionCalendarEvent|\Bandwidth\Model\RbmActionOpenUrl)[]|null $suggestions An array of suggested actions for the recipient. + * + * @return $this + */ + public function setSuggestions(?array $suggestions): static + { + if (is_null($suggestions)) { + throw new InvalidArgumentException('non-nullable suggestions cannot be null'); + } + if ((count($suggestions) > 11)) { + throw new InvalidArgumentException('invalid value for $suggestions when calling RbmMessageCarouselCard., number of items must be less than or equal to 11.'); + } + $this->container['suggestions'] = $suggestions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmMessageContentFile.php b/src/Model/RbmMessageContentFile.php new file mode 100644 index 0000000..3ed416d --- /dev/null +++ b/src/Model/RbmMessageContentFile.php @@ -0,0 +1,437 @@ + + */ +class RbmMessageContentFile implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmMessageContentFile'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'file_url' => 'string', + 'thumbnail_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'file_url' => 'uri', + 'thumbnail_url' => 'uri' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'file_url' => false, + 'thumbnail_url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'file_url' => 'fileUrl', + 'thumbnail_url' => 'thumbnailUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'file_url' => 'setFileUrl', + 'thumbnail_url' => 'setThumbnailUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'file_url' => 'getFileUrl', + 'thumbnail_url' => 'getThumbnailUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('file_url', $data ?? [], null); + $this->setIfExists('thumbnail_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['file_url'] === null) { + $invalidProperties[] = "'file_url' can't be null"; + } + if ((mb_strlen($this->container['file_url']) > 1000)) { + $invalidProperties[] = "invalid value for 'file_url', the character length must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['thumbnail_url']) && (mb_strlen($this->container['thumbnail_url']) > 1000)) { + $invalidProperties[] = "invalid value for 'thumbnail_url', the character length must be smaller than or equal to 1000."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets file_url + * + * @return string + */ + public function getFileUrl(): string + { + return $this->container['file_url']; + } + + /** + * Sets file_url + * + * @param string $file_url The URL of the media file. 100MB is the maximum file size. + * + * @return $this + */ + public function setFileUrl(string $file_url): static + { + if (is_null($file_url)) { + throw new InvalidArgumentException('non-nullable file_url cannot be null'); + } + if ((mb_strlen($file_url) > 1000)) { + throw new InvalidArgumentException('invalid length for $file_url when calling RbmMessageContentFile., must be smaller than or equal to 1000.'); + } + + $this->container['file_url'] = $file_url; + + return $this; + } + + /** + * Gets thumbnail_url + * + * @return string|null + */ + public function getThumbnailUrl(): ?string + { + return $this->container['thumbnail_url']; + } + + /** + * Sets thumbnail_url + * + * @param string|null $thumbnail_url The URL of the thumbnail image. Applies only to video file media. + * + * @return $this + */ + public function setThumbnailUrl(?string $thumbnail_url): static + { + if (is_null($thumbnail_url)) { + throw new InvalidArgumentException('non-nullable thumbnail_url cannot be null'); + } + if ((mb_strlen($thumbnail_url) > 1000)) { + throw new InvalidArgumentException('invalid length for $thumbnail_url when calling RbmMessageContentFile., must be smaller than or equal to 1000.'); + } + + $this->container['thumbnail_url'] = $thumbnail_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmMessageContentRichCard.php b/src/Model/RbmMessageContentRichCard.php new file mode 100644 index 0000000..5dcc070 --- /dev/null +++ b/src/Model/RbmMessageContentRichCard.php @@ -0,0 +1,84 @@ + + */ +class RbmMessageContentText implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmMessageContentText'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'text' => 'string', + 'suggestions' => '\Bandwidth\Model\MultiChannelAction[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'text' => null, + 'suggestions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'text' => false, + 'suggestions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'text' => 'text', + 'suggestions' => 'suggestions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'text' => 'setText', + 'suggestions' => 'setSuggestions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'text' => 'getText', + 'suggestions' => 'getSuggestions' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('suggestions', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + if ((mb_strlen($this->container['text']) > 3270)) { + $invalidProperties[] = "invalid value for 'text', the character length must be smaller than or equal to 3270."; + } + + if (!is_null($this->container['suggestions']) && (count($this->container['suggestions']) > 11)) { + $invalidProperties[] = "invalid value for 'suggestions', number of items must be less than or equal to 11."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets text + * + * @return string + */ + public function getText(): string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text The text associated with the message. Must be 3270 characters or less + * + * @return $this + */ + public function setText(string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + if ((mb_strlen($text) > 3270)) { + throw new InvalidArgumentException('invalid length for $text when calling RbmMessageContentText., must be smaller than or equal to 3270.'); + } + + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets suggestions + * + * @return (\Bandwidth\Model\RbmActionBase|\Bandwidth\Model\RbmActionDial|\Bandwidth\Model\RbmActionViewLocation|\Bandwidth\Model\MultiChannelActionCalendarEvent|\Bandwidth\Model\RbmActionOpenUrl)[]|null + */ + public function getSuggestions(): ?array + { + return $this->container['suggestions']; + } + + /** + * Sets suggestions + * + * @param (\Bandwidth\Model\RbmActionBase|\Bandwidth\Model\RbmActionDial|\Bandwidth\Model\RbmActionViewLocation|\Bandwidth\Model\MultiChannelActionCalendarEvent|\Bandwidth\Model\RbmActionOpenUrl)[]|null $suggestions An array of suggested actions for the recipient. + * + * @return $this + */ + public function setSuggestions(?array $suggestions): static + { + if (is_null($suggestions)) { + throw new InvalidArgumentException('non-nullable suggestions cannot be null'); + } + if ((count($suggestions) > 11)) { + throw new InvalidArgumentException('invalid value for $suggestions when calling RbmMessageContentText., number of items must be less than or equal to 11.'); + } + $this->container['suggestions'] = $suggestions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmMessageMedia.php b/src/Model/RbmMessageMedia.php new file mode 100644 index 0000000..2583688 --- /dev/null +++ b/src/Model/RbmMessageMedia.php @@ -0,0 +1,428 @@ + + */ +class RbmMessageMedia implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmMessageMedia'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'media' => '\Bandwidth\Model\RbmMessageContentFile[]', + 'suggestions' => '\Bandwidth\Model\MultiChannelAction[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'media' => null, + 'suggestions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'media' => false, + 'suggestions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'media' => 'media', + 'suggestions' => 'suggestions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'media' => 'setMedia', + 'suggestions' => 'setSuggestions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'media' => 'getMedia', + 'suggestions' => 'getSuggestions' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('media', $data ?? [], null); + $this->setIfExists('suggestions', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['media'] === null) { + $invalidProperties[] = "'media' can't be null"; + } + if (!is_null($this->container['suggestions']) && (count($this->container['suggestions']) > 11)) { + $invalidProperties[] = "invalid value for 'suggestions', number of items must be less than or equal to 11."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets media + * + * @return \Bandwidth\Model\RbmMessageContentFile[] + */ + public function getMedia(): array + { + return $this->container['media']; + } + + /** + * Sets media + * + * @param \Bandwidth\Model\RbmMessageContentFile[] $media media + * + * @return $this + */ + public function setMedia(array $media): static + { + if (is_null($media)) { + throw new InvalidArgumentException('non-nullable media cannot be null'); + } + $this->container['media'] = $media; + + return $this; + } + + /** + * Gets suggestions + * + * @return (\Bandwidth\Model\RbmActionBase|\Bandwidth\Model\RbmActionDial|\Bandwidth\Model\RbmActionViewLocation|\Bandwidth\Model\MultiChannelActionCalendarEvent|\Bandwidth\Model\RbmActionOpenUrl)[]|null + */ + public function getSuggestions(): ?array + { + return $this->container['suggestions']; + } + + /** + * Sets suggestions + * + * @param (\Bandwidth\Model\RbmActionBase|\Bandwidth\Model\RbmActionDial|\Bandwidth\Model\RbmActionViewLocation|\Bandwidth\Model\MultiChannelActionCalendarEvent|\Bandwidth\Model\RbmActionOpenUrl)[]|null $suggestions An array of suggested actions for the recipient. + * + * @return $this + */ + public function setSuggestions(?array $suggestions): static + { + if (is_null($suggestions)) { + throw new InvalidArgumentException('non-nullable suggestions cannot be null'); + } + if ((count($suggestions) > 11)) { + throw new InvalidArgumentException('invalid value for $suggestions when calling RbmMessageMedia., number of items must be less than or equal to 11.'); + } + $this->container['suggestions'] = $suggestions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmOpenUrlEnum.php b/src/Model/RbmOpenUrlEnum.php new file mode 100644 index 0000000..4b2c943 --- /dev/null +++ b/src/Model/RbmOpenUrlEnum.php @@ -0,0 +1,46 @@ + + */ +class RbmStandaloneCard implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmStandaloneCard'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'orientation' => '\Bandwidth\Model\StandaloneCardOrientationEnum', + 'thumbnail_image_alignment' => '\Bandwidth\Model\ThumbnailAlignmentEnum', + 'card_content' => '\Bandwidth\Model\RbmCardContent', + 'suggestions' => '\Bandwidth\Model\MultiChannelAction[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'orientation' => null, + 'thumbnail_image_alignment' => null, + 'card_content' => null, + 'suggestions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'orientation' => false, + 'thumbnail_image_alignment' => false, + 'card_content' => false, + 'suggestions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'orientation' => 'orientation', + 'thumbnail_image_alignment' => 'thumbnailImageAlignment', + 'card_content' => 'cardContent', + 'suggestions' => 'suggestions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'orientation' => 'setOrientation', + 'thumbnail_image_alignment' => 'setThumbnailImageAlignment', + 'card_content' => 'setCardContent', + 'suggestions' => 'setSuggestions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'orientation' => 'getOrientation', + 'thumbnail_image_alignment' => 'getThumbnailImageAlignment', + 'card_content' => 'getCardContent', + 'suggestions' => 'getSuggestions' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('orientation', $data ?? [], null); + $this->setIfExists('thumbnail_image_alignment', $data ?? [], null); + $this->setIfExists('card_content', $data ?? [], null); + $this->setIfExists('suggestions', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['orientation'] === null) { + $invalidProperties[] = "'orientation' can't be null"; + } + if ($this->container['card_content'] === null) { + $invalidProperties[] = "'card_content' can't be null"; + } + if (!is_null($this->container['suggestions']) && (count($this->container['suggestions']) > 11)) { + $invalidProperties[] = "invalid value for 'suggestions', number of items must be less than or equal to 11."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets orientation + * + * @return \Bandwidth\Model\StandaloneCardOrientationEnum + */ + public function getOrientation(): \Bandwidth\Model\StandaloneCardOrientationEnum + { + return $this->container['orientation']; + } + + /** + * Sets orientation + * + * @param \Bandwidth\Model\StandaloneCardOrientationEnum $orientation orientation + * + * @return $this + */ + public function setOrientation(\Bandwidth\Model\StandaloneCardOrientationEnum $orientation): static + { + if (is_null($orientation)) { + throw new InvalidArgumentException('non-nullable orientation cannot be null'); + } + $this->container['orientation'] = $orientation; + + return $this; + } + + /** + * Gets thumbnail_image_alignment + * + * @return \Bandwidth\Model\ThumbnailAlignmentEnum|null + */ + public function getThumbnailImageAlignment(): ?\Bandwidth\Model\ThumbnailAlignmentEnum + { + return $this->container['thumbnail_image_alignment']; + } + + /** + * Sets thumbnail_image_alignment + * + * @param \Bandwidth\Model\ThumbnailAlignmentEnum|null $thumbnail_image_alignment thumbnail_image_alignment + * + * @return $this + */ + public function setThumbnailImageAlignment(?\Bandwidth\Model\ThumbnailAlignmentEnum $thumbnail_image_alignment): static + { + if (is_null($thumbnail_image_alignment)) { + throw new InvalidArgumentException('non-nullable thumbnail_image_alignment cannot be null'); + } + $this->container['thumbnail_image_alignment'] = $thumbnail_image_alignment; + + return $this; + } + + /** + * Gets card_content + * + * @return \Bandwidth\Model\RbmCardContent + */ + public function getCardContent(): \Bandwidth\Model\RbmCardContent + { + return $this->container['card_content']; + } + + /** + * Sets card_content + * + * @param \Bandwidth\Model\RbmCardContent $card_content card_content + * + * @return $this + */ + public function setCardContent(\Bandwidth\Model\RbmCardContent $card_content): static + { + if (is_null($card_content)) { + throw new InvalidArgumentException('non-nullable card_content cannot be null'); + } + $this->container['card_content'] = $card_content; + + return $this; + } + + /** + * Gets suggestions + * + * @return (\Bandwidth\Model\RbmActionBase|\Bandwidth\Model\RbmActionDial|\Bandwidth\Model\RbmActionViewLocation|\Bandwidth\Model\MultiChannelActionCalendarEvent|\Bandwidth\Model\RbmActionOpenUrl)[]|null + */ + public function getSuggestions(): ?array + { + return $this->container['suggestions']; + } + + /** + * Sets suggestions + * + * @param (\Bandwidth\Model\RbmActionBase|\Bandwidth\Model\RbmActionDial|\Bandwidth\Model\RbmActionViewLocation|\Bandwidth\Model\MultiChannelActionCalendarEvent|\Bandwidth\Model\RbmActionOpenUrl)[]|null $suggestions An array of suggested actions for the recipient. + * + * @return $this + */ + public function setSuggestions(?array $suggestions): static + { + if (is_null($suggestions)) { + throw new InvalidArgumentException('non-nullable suggestions cannot be null'); + } + if ((count($suggestions) > 11)) { + throw new InvalidArgumentException('invalid value for $suggestions when calling RbmStandaloneCard., number of items must be less than or equal to 11.'); + } + $this->container['suggestions'] = $suggestions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmSuggestionResponse.php b/src/Model/RbmSuggestionResponse.php new file mode 100644 index 0000000..97058c5 --- /dev/null +++ b/src/Model/RbmSuggestionResponse.php @@ -0,0 +1,460 @@ + + */ +class RbmSuggestionResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'rbmSuggestionResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'text' => 'string', + 'postback_data' => 'string', + 'paired_message_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'text' => null, + 'postback_data' => 'byte', + 'paired_message_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'text' => false, + 'postback_data' => false, + 'paired_message_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'text' => 'text', + 'postback_data' => 'postbackData', + 'paired_message_id' => 'pairedMessageId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'text' => 'setText', + 'postback_data' => 'setPostbackData', + 'paired_message_id' => 'setPairedMessageId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'text' => 'getText', + 'postback_data' => 'getPostbackData', + 'paired_message_id' => 'getPairedMessageId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('postback_data', $data ?? [], null); + $this->setIfExists('paired_message_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets text + * + * @return string|null + */ + public function getText(): ?string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text The text associated with the suggestion response. + * + * @return $this + */ + public function setText(?string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets postback_data + * + * @return string|null + */ + public function getPostbackData(): ?string + { + return $this->container['postback_data']; + } + + /** + * Sets postback_data + * + * @param string|null $postback_data Base64 payload the customer receives when the reply is clicked. + * + * @return $this + */ + public function setPostbackData(?string $postback_data): static + { + if (is_null($postback_data)) { + throw new InvalidArgumentException('non-nullable postback_data cannot be null'); + } + + $this->container['postback_data'] = $postback_data; + + return $this; + } + + /** + * Gets paired_message_id + * + * @return string|null + */ + public function getPairedMessageId(): ?string + { + return $this->container['paired_message_id']; + } + + /** + * Sets paired_message_id + * + * @param string|null $paired_message_id Corresponding parent message ID (MT). + * + * @return $this + */ + public function setPairedMessageId(?string $paired_message_id): static + { + if (is_null($paired_message_id)) { + array_push($this->openAPINullablesSetToNull, 'paired_message_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('paired_message_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['paired_message_id'] = $paired_message_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RbmWebViewEnum.php b/src/Model/RbmWebViewEnum.php new file mode 100644 index 0000000..ffdbf34 --- /dev/null +++ b/src/Model/RbmWebViewEnum.php @@ -0,0 +1,48 @@ + + */ +class RecordingAvailableCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'recordingAvailableCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'parent_call_id' => 'string', + 'recording_id' => 'string', + 'media_url' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'end_time' => '\DateTime', + 'duration' => 'string', + 'file_format' => '\Bandwidth\Model\FileFormatEnum', + 'channels' => 'int', + 'tag' => 'string', + 'status' => 'string', + 'transfer_caller_id' => 'string', + 'transfer_to' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'parent_call_id' => null, + 'recording_id' => null, + 'media_url' => 'uri', + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'end_time' => 'date-time', + 'duration' => null, + 'file_format' => null, + 'channels' => 'int32', + 'tag' => null, + 'status' => null, + 'transfer_caller_id' => null, + 'transfer_to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'parent_call_id' => false, + 'recording_id' => false, + 'media_url' => true, + 'enqueued_time' => true, + 'start_time' => false, + 'end_time' => false, + 'duration' => false, + 'file_format' => false, + 'channels' => false, + 'tag' => true, + 'status' => false, + 'transfer_caller_id' => false, + 'transfer_to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'parent_call_id' => 'parentCallId', + 'recording_id' => 'recordingId', + 'media_url' => 'mediaUrl', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'end_time' => 'endTime', + 'duration' => 'duration', + 'file_format' => 'fileFormat', + 'channels' => 'channels', + 'tag' => 'tag', + 'status' => 'status', + 'transfer_caller_id' => 'transferCallerId', + 'transfer_to' => 'transferTo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'parent_call_id' => 'setParentCallId', + 'recording_id' => 'setRecordingId', + 'media_url' => 'setMediaUrl', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'end_time' => 'setEndTime', + 'duration' => 'setDuration', + 'file_format' => 'setFileFormat', + 'channels' => 'setChannels', + 'tag' => 'setTag', + 'status' => 'setStatus', + 'transfer_caller_id' => 'setTransferCallerId', + 'transfer_to' => 'setTransferTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'parent_call_id' => 'getParentCallId', + 'recording_id' => 'getRecordingId', + 'media_url' => 'getMediaUrl', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'end_time' => 'getEndTime', + 'duration' => 'getDuration', + 'file_format' => 'getFileFormat', + 'channels' => 'getChannels', + 'tag' => 'getTag', + 'status' => 'getStatus', + 'transfer_caller_id' => 'getTransferCallerId', + 'transfer_to' => 'getTransferTo' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('parent_call_id', $data ?? [], null); + $this->setIfExists('recording_id', $data ?? [], null); + $this->setIfExists('media_url', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('file_format', $data ?? [], null); + $this->setIfExists('channels', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('transfer_caller_id', $data ?? [], null); + $this->setIfExists('transfer_to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets parent_call_id + * + * @return string|null + */ + public function getParentCallId(): ?string + { + return $this->container['parent_call_id']; + } + + /** + * Sets parent_call_id + * + * @param string|null $parent_call_id (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. + * + * @return $this + */ + public function setParentCallId(?string $parent_call_id): static + { + if (is_null($parent_call_id)) { + throw new InvalidArgumentException('non-nullable parent_call_id cannot be null'); + } + $this->container['parent_call_id'] = $parent_call_id; + + return $this; + } + + /** + * Gets recording_id + * + * @return string|null + */ + public function getRecordingId(): ?string + { + return $this->container['recording_id']; + } + + /** + * Sets recording_id + * + * @param string|null $recording_id The unique ID of this recording + * + * @return $this + */ + public function setRecordingId(?string $recording_id): static + { + if (is_null($recording_id)) { + throw new InvalidArgumentException('non-nullable recording_id cannot be null'); + } + $this->container['recording_id'] = $recording_id; + + return $this; + } + + /** + * Gets media_url + * + * @return string|null + */ + public function getMediaUrl(): ?string + { + return $this->container['media_url']; + } + + /** + * Sets media_url + * + * @param string|null $media_url The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * + * @return $this + */ + public function setMediaUrl(?string $media_url): static + { + if (is_null($media_url)) { + array_push($this->openAPINullablesSetToNull, 'media_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('media_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['media_url'] = $media_url; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets end_time + * + * @return \DateTime|null + */ + public function getEndTime(): ?\DateTime + { + return $this->container['end_time']; + } + + /** + * Sets end_time + * + * @param \DateTime|null $end_time The time that the recording ended in ISO-8601 format + * + * @return $this + */ + public function setEndTime(?\DateTime $end_time): static + { + if (is_null($end_time)) { + throw new InvalidArgumentException('non-nullable end_time cannot be null'); + } + $this->container['end_time'] = $end_time; + + return $this; + } + + /** + * Gets duration + * + * @return string|null + */ + public function getDuration(): ?string + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param string|null $duration The duration of the recording in ISO-8601 format + * + * @return $this + */ + public function setDuration(?string $duration): static + { + if (is_null($duration)) { + throw new InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets file_format + * + * @return \Bandwidth\Model\FileFormatEnum|null + */ + public function getFileFormat(): ?\Bandwidth\Model\FileFormatEnum + { + return $this->container['file_format']; + } + + /** + * Sets file_format + * + * @param \Bandwidth\Model\FileFormatEnum|null $file_format file_format + * + * @return $this + */ + public function setFileFormat(?\Bandwidth\Model\FileFormatEnum $file_format): static + { + if (is_null($file_format)) { + throw new InvalidArgumentException('non-nullable file_format cannot be null'); + } + $this->container['file_format'] = $file_format; + + return $this; + } + + /** + * Gets channels + * + * @return int|null + */ + public function getChannels(): ?int + { + return $this->container['channels']; + } + + /** + * Sets channels + * + * @param int|null $channels Always `1` for conference recordings; multi-channel recordings are not supported on conferences. + * + * @return $this + */ + public function setChannels(?int $channels): static + { + if (is_null($channels)) { + throw new InvalidArgumentException('non-nullable channels cannot be null'); + } + $this->container['channels'] = $channels; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status 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 $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets transfer_caller_id + * + * @return string|null + */ + public function getTransferCallerId(): ?string + { + return $this->container['transfer_caller_id']; + } + + /** + * Sets transfer_caller_id + * + * @param string|null $transfer_caller_id The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferCallerId(?string $transfer_caller_id): static + { + if (is_null($transfer_caller_id)) { + throw new InvalidArgumentException('non-nullable transfer_caller_id cannot be null'); + } + $this->container['transfer_caller_id'] = $transfer_caller_id; + + return $this; + } + + /** + * Gets transfer_to + * + * @return string|null + */ + public function getTransferTo(): ?string + { + return $this->container['transfer_to']; + } + + /** + * Sets transfer_to + * + * @param string|null $transfer_to The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferTo(?string $transfer_to): static + { + if (is_null($transfer_to)) { + throw new InvalidArgumentException('non-nullable transfer_to cannot be null'); + } + $this->container['transfer_to'] = $transfer_to; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RecordingCompleteCallback.php b/src/Model/RecordingCompleteCallback.php new file mode 100644 index 0000000..774f8e6 --- /dev/null +++ b/src/Model/RecordingCompleteCallback.php @@ -0,0 +1,1127 @@ + + */ +class RecordingCompleteCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'recordingCompleteCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'parent_call_id' => 'string', + 'recording_id' => 'string', + 'media_url' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'end_time' => '\DateTime', + 'duration' => 'string', + 'file_format' => '\Bandwidth\Model\FileFormatEnum', + 'channels' => 'int', + 'tag' => 'string', + 'transfer_caller_id' => 'string', + 'transfer_to' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'parent_call_id' => null, + 'recording_id' => null, + 'media_url' => 'uri', + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'end_time' => 'date-time', + 'duration' => null, + 'file_format' => null, + 'channels' => 'int32', + 'tag' => null, + 'transfer_caller_id' => null, + 'transfer_to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'parent_call_id' => false, + 'recording_id' => false, + 'media_url' => true, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'end_time' => false, + 'duration' => false, + 'file_format' => false, + 'channels' => false, + 'tag' => true, + 'transfer_caller_id' => false, + 'transfer_to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'parent_call_id' => 'parentCallId', + 'recording_id' => 'recordingId', + 'media_url' => 'mediaUrl', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'end_time' => 'endTime', + 'duration' => 'duration', + 'file_format' => 'fileFormat', + 'channels' => 'channels', + 'tag' => 'tag', + 'transfer_caller_id' => 'transferCallerId', + 'transfer_to' => 'transferTo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'parent_call_id' => 'setParentCallId', + 'recording_id' => 'setRecordingId', + 'media_url' => 'setMediaUrl', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'end_time' => 'setEndTime', + 'duration' => 'setDuration', + 'file_format' => 'setFileFormat', + 'channels' => 'setChannels', + 'tag' => 'setTag', + 'transfer_caller_id' => 'setTransferCallerId', + 'transfer_to' => 'setTransferTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'parent_call_id' => 'getParentCallId', + 'recording_id' => 'getRecordingId', + 'media_url' => 'getMediaUrl', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'end_time' => 'getEndTime', + 'duration' => 'getDuration', + 'file_format' => 'getFileFormat', + 'channels' => 'getChannels', + 'tag' => 'getTag', + 'transfer_caller_id' => 'getTransferCallerId', + 'transfer_to' => 'getTransferTo' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('parent_call_id', $data ?? [], null); + $this->setIfExists('recording_id', $data ?? [], null); + $this->setIfExists('media_url', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('file_format', $data ?? [], null); + $this->setIfExists('channels', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('transfer_caller_id', $data ?? [], null); + $this->setIfExists('transfer_to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets parent_call_id + * + * @return string|null + */ + public function getParentCallId(): ?string + { + return $this->container['parent_call_id']; + } + + /** + * Sets parent_call_id + * + * @param string|null $parent_call_id (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. + * + * @return $this + */ + public function setParentCallId(?string $parent_call_id): static + { + if (is_null($parent_call_id)) { + throw new InvalidArgumentException('non-nullable parent_call_id cannot be null'); + } + $this->container['parent_call_id'] = $parent_call_id; + + return $this; + } + + /** + * Gets recording_id + * + * @return string|null + */ + public function getRecordingId(): ?string + { + return $this->container['recording_id']; + } + + /** + * Sets recording_id + * + * @param string|null $recording_id The unique ID of this recording + * + * @return $this + */ + public function setRecordingId(?string $recording_id): static + { + if (is_null($recording_id)) { + throw new InvalidArgumentException('non-nullable recording_id cannot be null'); + } + $this->container['recording_id'] = $recording_id; + + return $this; + } + + /** + * Gets media_url + * + * @return string|null + */ + public function getMediaUrl(): ?string + { + return $this->container['media_url']; + } + + /** + * Sets media_url + * + * @param string|null $media_url The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * + * @return $this + */ + public function setMediaUrl(?string $media_url): static + { + if (is_null($media_url)) { + array_push($this->openAPINullablesSetToNull, 'media_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('media_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['media_url'] = $media_url; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets end_time + * + * @return \DateTime|null + */ + public function getEndTime(): ?\DateTime + { + return $this->container['end_time']; + } + + /** + * Sets end_time + * + * @param \DateTime|null $end_time The time that the recording ended in ISO-8601 format + * + * @return $this + */ + public function setEndTime(?\DateTime $end_time): static + { + if (is_null($end_time)) { + throw new InvalidArgumentException('non-nullable end_time cannot be null'); + } + $this->container['end_time'] = $end_time; + + return $this; + } + + /** + * Gets duration + * + * @return string|null + */ + public function getDuration(): ?string + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param string|null $duration The duration of the recording in ISO-8601 format + * + * @return $this + */ + public function setDuration(?string $duration): static + { + if (is_null($duration)) { + throw new InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets file_format + * + * @return \Bandwidth\Model\FileFormatEnum|null + */ + public function getFileFormat(): ?\Bandwidth\Model\FileFormatEnum + { + return $this->container['file_format']; + } + + /** + * Sets file_format + * + * @param \Bandwidth\Model\FileFormatEnum|null $file_format file_format + * + * @return $this + */ + public function setFileFormat(?\Bandwidth\Model\FileFormatEnum $file_format): static + { + if (is_null($file_format)) { + throw new InvalidArgumentException('non-nullable file_format cannot be null'); + } + $this->container['file_format'] = $file_format; + + return $this; + } + + /** + * Gets channels + * + * @return int|null + */ + public function getChannels(): ?int + { + return $this->container['channels']; + } + + /** + * Sets channels + * + * @param int|null $channels Always `1` for conference recordings; multi-channel recordings are not supported on conferences. + * + * @return $this + */ + public function setChannels(?int $channels): static + { + if (is_null($channels)) { + throw new InvalidArgumentException('non-nullable channels cannot be null'); + } + $this->container['channels'] = $channels; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets transfer_caller_id + * + * @return string|null + */ + public function getTransferCallerId(): ?string + { + return $this->container['transfer_caller_id']; + } + + /** + * Sets transfer_caller_id + * + * @param string|null $transfer_caller_id The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferCallerId(?string $transfer_caller_id): static + { + if (is_null($transfer_caller_id)) { + throw new InvalidArgumentException('non-nullable transfer_caller_id cannot be null'); + } + $this->container['transfer_caller_id'] = $transfer_caller_id; + + return $this; + } + + /** + * Gets transfer_to + * + * @return string|null + */ + public function getTransferTo(): ?string + { + return $this->container['transfer_to']; + } + + /** + * Sets transfer_to + * + * @param string|null $transfer_to The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferTo(?string $transfer_to): static + { + if (is_null($transfer_to)) { + throw new InvalidArgumentException('non-nullable transfer_to cannot be null'); + } + $this->container['transfer_to'] = $transfer_to; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RecordingStateEnum.php b/src/Model/RecordingStateEnum.php new file mode 100644 index 0000000..2215ba6 --- /dev/null +++ b/src/Model/RecordingStateEnum.php @@ -0,0 +1,46 @@ + + */ +class RecordingTranscriptionClip implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'recordingTranscriptionClip'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'speaker' => 'int', + 'text' => 'string', + 'confidence' => 'float', + 'start_time_seconds' => 'float', + 'end_time_seconds' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'speaker' => null, + 'text' => null, + 'confidence' => 'double', + 'start_time_seconds' => 'double', + 'end_time_seconds' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'speaker' => false, + 'text' => false, + 'confidence' => false, + 'start_time_seconds' => false, + 'end_time_seconds' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'speaker' => 'speaker', + 'text' => 'text', + 'confidence' => 'confidence', + 'start_time_seconds' => 'startTimeSeconds', + 'end_time_seconds' => 'endTimeSeconds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'speaker' => 'setSpeaker', + 'text' => 'setText', + 'confidence' => 'setConfidence', + 'start_time_seconds' => 'setStartTimeSeconds', + 'end_time_seconds' => 'setEndTimeSeconds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'speaker' => 'getSpeaker', + 'text' => 'getText', + 'confidence' => 'getConfidence', + 'start_time_seconds' => 'getStartTimeSeconds', + 'end_time_seconds' => 'getEndTimeSeconds' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('speaker', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('confidence', $data ?? [], null); + $this->setIfExists('start_time_seconds', $data ?? [], null); + $this->setIfExists('end_time_seconds', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['confidence']) && ($this->container['confidence'] > 1)) { + $invalidProperties[] = "invalid value for 'confidence', must be smaller than or equal to 1."; + } + + if (!is_null($this->container['confidence']) && ($this->container['confidence'] < 0)) { + $invalidProperties[] = "invalid value for 'confidence', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets speaker + * + * @return int|null + */ + public function getSpeaker(): ?int + { + return $this->container['speaker']; + } + + /** + * Sets speaker + * + * @param int|null $speaker Zero-based index identifying the speaker. + * + * @return $this + */ + public function setSpeaker(?int $speaker): static + { + if (is_null($speaker)) { + throw new InvalidArgumentException('non-nullable speaker cannot be null'); + } + $this->container['speaker'] = $speaker; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText(): ?string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text The transcribed text of this clip. + * + * @return $this + */ + public function setText(?string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets confidence + * + * @return float|null + */ + public function getConfidence(): ?float + { + return $this->container['confidence']; + } + + /** + * Sets confidence + * + * @param float|null $confidence How confident the transcription engine was in transcribing this clip (from `0.0` to `1.0`). + * + * @return $this + */ + public function setConfidence(?float $confidence): static + { + if (is_null($confidence)) { + throw new InvalidArgumentException('non-nullable confidence cannot be null'); + } + if (($confidence > 1)) { + throw new InvalidArgumentException('invalid value for $confidence when calling RecordingTranscriptionClip., must be smaller than or equal to 1.'); + } + if (($confidence < 0)) { + throw new InvalidArgumentException('invalid value for $confidence when calling RecordingTranscriptionClip., must be bigger than or equal to 0.'); + } + + $this->container['confidence'] = $confidence; + + return $this; + } + + /** + * Gets start_time_seconds + * + * @return float|null + */ + public function getStartTimeSeconds(): ?float + { + return $this->container['start_time_seconds']; + } + + /** + * Sets start_time_seconds + * + * @param float|null $start_time_seconds The start time of this clip within the recording, in seconds. + * + * @return $this + */ + public function setStartTimeSeconds(?float $start_time_seconds): static + { + if (is_null($start_time_seconds)) { + throw new InvalidArgumentException('non-nullable start_time_seconds cannot be null'); + } + $this->container['start_time_seconds'] = $start_time_seconds; + + return $this; + } + + /** + * Gets end_time_seconds + * + * @return float|null + */ + public function getEndTimeSeconds(): ?float + { + return $this->container['end_time_seconds']; + } + + /** + * Sets end_time_seconds + * + * @param float|null $end_time_seconds The end time of this clip within the recording, in seconds. + * + * @return $this + */ + public function setEndTimeSeconds(?float $end_time_seconds): static + { + if (is_null($end_time_seconds)) { + throw new InvalidArgumentException('non-nullable end_time_seconds cannot be null'); + } + $this->container['end_time_seconds'] = $end_time_seconds; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RecordingTranscriptionMetadata.php b/src/Model/RecordingTranscriptionMetadata.php new file mode 100644 index 0000000..9eafcda --- /dev/null +++ b/src/Model/RecordingTranscriptionMetadata.php @@ -0,0 +1,487 @@ + + */ +class RecordingTranscriptionMetadata implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'recordingTranscriptionMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'status' => 'string', + 'completed_time' => '\DateTime', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'status' => null, + 'completed_time' => 'date-time', + 'url' => 'uri' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'status' => false, + 'completed_time' => false, + 'url' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'status' => 'status', + 'completed_time' => 'completedTime', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'status' => 'setStatus', + 'completed_time' => 'setCompletedTime', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'status' => 'getStatus', + 'completed_time' => 'getCompletedTime', + 'url' => 'getUrl' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('completed_time', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The unique transcription ID + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status 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 $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets completed_time + * + * @return \DateTime|null + */ + public function getCompletedTime(): ?\DateTime + { + return $this->container['completed_time']; + } + + /** + * Sets completed_time + * + * @param \DateTime|null $completed_time The time that the transcription was completed + * + * @return $this + */ + public function setCompletedTime(?\DateTime $completed_time): static + { + if (is_null($completed_time)) { + throw new InvalidArgumentException('non-nullable completed_time cannot be null'); + } + $this->container['completed_time'] = $completed_time; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl(): ?string + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The URL of the [transcription](#operation/getCallTranscription) + * + * @return $this + */ + public function setUrl(?string $url): static + { + if (is_null($url)) { + throw new InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RecordingTranscriptions.php b/src/Model/RecordingTranscriptions.php new file mode 100644 index 0000000..7e9fa6b --- /dev/null +++ b/src/Model/RecordingTranscriptions.php @@ -0,0 +1,418 @@ + + */ +class RecordingTranscriptions implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'recordingTranscriptions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'transcripts' => '\Bandwidth\Model\Transcription[]', + 'clips' => '\Bandwidth\Model\RecordingTranscriptionClip[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'transcripts' => null, + 'clips' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'transcripts' => false, + 'clips' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'transcripts' => 'transcripts', + 'clips' => 'clips' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'transcripts' => 'setTranscripts', + 'clips' => 'setClips' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'transcripts' => 'getTranscripts', + 'clips' => 'getClips' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('transcripts', $data ?? [], null); + $this->setIfExists('clips', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets transcripts + * + * @return \Bandwidth\Model\Transcription[]|null + */ + public function getTranscripts(): ?array + { + return $this->container['transcripts']; + } + + /** + * Sets transcripts + * + * @param \Bandwidth\Model\Transcription[]|null $transcripts transcripts + * + * @return $this + */ + public function setTranscripts(?array $transcripts): static + { + if (is_null($transcripts)) { + throw new InvalidArgumentException('non-nullable transcripts cannot be null'); + } + $this->container['transcripts'] = $transcripts; + + return $this; + } + + /** + * Gets clips + * + * @return \Bandwidth\Model\RecordingTranscriptionClip[]|null + */ + public function getClips(): ?array + { + return $this->container['clips']; + } + + /** + * Sets clips + * + * @param \Bandwidth\Model\RecordingTranscriptionClip[]|null $clips A list of individual speech clips with speaker, timing, and confidence information. + * + * @return $this + */ + public function setClips(?array $clips): static + { + if (is_null($clips)) { + throw new InvalidArgumentException('non-nullable clips cannot be null'); + } + $this->container['clips'] = $clips; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RedirectCallback.php b/src/Model/RedirectCallback.php new file mode 100644 index 0000000..602c5e3 --- /dev/null +++ b/src/Model/RedirectCallback.php @@ -0,0 +1,916 @@ + + */ +class RedirectCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'redirectCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'parent_call_id' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'tag' => 'string', + 'transfer_caller_id' => 'string', + 'transfer_to' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'parent_call_id' => null, + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'tag' => null, + 'transfer_caller_id' => null, + 'transfer_to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'parent_call_id' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'tag' => true, + 'transfer_caller_id' => false, + 'transfer_to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'parent_call_id' => 'parentCallId', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'tag' => 'tag', + 'transfer_caller_id' => 'transferCallerId', + 'transfer_to' => 'transferTo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'parent_call_id' => 'setParentCallId', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'tag' => 'setTag', + 'transfer_caller_id' => 'setTransferCallerId', + 'transfer_to' => 'setTransferTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'parent_call_id' => 'getParentCallId', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'tag' => 'getTag', + 'transfer_caller_id' => 'getTransferCallerId', + 'transfer_to' => 'getTransferTo' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('parent_call_id', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('transfer_caller_id', $data ?? [], null); + $this->setIfExists('transfer_to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets parent_call_id + * + * @return string|null + */ + public function getParentCallId(): ?string + { + return $this->container['parent_call_id']; + } + + /** + * Sets parent_call_id + * + * @param string|null $parent_call_id (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. + * + * @return $this + */ + public function setParentCallId(?string $parent_call_id): static + { + if (is_null($parent_call_id)) { + throw new InvalidArgumentException('non-nullable parent_call_id cannot be null'); + } + $this->container['parent_call_id'] = $parent_call_id; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets transfer_caller_id + * + * @return string|null + */ + public function getTransferCallerId(): ?string + { + return $this->container['transfer_caller_id']; + } + + /** + * Sets transfer_caller_id + * + * @param string|null $transfer_caller_id The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferCallerId(?string $transfer_caller_id): static + { + if (is_null($transfer_caller_id)) { + throw new InvalidArgumentException('non-nullable transfer_caller_id cannot be null'); + } + $this->container['transfer_caller_id'] = $transfer_caller_id; + + return $this; + } + + /** + * Gets transfer_to + * + * @return string|null + */ + public function getTransferTo(): ?string + { + return $this->container['transfer_to']; + } + + /** + * Sets transfer_to + * + * @param string|null $transfer_to The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferTo(?string $transfer_to): static + { + if (is_null($transfer_to)) { + throw new InvalidArgumentException('non-nullable transfer_to cannot be null'); + } + $this->container['transfer_to'] = $transfer_to; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RedirectMethodEnum.php b/src/Model/RedirectMethodEnum.php new file mode 100644 index 0000000..724269b --- /dev/null +++ b/src/Model/RedirectMethodEnum.php @@ -0,0 +1,46 @@ + + */ +class SipConnectionMetadata implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'sipConnectionMetadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'ip_address' => 'string', + 'port' => 'int', + 'credentials' => '\Bandwidth\Model\SipCredentials', + 'uui_header' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'ip_address' => 'ipv4', + 'port' => null, + 'credentials' => null, + 'uui_header' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'ip_address' => false, + 'port' => false, + 'credentials' => false, + 'uui_header' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'ip_address' => 'ipAddress', + 'port' => 'port', + 'credentials' => 'credentials', + 'uui_header' => 'uuiHeader' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'ip_address' => 'setIpAddress', + 'port' => 'setPort', + 'credentials' => 'setCredentials', + 'uui_header' => 'setUuiHeader' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'ip_address' => 'getIpAddress', + 'port' => 'getPort', + 'credentials' => 'getCredentials', + 'uui_header' => 'getUuiHeader' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('ip_address', $data ?? [], null); + $this->setIfExists('port', $data ?? [], null); + $this->setIfExists('credentials', $data ?? [], null); + $this->setIfExists('uui_header', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ip_address + * + * @return string|null + */ + public function getIpAddress(): ?string + { + return $this->container['ip_address']; + } + + /** + * Sets ip_address + * + * @param string|null $ip_address The IP address of the SIP connection. + * + * @return $this + */ + public function setIpAddress(?string $ip_address): static + { + if (is_null($ip_address)) { + throw new InvalidArgumentException('non-nullable ip_address cannot be null'); + } + $this->container['ip_address'] = $ip_address; + + return $this; + } + + /** + * Gets port + * + * @return int|null + */ + public function getPort(): ?int + { + return $this->container['port']; + } + + /** + * Sets port + * + * @param int|null $port The port of the SIP connection. + * + * @return $this + */ + public function setPort(?int $port): static + { + if (is_null($port)) { + throw new InvalidArgumentException('non-nullable port cannot be null'); + } + $this->container['port'] = $port; + + return $this; + } + + /** + * Gets credentials + * + * @return \Bandwidth\Model\SipCredentials|null + */ + public function getCredentials(): ?\Bandwidth\Model\SipCredentials + { + return $this->container['credentials']; + } + + /** + * Sets credentials + * + * @param \Bandwidth\Model\SipCredentials|null $credentials credentials + * + * @return $this + */ + public function setCredentials(?\Bandwidth\Model\SipCredentials $credentials): static + { + if (is_null($credentials)) { + throw new InvalidArgumentException('non-nullable credentials cannot be null'); + } + $this->container['credentials'] = $credentials; + + return $this; + } + + /** + * Gets uui_header + * + * @return string|null + */ + public function getUuiHeader(): ?string + { + return $this->container['uui_header']; + } + + /** + * Sets uui_header + * + * @param string|null $uui_header The User-to-User Information header for the SIP connection. + * + * @return $this + */ + public function setUuiHeader(?string $uui_header): static + { + if (is_null($uui_header)) { + throw new InvalidArgumentException('non-nullable uui_header cannot be null'); + } + $this->container['uui_header'] = $uui_header; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SipCredentials.php b/src/Model/SipCredentials.php new file mode 100644 index 0000000..4818b04 --- /dev/null +++ b/src/Model/SipCredentials.php @@ -0,0 +1,418 @@ + + */ +class SipCredentials implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'sipCredentials'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'username' => 'string', + 'password' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'username' => null, + 'password' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'username' => false, + 'password' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'username' => 'username', + 'password' => 'password' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'username' => 'setUsername', + 'password' => 'setPassword' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'username' => 'getUsername', + 'password' => 'getPassword' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets username + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username The username for the SIP connection. + * + * @return $this + */ + public function setUsername(?string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password The password for the SIP connection. + * + * @return $this + */ + public function setPassword(?string $password): static + { + if (is_null($password)) { + throw new InvalidArgumentException('non-nullable password cannot be null'); + } + $this->container['password'] = $password; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SmsMessageContent.php b/src/Model/SmsMessageContent.php new file mode 100644 index 0000000..26bd4f5 --- /dev/null +++ b/src/Model/SmsMessageContent.php @@ -0,0 +1,395 @@ + + */ +class SmsMessageContent implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'smsMessageContent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'text' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'text' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'text' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'text' => 'text' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'text' => 'setText' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'text' => 'getText' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('text', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + if ((mb_strlen($this->container['text']) > 2048)) { + $invalidProperties[] = "invalid value for 'text', the character length must be smaller than or equal to 2048."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets text + * + * @return string + */ + public function getText(): string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text The contents of the text message. Must be 2048 characters or less. + * + * @return $this + */ + public function setText(string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + if ((mb_strlen($text) > 2048)) { + throw new InvalidArgumentException('invalid length for $text when calling SmsMessageContent., must be smaller than or equal to 2048.'); + } + + $this->container['text'] = $text; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/StandaloneCardOrientationEnum.php b/src/Model/StandaloneCardOrientationEnum.php new file mode 100644 index 0000000..5494299 --- /dev/null +++ b/src/Model/StandaloneCardOrientationEnum.php @@ -0,0 +1,45 @@ + + */ +class StatusCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'statusCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'time' => '\DateTime', + 'event_time' => '\DateTime', + 'type' => '\Bandwidth\Model\StatusCallbackTypeEnum', + 'to' => 'string', + 'description' => 'string', + 'message' => '\Bandwidth\Model\StatusCallbackMessage', + 'error_code' => 'int', + 'carrier_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'time' => 'date-time', + 'event_time' => 'date-time', + 'type' => null, + 'to' => null, + 'description' => null, + 'message' => null, + 'error_code' => null, + 'carrier_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'time' => false, + 'event_time' => false, + 'type' => false, + 'to' => false, + 'description' => false, + 'message' => false, + 'error_code' => false, + 'carrier_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'time' => 'time', + 'event_time' => 'eventTime', + 'type' => 'type', + 'to' => 'to', + 'description' => 'description', + 'message' => 'message', + 'error_code' => 'errorCode', + 'carrier_name' => 'carrierName' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'time' => 'setTime', + 'event_time' => 'setEventTime', + 'type' => 'setType', + 'to' => 'setTo', + 'description' => 'setDescription', + 'message' => 'setMessage', + 'error_code' => 'setErrorCode', + 'carrier_name' => 'setCarrierName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'time' => 'getTime', + 'event_time' => 'getEventTime', + 'type' => 'getType', + 'to' => 'getTo', + 'description' => 'getDescription', + 'message' => 'getMessage', + 'error_code' => 'getErrorCode', + 'carrier_name' => 'getCarrierName' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('time', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('error_code', $data ?? [], null); + $this->setIfExists('carrier_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['time'] === null) { + $invalidProperties[] = "'time' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['description'] === null) { + $invalidProperties[] = "'description' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets time + * + * @return \DateTime + */ + public function getTime(): \DateTime + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param \DateTime $time time + * + * @return $this + */ + public function setTime(\DateTime $time): static + { + if (is_null($time)) { + throw new InvalidArgumentException('non-nullable time cannot be null'); + } + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time Represents the time at which the message was read, for `message-read` callbacks. + * + * @return $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets type + * + * @return \Bandwidth\Model\StatusCallbackTypeEnum + */ + public function getType(): \Bandwidth\Model\StatusCallbackTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\StatusCallbackTypeEnum $type type + * + * @return $this + */ + public function setType(\Bandwidth\Model\StatusCallbackTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets to + * + * @return string + */ + public function getTo(): string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number. + * + * @return $this + */ + public function setTo(string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets description + * + * @return string + */ + public function getDescription(): string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description A detailed description of the event described by the callback. + * + * @return $this + */ + public function setDescription(string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets message + * + * @return \Bandwidth\Model\StatusCallbackMessage + */ + public function getMessage(): \Bandwidth\Model\StatusCallbackMessage + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param \Bandwidth\Model\StatusCallbackMessage $message message + * + * @return $this + */ + public function setMessage(\Bandwidth\Model\StatusCallbackMessage $message): static + { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets error_code + * + * @return int|null + */ + public function getErrorCode(): ?int + { + return $this->container['error_code']; + } + + /** + * Sets error_code + * + * @param int|null $error_code Optional error code, applicable only when type is `message-failed`. + * + * @return $this + */ + public function setErrorCode(?int $error_code): static + { + if (is_null($error_code)) { + throw new InvalidArgumentException('non-nullable error_code cannot be null'); + } + $this->container['error_code'] = $error_code; + + return $this; + } + + /** + * Gets carrier_name + * + * @return string|null + */ + public function getCarrierName(): ?string + { + return $this->container['carrier_name']; + } + + /** + * Sets carrier_name + * + * @param string|null $carrier_name The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. + * + * @return $this + */ + public function setCarrierName(?string $carrier_name): static + { + if (is_null($carrier_name)) { + throw new InvalidArgumentException('non-nullable carrier_name cannot be null'); + } + $this->container['carrier_name'] = $carrier_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/StatusCallbackMessage.php b/src/Model/StatusCallbackMessage.php new file mode 100644 index 0000000..1c4ac05 --- /dev/null +++ b/src/Model/StatusCallbackMessage.php @@ -0,0 +1,818 @@ + + */ +class StatusCallbackMessage implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'statusCallbackMessage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'owner' => 'string', + 'application_id' => 'string', + 'time' => '\DateTime', + 'segment_count' => 'int', + 'direction' => '\Bandwidth\Model\MessageDirectionEnum', + 'to' => 'string[]', + 'from' => 'string', + 'text' => 'string', + 'tag' => 'string', + 'media' => 'string[]', + 'priority' => '\Bandwidth\Model\PriorityEnum', + 'channel' => '\Bandwidth\Model\MultiChannelMessageChannelEnum' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'owner' => null, + 'application_id' => null, + 'time' => 'date-time', + 'segment_count' => null, + 'direction' => null, + 'to' => null, + 'from' => null, + 'text' => null, + 'tag' => null, + 'media' => 'uri', + 'priority' => null, + 'channel' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'owner' => false, + 'application_id' => false, + 'time' => false, + 'segment_count' => false, + 'direction' => false, + 'to' => false, + 'from' => false, + 'text' => false, + 'tag' => false, + 'media' => false, + 'priority' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'owner' => 'owner', + 'application_id' => 'applicationId', + 'time' => 'time', + 'segment_count' => 'segmentCount', + 'direction' => 'direction', + 'to' => 'to', + 'from' => 'from', + 'text' => 'text', + 'tag' => 'tag', + 'media' => 'media', + 'priority' => 'priority', + 'channel' => 'channel' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'owner' => 'setOwner', + 'application_id' => 'setApplicationId', + 'time' => 'setTime', + 'segment_count' => 'setSegmentCount', + 'direction' => 'setDirection', + 'to' => 'setTo', + 'from' => 'setFrom', + 'text' => 'setText', + 'tag' => 'setTag', + 'media' => 'setMedia', + 'priority' => 'setPriority', + 'channel' => 'setChannel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'owner' => 'getOwner', + 'application_id' => 'getApplicationId', + 'time' => 'getTime', + 'segment_count' => 'getSegmentCount', + 'direction' => 'getDirection', + 'to' => 'getTo', + 'from' => 'getFrom', + 'text' => 'getText', + 'tag' => 'getTag', + 'media' => 'getMedia', + 'priority' => 'getPriority', + 'channel' => 'getChannel' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('owner', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('time', $data ?? [], null); + $this->setIfExists('segment_count', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('media', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['owner'] === null) { + $invalidProperties[] = "'owner' can't be null"; + } + if ($this->container['application_id'] === null) { + $invalidProperties[] = "'application_id' can't be null"; + } + if ($this->container['time'] === null) { + $invalidProperties[] = "'time' can't be null"; + } + if ($this->container['segment_count'] === null) { + $invalidProperties[] = "'segment_count' can't be null"; + } + if ($this->container['direction'] === null) { + $invalidProperties[] = "'direction' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId(): string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id A unique identifier of the message. + * + * @return $this + */ + public function setId(string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets owner + * + * @return string + */ + public function getOwner(): string + { + return $this->container['owner']; + } + + /** + * Sets owner + * + * @param string $owner The Bandwidth phone number or alphanumeric identifier associated with the message. + * + * @return $this + */ + public function setOwner(string $owner): static + { + if (is_null($owner)) { + throw new InvalidArgumentException('non-nullable owner cannot be null'); + } + $this->container['owner'] = $owner; + + return $this; + } + + /** + * Gets application_id + * + * @return string + */ + public function getApplicationId(): string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string $application_id The ID of the Application your from number or senderId is associated with in the Bandwidth App. + * + * @return $this + */ + public function setApplicationId(string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets time + * + * @return \DateTime + */ + public function getTime(): \DateTime + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param \DateTime $time time + * + * @return $this + */ + public function setTime(\DateTime $time): static + { + if (is_null($time)) { + throw new InvalidArgumentException('non-nullable time cannot be null'); + } + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets segment_count + * + * @return int + */ + public function getSegmentCount(): int + { + return $this->container['segment_count']; + } + + /** + * Sets segment_count + * + * @param int $segment_count The number of segments the user's message is broken into before sending over carrier networks. + * + * @return $this + */ + public function setSegmentCount(int $segment_count): static + { + if (is_null($segment_count)) { + throw new InvalidArgumentException('non-nullable segment_count cannot be null'); + } + $this->container['segment_count'] = $segment_count; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\MessageDirectionEnum + */ + public function getDirection(): \Bandwidth\Model\MessageDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\MessageDirectionEnum $direction direction + * + * @return $this + */ + public function setDirection(\Bandwidth\Model\MessageDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets to + * + * @return string[] + */ + public function getTo(): array + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string[] $to The phone number recipients of the message. + * + * @return $this + */ + public function setTo(array $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets from + * + * @return string + */ + public function getFrom(): string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string $from The Bandwidth phone number or alphanumeric identifier the message was sent from. + * + * @return $this + */ + public function setFrom(string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText(): ?string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text text + * + * @return $this + */ + public function setText(?string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag A custom string that will be included in callback events of the message. Max 1024 characters. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + throw new InvalidArgumentException('non-nullable tag cannot be null'); + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets media + * + * @return string[]|null + */ + public function getMedia(): ?array + { + return $this->container['media']; + } + + /** + * Sets media + * + * @param string[]|null $media Optional media, not applicable for sms + * + * @return $this + */ + public function setMedia(?array $media): static + { + if (is_null($media)) { + throw new InvalidArgumentException('non-nullable media cannot be null'); + } + $this->container['media'] = $media; + + return $this; + } + + /** + * Gets priority + * + * @return \Bandwidth\Model\PriorityEnum|null + */ + public function getPriority(): ?\Bandwidth\Model\PriorityEnum + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param \Bandwidth\Model\PriorityEnum|null $priority priority + * + * @return $this + */ + public function setPriority(?\Bandwidth\Model\PriorityEnum $priority): static + { + if (is_null($priority)) { + throw new InvalidArgumentException('non-nullable priority cannot be null'); + } + $this->container['priority'] = $priority; + + return $this; + } + + /** + * Gets channel + * + * @return \Bandwidth\Model\MultiChannelMessageChannelEnum|null + */ + public function getChannel(): ?\Bandwidth\Model\MultiChannelMessageChannelEnum + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Bandwidth\Model\MultiChannelMessageChannelEnum|null $channel channel + * + * @return $this + */ + public function setChannel(?\Bandwidth\Model\MultiChannelMessageChannelEnum $channel): static + { + if (is_null($channel)) { + throw new InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/StatusCallbackTypeEnum.php b/src/Model/StatusCallbackTypeEnum.php new file mode 100644 index 0000000..20ead8e --- /dev/null +++ b/src/Model/StatusCallbackTypeEnum.php @@ -0,0 +1,52 @@ + + */ +class StirShaken implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'stirShaken'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'verstat' => 'string', + 'attestation_indicator' => 'string', + 'originating_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'verstat' => null, + 'attestation_indicator' => null, + 'originating_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'verstat' => false, + 'attestation_indicator' => false, + 'originating_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'verstat' => 'verstat', + 'attestation_indicator' => 'attestationIndicator', + 'originating_id' => 'originatingId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'verstat' => 'setVerstat', + 'attestation_indicator' => 'setAttestationIndicator', + 'originating_id' => 'setOriginatingId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'verstat' => 'getVerstat', + 'attestation_indicator' => 'getAttestationIndicator', + 'originating_id' => 'getOriginatingId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('verstat', $data ?? [], null); + $this->setIfExists('attestation_indicator', $data ?? [], null); + $this->setIfExists('originating_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets verstat + * + * @return string|null + */ + public function getVerstat(): ?string + { + return $this->container['verstat']; + } + + /** + * Sets verstat + * + * @param string|null $verstat (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Validation-Passed and TN-Validation-Failed. + * + * @return $this + */ + public function setVerstat(?string $verstat): static + { + if (is_null($verstat)) { + throw new InvalidArgumentException('non-nullable verstat cannot be null'); + } + $this->container['verstat'] = $verstat; + + return $this; + } + + /** + * Gets attestation_indicator + * + * @return string|null + */ + public function getAttestationIndicator(): ?string + { + return $this->container['attestation_indicator']; + } + + /** + * Sets attestation_indicator + * + * @param string|null $attestation_indicator (optional) The attestation level verified by Bandwidth. Possible values are A (full), B (partial) or C (gateway). + * + * @return $this + */ + public function setAttestationIndicator(?string $attestation_indicator): static + { + if (is_null($attestation_indicator)) { + throw new InvalidArgumentException('non-nullable attestation_indicator cannot be null'); + } + $this->container['attestation_indicator'] = $attestation_indicator; + + return $this; + } + + /** + * Gets originating_id + * + * @return string|null + */ + public function getOriginatingId(): ?string + { + return $this->container['originating_id']; + } + + /** + * Sets originating_id + * + * @param string|null $originating_id (optional) A unique origination identifier. + * + * @return $this + */ + public function setOriginatingId(?string $originating_id): static + { + if (is_null($originating_id)) { + throw new InvalidArgumentException('non-nullable originating_id cannot be null'); + } + $this->container['originating_id'] = $originating_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/SyncLookupRequest.php b/src/Model/SyncLookupRequest.php new file mode 100644 index 0000000..e1e136d --- /dev/null +++ b/src/Model/SyncLookupRequest.php @@ -0,0 +1,431 @@ + + */ +class SyncLookupRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'syncLookupRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'phone_numbers' => 'string[]', + 'rcs_agent' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'phone_numbers' => null, + 'rcs_agent' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'phone_numbers' => false, + 'rcs_agent' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'phone_numbers' => 'phoneNumbers', + 'rcs_agent' => 'rcsAgent' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'phone_numbers' => 'setPhoneNumbers', + 'rcs_agent' => 'setRcsAgent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'phone_numbers' => 'getPhoneNumbers', + 'rcs_agent' => 'getRcsAgent' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('phone_numbers', $data ?? [], null); + $this->setIfExists('rcs_agent', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['phone_numbers'] === null) { + $invalidProperties[] = "'phone_numbers' can't be null"; + } + if (!is_null($this->container['rcs_agent']) && !preg_match("/^[A-Za-z0-9_-]{1,40}$/", $this->container['rcs_agent'])) { + $invalidProperties[] = "invalid value for 'rcs_agent', must be conform to the pattern /^[A-Za-z0-9_-]{1,40}$/."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets phone_numbers + * + * @return string[] + */ + public function getPhoneNumbers(): array + { + return $this->container['phone_numbers']; + } + + /** + * Sets phone_numbers + * + * @param string[] $phone_numbers Telephone numbers in E.164 format. + * + * @return $this + */ + public function setPhoneNumbers(array $phone_numbers): static + { + if (is_null($phone_numbers)) { + throw new InvalidArgumentException('non-nullable phone_numbers cannot be null'); + } + + $this->container['phone_numbers'] = $phone_numbers; + + return $this; + } + + /** + * Gets rcs_agent + * + * @return string|null + */ + public function getRcsAgent(): ?string + { + return $this->container['rcs_agent']; + } + + /** + * Sets rcs_agent + * + * @param string|null $rcs_agent Override the default RCS sender/agent ID used when checking RCS capabilities. When provided, this value is used as the `sender` in the RCS capability-check request instead of the account default. Must be 1–40 characters and contain only letters, digits, underscores, or hyphens. + * + * @return $this + */ + public function setRcsAgent(?string $rcs_agent): static + { + if (is_null($rcs_agent)) { + throw new InvalidArgumentException('non-nullable rcs_agent cannot be null'); + } + + if ((!preg_match("/^[A-Za-z0-9_-]{1,40}$/", ObjectSerializer::toString($rcs_agent)))) { + throw new InvalidArgumentException("invalid value for \$rcs_agent when calling SyncLookupRequest., must conform to the pattern /^[A-Za-z0-9_-]{1,40}$/."); + } + + $this->container['rcs_agent'] = $rcs_agent; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TelephoneNumber.php b/src/Model/TelephoneNumber.php new file mode 100644 index 0000000..35562bb --- /dev/null +++ b/src/Model/TelephoneNumber.php @@ -0,0 +1,384 @@ + + */ +class TelephoneNumber implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'telephoneNumber'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'telephone_number' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'telephone_number' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'telephone_number' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'telephone_number' => 'telephoneNumber' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'telephone_number' => 'setTelephoneNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'telephone_number' => 'getTelephoneNumber' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('telephone_number', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets telephone_number + * + * @return string|null + */ + public function getTelephoneNumber(): ?string + { + return $this->container['telephone_number']; + } + + /** + * Sets telephone_number + * + * @param string|null $telephone_number Simple Telephone Number. + * + * @return $this + */ + public function setTelephoneNumber(?string $telephone_number): static + { + if (is_null($telephone_number)) { + throw new InvalidArgumentException('non-nullable telephone_number cannot be null'); + } + $this->container['telephone_number'] = $telephone_number; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TfvBasicAuthentication.php b/src/Model/TfvBasicAuthentication.php new file mode 100644 index 0000000..346bf13 --- /dev/null +++ b/src/Model/TfvBasicAuthentication.php @@ -0,0 +1,440 @@ + + */ +class TfvBasicAuthentication implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tfvBasicAuthentication'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'username' => 'string', + 'password' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'username' => null, + 'password' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'username' => false, + 'password' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'username' => 'username', + 'password' => 'password' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'username' => 'setUsername', + 'password' => 'setPassword' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'username' => 'getUsername', + 'password' => 'getPassword' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['username'] === null) { + $invalidProperties[] = "'username' can't be null"; + } + if ((mb_strlen($this->container['username']) > 100)) { + $invalidProperties[] = "invalid value for 'username', the character length must be smaller than or equal to 100."; + } + + if ($this->container['password'] === null) { + $invalidProperties[] = "'password' can't be null"; + } + if ((mb_strlen($this->container['password']) > 200)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 200."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets username + * + * @return string + */ + public function getUsername(): string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username username + * + * @return $this + */ + public function setUsername(string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + if ((mb_strlen($username) > 100)) { + throw new InvalidArgumentException('invalid length for $username when calling TfvBasicAuthentication., must be smaller than or equal to 100.'); + } + + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password + * + * @return string + */ + public function getPassword(): string + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string $password password + * + * @return $this + */ + public function setPassword(string $password): static + { + if (is_null($password)) { + throw new InvalidArgumentException('non-nullable password cannot be null'); + } + if ((mb_strlen($password) > 200)) { + throw new InvalidArgumentException('invalid length for $password when calling TfvBasicAuthentication., must be smaller than or equal to 200.'); + } + + $this->container['password'] = $password; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TfvCallbackStatusEnum.php b/src/Model/TfvCallbackStatusEnum.php new file mode 100644 index 0000000..741c029 --- /dev/null +++ b/src/Model/TfvCallbackStatusEnum.php @@ -0,0 +1,45 @@ + + */ +class TfvError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tfvError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'description' => 'string', + 'errors' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'description' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'description' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'description' => 'description', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'description' => 'setDescription', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'description' => 'getDescription', + 'errors' => 'getErrors' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType(): ?string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return $this + */ + public function setType(?string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets errors + * + * @return object|null + */ + public function getErrors(): ?object + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param object|null $errors Each key of this errors object refers to a field of the submitted object (using dot notation for nested objects), with the field being a key to an array of one or more errors for that field. + * + * @return $this + */ + public function setErrors(?object $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TfvStatus.php b/src/Model/TfvStatus.php new file mode 100644 index 0000000..9b1dde4 --- /dev/null +++ b/src/Model/TfvStatus.php @@ -0,0 +1,850 @@ + + */ +class TfvStatus implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tfvStatus'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'phone_number' => 'string', + 'status' => '\Bandwidth\Model\TfvStatusEnum', + 'internal_ticket_number' => 'string', + 'decline_reason_description' => 'string', + 'denial_status_code' => 'int', + 'additional_denial_reasons' => '\Bandwidth\Model\AdditionalDenialReason[]', + 'resubmit_allowed' => 'bool', + 'created_date_time' => '\DateTime', + 'modified_date_time' => '\DateTime', + 'submission' => '\Bandwidth\Model\TfvSubmissionInfo', + 'blocked' => 'bool', + 'blocked_reason' => 'string', + 'cv_token' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'phone_number' => null, + 'status' => null, + 'internal_ticket_number' => null, + 'decline_reason_description' => null, + 'denial_status_code' => null, + 'additional_denial_reasons' => null, + 'resubmit_allowed' => null, + 'created_date_time' => 'date-time', + 'modified_date_time' => 'date-time', + 'submission' => null, + 'blocked' => null, + 'blocked_reason' => null, + 'cv_token' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'phone_number' => false, + 'status' => false, + 'internal_ticket_number' => false, + 'decline_reason_description' => false, + 'denial_status_code' => true, + 'additional_denial_reasons' => true, + 'resubmit_allowed' => false, + 'created_date_time' => false, + 'modified_date_time' => false, + 'submission' => false, + 'blocked' => false, + 'blocked_reason' => false, + 'cv_token' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'phone_number' => 'phoneNumber', + 'status' => 'status', + 'internal_ticket_number' => 'internalTicketNumber', + 'decline_reason_description' => 'declineReasonDescription', + 'denial_status_code' => 'denialStatusCode', + 'additional_denial_reasons' => 'additionalDenialReasons', + 'resubmit_allowed' => 'resubmitAllowed', + 'created_date_time' => 'createdDateTime', + 'modified_date_time' => 'modifiedDateTime', + 'submission' => 'submission', + 'blocked' => 'blocked', + 'blocked_reason' => 'blockedReason', + 'cv_token' => 'cvToken' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'phone_number' => 'setPhoneNumber', + 'status' => 'setStatus', + 'internal_ticket_number' => 'setInternalTicketNumber', + 'decline_reason_description' => 'setDeclineReasonDescription', + 'denial_status_code' => 'setDenialStatusCode', + 'additional_denial_reasons' => 'setAdditionalDenialReasons', + 'resubmit_allowed' => 'setResubmitAllowed', + 'created_date_time' => 'setCreatedDateTime', + 'modified_date_time' => 'setModifiedDateTime', + 'submission' => 'setSubmission', + 'blocked' => 'setBlocked', + 'blocked_reason' => 'setBlockedReason', + 'cv_token' => 'setCvToken' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'phone_number' => 'getPhoneNumber', + 'status' => 'getStatus', + 'internal_ticket_number' => 'getInternalTicketNumber', + 'decline_reason_description' => 'getDeclineReasonDescription', + 'denial_status_code' => 'getDenialStatusCode', + 'additional_denial_reasons' => 'getAdditionalDenialReasons', + 'resubmit_allowed' => 'getResubmitAllowed', + 'created_date_time' => 'getCreatedDateTime', + 'modified_date_time' => 'getModifiedDateTime', + 'submission' => 'getSubmission', + 'blocked' => 'getBlocked', + 'blocked_reason' => 'getBlockedReason', + 'cv_token' => 'getCvToken' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('internal_ticket_number', $data ?? [], null); + $this->setIfExists('decline_reason_description', $data ?? [], null); + $this->setIfExists('denial_status_code', $data ?? [], null); + $this->setIfExists('additional_denial_reasons', $data ?? [], null); + $this->setIfExists('resubmit_allowed', $data ?? [], null); + $this->setIfExists('created_date_time', $data ?? [], null); + $this->setIfExists('modified_date_time', $data ?? [], null); + $this->setIfExists('submission', $data ?? [], null); + $this->setIfExists('blocked', $data ?? [], null); + $this->setIfExists('blocked_reason', $data ?? [], null); + $this->setIfExists('cv_token', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) > 12)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be smaller than or equal to 12."; + } + + if (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) < 12)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be bigger than or equal to 12."; + } + + if (!is_null($this->container['phone_number']) && !preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $this->container['phone_number'])) { + $invalidProperties[] = "invalid value for 'phone_number', must be conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."; + } + + if (!is_null($this->container['cv_token']) && (mb_strlen($this->container['cv_token']) > 500)) { + $invalidProperties[] = "invalid value for 'cv_token', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['cv_token']) && (mb_strlen($this->container['cv_token']) < 0)) { + $invalidProperties[] = "invalid value for 'cv_token', the character length must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets phone_number + * + * @return string|null + */ + public function getPhoneNumber(): ?string + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string|null $phone_number Toll-free telephone number in E.164 format. + * + * @return $this + */ + public function setPhoneNumber(?string $phone_number): static + { + if (is_null($phone_number)) { + throw new InvalidArgumentException('non-nullable phone_number cannot be null'); + } + if ((mb_strlen($phone_number) > 12)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling TfvStatus., must be smaller than or equal to 12.'); + } + if ((mb_strlen($phone_number) < 12)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling TfvStatus., must be bigger than or equal to 12.'); + } + if ((!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", ObjectSerializer::toString($phone_number)))) { + throw new InvalidArgumentException("invalid value for \$phone_number when calling TfvStatus., must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets status + * + * @return \Bandwidth\Model\TfvStatusEnum|null + */ + public function getStatus(): ?\Bandwidth\Model\TfvStatusEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\TfvStatusEnum|null $status status + * + * @return $this + */ + public function setStatus(?\Bandwidth\Model\TfvStatusEnum $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets internal_ticket_number + * + * @return string|null + */ + public function getInternalTicketNumber(): ?string + { + return $this->container['internal_ticket_number']; + } + + /** + * Sets internal_ticket_number + * + * @param string|null $internal_ticket_number Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. + * + * @return $this + */ + public function setInternalTicketNumber(?string $internal_ticket_number): static + { + if (is_null($internal_ticket_number)) { + throw new InvalidArgumentException('non-nullable internal_ticket_number cannot be null'); + } + $this->container['internal_ticket_number'] = $internal_ticket_number; + + return $this; + } + + /** + * Gets decline_reason_description + * + * @return string|null + */ + public function getDeclineReasonDescription(): ?string + { + return $this->container['decline_reason_description']; + } + + /** + * Sets decline_reason_description + * + * @param string|null $decline_reason_description Explanation for why a verification request was declined. + * + * @return $this + */ + public function setDeclineReasonDescription(?string $decline_reason_description): static + { + if (is_null($decline_reason_description)) { + throw new InvalidArgumentException('non-nullable decline_reason_description cannot be null'); + } + $this->container['decline_reason_description'] = $decline_reason_description; + + return $this; + } + + /** + * Gets denial_status_code + * + * @return int|null + */ + public function getDenialStatusCode(): ?int + { + return $this->container['denial_status_code']; + } + + /** + * Sets denial_status_code + * + * @param int|null $denial_status_code Reason code for denial. + * + * @return $this + */ + public function setDenialStatusCode(?int $denial_status_code): static + { + if (is_null($denial_status_code)) { + array_push($this->openAPINullablesSetToNull, 'denial_status_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('denial_status_code', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['denial_status_code'] = $denial_status_code; + + return $this; + } + + /** + * Gets additional_denial_reasons + * + * @return \Bandwidth\Model\AdditionalDenialReason[]|null + */ + public function getAdditionalDenialReasons(): ?array + { + return $this->container['additional_denial_reasons']; + } + + /** + * Sets additional_denial_reasons + * + * @param \Bandwidth\Model\AdditionalDenialReason[]|null $additional_denial_reasons An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. + * + * @return $this + */ + public function setAdditionalDenialReasons(?array $additional_denial_reasons): static + { + if (is_null($additional_denial_reasons)) { + array_push($this->openAPINullablesSetToNull, 'additional_denial_reasons'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additional_denial_reasons', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['additional_denial_reasons'] = $additional_denial_reasons; + + return $this; + } + + /** + * Gets resubmit_allowed + * + * @return bool|null + */ + public function getResubmitAllowed(): ?bool + { + return $this->container['resubmit_allowed']; + } + + /** + * Sets resubmit_allowed + * + * @param bool|null $resubmit_allowed Whether a Toll-Free Verification request qualifies for resubmission via PUT. + * + * @return $this + */ + public function setResubmitAllowed(?bool $resubmit_allowed): static + { + if (is_null($resubmit_allowed)) { + throw new InvalidArgumentException('non-nullable resubmit_allowed cannot be null'); + } + $this->container['resubmit_allowed'] = $resubmit_allowed; + + return $this; + } + + /** + * Gets created_date_time + * + * @return \DateTime|null + */ + public function getCreatedDateTime(): ?\DateTime + { + return $this->container['created_date_time']; + } + + /** + * Sets created_date_time + * + * @param \DateTime|null $created_date_time Date and time the verification request was created. + * + * @return $this + */ + public function setCreatedDateTime(?\DateTime $created_date_time): static + { + if (is_null($created_date_time)) { + throw new InvalidArgumentException('non-nullable created_date_time cannot be null'); + } + $this->container['created_date_time'] = $created_date_time; + + return $this; + } + + /** + * Gets modified_date_time + * + * @return \DateTime|null + */ + public function getModifiedDateTime(): ?\DateTime + { + return $this->container['modified_date_time']; + } + + /** + * Sets modified_date_time + * + * @param \DateTime|null $modified_date_time Date and time the verification request was last modified. + * + * @return $this + */ + public function setModifiedDateTime(?\DateTime $modified_date_time): static + { + if (is_null($modified_date_time)) { + throw new InvalidArgumentException('non-nullable modified_date_time cannot be null'); + } + $this->container['modified_date_time'] = $modified_date_time; + + return $this; + } + + /** + * Gets submission + * + * @return \Bandwidth\Model\TfvSubmissionInfo|null + */ + public function getSubmission(): ?\Bandwidth\Model\TfvSubmissionInfo + { + return $this->container['submission']; + } + + /** + * Sets submission + * + * @param \Bandwidth\Model\TfvSubmissionInfo|null $submission submission + * + * @return $this + */ + public function setSubmission(?\Bandwidth\Model\TfvSubmissionInfo $submission): static + { + if (is_null($submission)) { + throw new InvalidArgumentException('non-nullable submission cannot be null'); + } + $this->container['submission'] = $submission; + + return $this; + } + + /** + * Gets blocked + * + * @return bool|null + */ + public function getBlocked(): ?bool + { + return $this->container['blocked']; + } + + /** + * Sets blocked + * + * @param bool|null $blocked Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. + * + * @return $this + */ + public function setBlocked(?bool $blocked): static + { + if (is_null($blocked)) { + throw new InvalidArgumentException('non-nullable blocked cannot be null'); + } + $this->container['blocked'] = $blocked; + + return $this; + } + + /** + * Gets blocked_reason + * + * @return string|null + */ + public function getBlockedReason(): ?string + { + return $this->container['blocked_reason']; + } + + /** + * Sets blocked_reason + * + * @param string|null $blocked_reason The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. + * + * @return $this + */ + public function setBlockedReason(?string $blocked_reason): static + { + if (is_null($blocked_reason)) { + throw new InvalidArgumentException('non-nullable blocked_reason cannot be null'); + } + $this->container['blocked_reason'] = $blocked_reason; + + return $this; + } + + /** + * Gets cv_token + * + * @return string|null + */ + public function getCvToken(): ?string + { + return $this->container['cv_token']; + } + + /** + * Sets cv_token + * + * @param string|null $cv_token The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection. + * + * @return $this + */ + public function setCvToken(?string $cv_token): static + { + if (is_null($cv_token)) { + array_push($this->openAPINullablesSetToNull, 'cv_token'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cv_token', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($cv_token) && (mb_strlen($cv_token) > 500)) { + throw new InvalidArgumentException('invalid length for $cv_token when calling TfvStatus., must be smaller than or equal to 500.'); + } + if (!is_null($cv_token) && (mb_strlen($cv_token) < 0)) { + throw new InvalidArgumentException('invalid length for $cv_token when calling TfvStatus., must be bigger than or equal to 0.'); + } + + $this->container['cv_token'] = $cv_token; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TfvStatusEnum.php b/src/Model/TfvStatusEnum.php new file mode 100644 index 0000000..4cf5fd4 --- /dev/null +++ b/src/Model/TfvStatusEnum.php @@ -0,0 +1,47 @@ + + */ +class TfvSubmissionInfo implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tfvSubmissionInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'business_address' => '\Bandwidth\Model\Address', + 'business_contact' => '\Bandwidth\Model\Contact', + 'message_volume' => 'int', + 'use_case' => 'string', + 'use_case_summary' => 'string', + 'production_message_content' => 'string', + 'opt_in_workflow' => '\Bandwidth\Model\OptInWorkflow', + 'additional_information' => 'string', + 'isv_reseller' => 'string', + 'privacy_policy_url' => 'string', + 'terms_and_conditions_url' => 'string', + 'business_dba' => 'string', + 'business_registration_number' => 'string', + 'business_registration_type' => '\Bandwidth\Model\BusinessRegistrationTypeEnum', + 'business_registration_issuing_country' => 'string', + 'business_entity_type' => '\Bandwidth\Model\BusinessEntityTypeEnum' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'business_address' => null, + 'business_contact' => null, + 'message_volume' => null, + 'use_case' => null, + 'use_case_summary' => null, + 'production_message_content' => null, + 'opt_in_workflow' => null, + 'additional_information' => null, + 'isv_reseller' => null, + 'privacy_policy_url' => null, + 'terms_and_conditions_url' => null, + 'business_dba' => null, + 'business_registration_number' => null, + 'business_registration_type' => null, + 'business_registration_issuing_country' => null, + 'business_entity_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'business_address' => false, + 'business_contact' => false, + 'message_volume' => false, + 'use_case' => false, + 'use_case_summary' => false, + 'production_message_content' => false, + 'opt_in_workflow' => false, + 'additional_information' => true, + 'isv_reseller' => true, + 'privacy_policy_url' => false, + 'terms_and_conditions_url' => false, + 'business_dba' => false, + 'business_registration_number' => true, + 'business_registration_type' => true, + 'business_registration_issuing_country' => true, + 'business_entity_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'business_address' => 'businessAddress', + 'business_contact' => 'businessContact', + 'message_volume' => 'messageVolume', + 'use_case' => 'useCase', + 'use_case_summary' => 'useCaseSummary', + 'production_message_content' => 'productionMessageContent', + 'opt_in_workflow' => 'optInWorkflow', + 'additional_information' => 'additionalInformation', + 'isv_reseller' => 'isvReseller', + 'privacy_policy_url' => 'privacyPolicyUrl', + 'terms_and_conditions_url' => 'termsAndConditionsUrl', + 'business_dba' => 'businessDba', + 'business_registration_number' => 'businessRegistrationNumber', + 'business_registration_type' => 'businessRegistrationType', + 'business_registration_issuing_country' => 'businessRegistrationIssuingCountry', + 'business_entity_type' => 'businessEntityType' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'business_address' => 'setBusinessAddress', + 'business_contact' => 'setBusinessContact', + 'message_volume' => 'setMessageVolume', + 'use_case' => 'setUseCase', + 'use_case_summary' => 'setUseCaseSummary', + 'production_message_content' => 'setProductionMessageContent', + 'opt_in_workflow' => 'setOptInWorkflow', + 'additional_information' => 'setAdditionalInformation', + 'isv_reseller' => 'setIsvReseller', + 'privacy_policy_url' => 'setPrivacyPolicyUrl', + 'terms_and_conditions_url' => 'setTermsAndConditionsUrl', + 'business_dba' => 'setBusinessDba', + 'business_registration_number' => 'setBusinessRegistrationNumber', + 'business_registration_type' => 'setBusinessRegistrationType', + 'business_registration_issuing_country' => 'setBusinessRegistrationIssuingCountry', + 'business_entity_type' => 'setBusinessEntityType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'business_address' => 'getBusinessAddress', + 'business_contact' => 'getBusinessContact', + 'message_volume' => 'getMessageVolume', + 'use_case' => 'getUseCase', + 'use_case_summary' => 'getUseCaseSummary', + 'production_message_content' => 'getProductionMessageContent', + 'opt_in_workflow' => 'getOptInWorkflow', + 'additional_information' => 'getAdditionalInformation', + 'isv_reseller' => 'getIsvReseller', + 'privacy_policy_url' => 'getPrivacyPolicyUrl', + 'terms_and_conditions_url' => 'getTermsAndConditionsUrl', + 'business_dba' => 'getBusinessDba', + 'business_registration_number' => 'getBusinessRegistrationNumber', + 'business_registration_type' => 'getBusinessRegistrationType', + 'business_registration_issuing_country' => 'getBusinessRegistrationIssuingCountry', + 'business_entity_type' => 'getBusinessEntityType' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('business_address', $data ?? [], null); + $this->setIfExists('business_contact', $data ?? [], null); + $this->setIfExists('message_volume', $data ?? [], null); + $this->setIfExists('use_case', $data ?? [], null); + $this->setIfExists('use_case_summary', $data ?? [], null); + $this->setIfExists('production_message_content', $data ?? [], null); + $this->setIfExists('opt_in_workflow', $data ?? [], null); + $this->setIfExists('additional_information', $data ?? [], null); + $this->setIfExists('isv_reseller', $data ?? [], null); + $this->setIfExists('privacy_policy_url', $data ?? [], null); + $this->setIfExists('terms_and_conditions_url', $data ?? [], null); + $this->setIfExists('business_dba', $data ?? [], null); + $this->setIfExists('business_registration_number', $data ?? [], null); + $this->setIfExists('business_registration_type', $data ?? [], null); + $this->setIfExists('business_registration_issuing_country', $data ?? [], null); + $this->setIfExists('business_entity_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['message_volume']) && ($this->container['message_volume'] > 10000000)) { + $invalidProperties[] = "invalid value for 'message_volume', must be smaller than or equal to 10000000."; + } + + if (!is_null($this->container['message_volume']) && ($this->container['message_volume'] < 10)) { + $invalidProperties[] = "invalid value for 'message_volume', must be bigger than or equal to 10."; + } + + if (!is_null($this->container['use_case']) && (mb_strlen($this->container['use_case']) > 500)) { + $invalidProperties[] = "invalid value for 'use_case', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['use_case']) && (mb_strlen($this->container['use_case']) < 0)) { + $invalidProperties[] = "invalid value for 'use_case', the character length must be bigger than or equal to 0."; + } + + if (!is_null($this->container['use_case_summary']) && (mb_strlen($this->container['use_case_summary']) > 500)) { + $invalidProperties[] = "invalid value for 'use_case_summary', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['use_case_summary']) && (mb_strlen($this->container['use_case_summary']) < 0)) { + $invalidProperties[] = "invalid value for 'use_case_summary', the character length must be bigger than or equal to 0."; + } + + if (!is_null($this->container['production_message_content']) && (mb_strlen($this->container['production_message_content']) > 500)) { + $invalidProperties[] = "invalid value for 'production_message_content', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['production_message_content']) && (mb_strlen($this->container['production_message_content']) < 0)) { + $invalidProperties[] = "invalid value for 'production_message_content', the character length must be bigger than or equal to 0."; + } + + if (!is_null($this->container['additional_information']) && (mb_strlen($this->container['additional_information']) > 500)) { + $invalidProperties[] = "invalid value for 'additional_information', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['additional_information']) && (mb_strlen($this->container['additional_information']) < 0)) { + $invalidProperties[] = "invalid value for 'additional_information', the character length must be bigger than or equal to 0."; + } + + if (!is_null($this->container['isv_reseller']) && (mb_strlen($this->container['isv_reseller']) > 500)) { + $invalidProperties[] = "invalid value for 'isv_reseller', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['isv_reseller']) && (mb_strlen($this->container['isv_reseller']) < 0)) { + $invalidProperties[] = "invalid value for 'isv_reseller', the character length must be bigger than or equal to 0."; + } + + if (!is_null($this->container['privacy_policy_url']) && (mb_strlen($this->container['privacy_policy_url']) > 500)) { + $invalidProperties[] = "invalid value for 'privacy_policy_url', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['terms_and_conditions_url']) && (mb_strlen($this->container['terms_and_conditions_url']) > 500)) { + $invalidProperties[] = "invalid value for 'terms_and_conditions_url', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['business_dba']) && (mb_strlen($this->container['business_dba']) > 500)) { + $invalidProperties[] = "invalid value for 'business_dba', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['business_registration_number']) && (mb_strlen($this->container['business_registration_number']) > 500)) { + $invalidProperties[] = "invalid value for 'business_registration_number', the character length must be smaller than or equal to 500."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets business_address + * + * @return \Bandwidth\Model\Address|null + */ + public function getBusinessAddress(): ?\Bandwidth\Model\Address + { + return $this->container['business_address']; + } + + /** + * Sets business_address + * + * @param \Bandwidth\Model\Address|null $business_address business_address + * + * @return $this + */ + public function setBusinessAddress(?\Bandwidth\Model\Address $business_address): static + { + if (is_null($business_address)) { + throw new InvalidArgumentException('non-nullable business_address cannot be null'); + } + $this->container['business_address'] = $business_address; + + return $this; + } + + /** + * Gets business_contact + * + * @return \Bandwidth\Model\Contact|null + */ + public function getBusinessContact(): ?\Bandwidth\Model\Contact + { + return $this->container['business_contact']; + } + + /** + * Sets business_contact + * + * @param \Bandwidth\Model\Contact|null $business_contact business_contact + * + * @return $this + */ + public function setBusinessContact(?\Bandwidth\Model\Contact $business_contact): static + { + if (is_null($business_contact)) { + throw new InvalidArgumentException('non-nullable business_contact cannot be null'); + } + $this->container['business_contact'] = $business_contact; + + return $this; + } + + /** + * Gets message_volume + * + * @return int|null + */ + public function getMessageVolume(): ?int + { + return $this->container['message_volume']; + } + + /** + * Sets message_volume + * + * @param int|null $message_volume Estimated monthly volume of messages from the toll-free number. + * + * @return $this + */ + public function setMessageVolume(?int $message_volume): static + { + if (is_null($message_volume)) { + throw new InvalidArgumentException('non-nullable message_volume cannot be null'); + } + if (($message_volume > 10000000)) { + throw new InvalidArgumentException('invalid value for $message_volume when calling TfvSubmissionInfo., must be smaller than or equal to 10000000.'); + } + if (($message_volume < 10)) { + throw new InvalidArgumentException('invalid value for $message_volume when calling TfvSubmissionInfo., must be bigger than or equal to 10.'); + } + + $this->container['message_volume'] = $message_volume; + + return $this; + } + + /** + * Gets use_case + * + * @return string|null + */ + public function getUseCase(): ?string + { + return $this->container['use_case']; + } + + /** + * Sets use_case + * + * @param string|null $use_case The category of the use case. + * + * @return $this + */ + public function setUseCase(?string $use_case): static + { + if (is_null($use_case)) { + throw new InvalidArgumentException('non-nullable use_case cannot be null'); + } + if ((mb_strlen($use_case) > 500)) { + throw new InvalidArgumentException('invalid length for $use_case when calling TfvSubmissionInfo., must be smaller than or equal to 500.'); + } + if ((mb_strlen($use_case) < 0)) { + throw new InvalidArgumentException('invalid length for $use_case when calling TfvSubmissionInfo., must be bigger than or equal to 0.'); + } + + $this->container['use_case'] = $use_case; + + return $this; + } + + /** + * Gets use_case_summary + * + * @return string|null + */ + public function getUseCaseSummary(): ?string + { + return $this->container['use_case_summary']; + } + + /** + * Sets use_case_summary + * + * @param string|null $use_case_summary A general idea of the use case and customer. + * + * @return $this + */ + public function setUseCaseSummary(?string $use_case_summary): static + { + if (is_null($use_case_summary)) { + throw new InvalidArgumentException('non-nullable use_case_summary cannot be null'); + } + if ((mb_strlen($use_case_summary) > 500)) { + throw new InvalidArgumentException('invalid length for $use_case_summary when calling TfvSubmissionInfo., must be smaller than or equal to 500.'); + } + if ((mb_strlen($use_case_summary) < 0)) { + throw new InvalidArgumentException('invalid length for $use_case_summary when calling TfvSubmissionInfo., must be bigger than or equal to 0.'); + } + + $this->container['use_case_summary'] = $use_case_summary; + + return $this; + } + + /** + * Gets production_message_content + * + * @return string|null + */ + public function getProductionMessageContent(): ?string + { + return $this->container['production_message_content']; + } + + /** + * Sets production_message_content + * + * @param string|null $production_message_content Example of message content. + * + * @return $this + */ + public function setProductionMessageContent(?string $production_message_content): static + { + if (is_null($production_message_content)) { + throw new InvalidArgumentException('non-nullable production_message_content cannot be null'); + } + if ((mb_strlen($production_message_content) > 500)) { + throw new InvalidArgumentException('invalid length for $production_message_content when calling TfvSubmissionInfo., must be smaller than or equal to 500.'); + } + if ((mb_strlen($production_message_content) < 0)) { + throw new InvalidArgumentException('invalid length for $production_message_content when calling TfvSubmissionInfo., must be bigger than or equal to 0.'); + } + + $this->container['production_message_content'] = $production_message_content; + + return $this; + } + + /** + * Gets opt_in_workflow + * + * @return \Bandwidth\Model\OptInWorkflow|null + */ + public function getOptInWorkflow(): ?\Bandwidth\Model\OptInWorkflow + { + return $this->container['opt_in_workflow']; + } + + /** + * Sets opt_in_workflow + * + * @param \Bandwidth\Model\OptInWorkflow|null $opt_in_workflow opt_in_workflow + * + * @return $this + */ + public function setOptInWorkflow(?\Bandwidth\Model\OptInWorkflow $opt_in_workflow): static + { + if (is_null($opt_in_workflow)) { + throw new InvalidArgumentException('non-nullable opt_in_workflow cannot be null'); + } + $this->container['opt_in_workflow'] = $opt_in_workflow; + + return $this; + } + + /** + * Gets additional_information + * + * @return string|null + */ + public function getAdditionalInformation(): ?string + { + return $this->container['additional_information']; + } + + /** + * Sets additional_information + * + * @param string|null $additional_information Any additional information. + * + * @return $this + */ + public function setAdditionalInformation(?string $additional_information): static + { + if (is_null($additional_information)) { + array_push($this->openAPINullablesSetToNull, 'additional_information'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additional_information', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($additional_information) && (mb_strlen($additional_information) > 500)) { + throw new InvalidArgumentException('invalid length for $additional_information when calling TfvSubmissionInfo., must be smaller than or equal to 500.'); + } + if (!is_null($additional_information) && (mb_strlen($additional_information) < 0)) { + throw new InvalidArgumentException('invalid length for $additional_information when calling TfvSubmissionInfo., must be bigger than or equal to 0.'); + } + + $this->container['additional_information'] = $additional_information; + + return $this; + } + + /** + * Gets isv_reseller + * + * @return string|null + */ + public function getIsvReseller(): ?string + { + return $this->container['isv_reseller']; + } + + /** + * Sets isv_reseller + * + * @param string|null $isv_reseller ISV name. + * + * @return $this + */ + public function setIsvReseller(?string $isv_reseller): static + { + if (is_null($isv_reseller)) { + array_push($this->openAPINullablesSetToNull, 'isv_reseller'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isv_reseller', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($isv_reseller) && (mb_strlen($isv_reseller) > 500)) { + throw new InvalidArgumentException('invalid length for $isv_reseller when calling TfvSubmissionInfo., must be smaller than or equal to 500.'); + } + if (!is_null($isv_reseller) && (mb_strlen($isv_reseller) < 0)) { + throw new InvalidArgumentException('invalid length for $isv_reseller when calling TfvSubmissionInfo., must be bigger than or equal to 0.'); + } + + $this->container['isv_reseller'] = $isv_reseller; + + return $this; + } + + /** + * Gets privacy_policy_url + * + * @return string|null + */ + public function getPrivacyPolicyUrl(): ?string + { + return $this->container['privacy_policy_url']; + } + + /** + * Sets privacy_policy_url + * + * @param string|null $privacy_policy_url The Toll-Free Verification request privacy policy URL. + * + * @return $this + */ + public function setPrivacyPolicyUrl(?string $privacy_policy_url): static + { + if (is_null($privacy_policy_url)) { + throw new InvalidArgumentException('non-nullable privacy_policy_url cannot be null'); + } + if ((mb_strlen($privacy_policy_url) > 500)) { + throw new InvalidArgumentException('invalid length for $privacy_policy_url when calling TfvSubmissionInfo., must be smaller than or equal to 500.'); + } + + $this->container['privacy_policy_url'] = $privacy_policy_url; + + return $this; + } + + /** + * Gets terms_and_conditions_url + * + * @return string|null + */ + public function getTermsAndConditionsUrl(): ?string + { + return $this->container['terms_and_conditions_url']; + } + + /** + * Sets terms_and_conditions_url + * + * @param string|null $terms_and_conditions_url The Toll-Free Verification request terms and conditions policy URL. + * + * @return $this + */ + public function setTermsAndConditionsUrl(?string $terms_and_conditions_url): static + { + if (is_null($terms_and_conditions_url)) { + throw new InvalidArgumentException('non-nullable terms_and_conditions_url cannot be null'); + } + if ((mb_strlen($terms_and_conditions_url) > 500)) { + throw new InvalidArgumentException('invalid length for $terms_and_conditions_url when calling TfvSubmissionInfo., must be smaller than or equal to 500.'); + } + + $this->container['terms_and_conditions_url'] = $terms_and_conditions_url; + + return $this; + } + + /** + * Gets business_dba + * + * @return string|null + */ + public function getBusinessDba(): ?string + { + return $this->container['business_dba']; + } + + /** + * Sets business_dba + * + * @param string|null $business_dba The company 'Doing Business As'. + * + * @return $this + */ + public function setBusinessDba(?string $business_dba): static + { + if (is_null($business_dba)) { + throw new InvalidArgumentException('non-nullable business_dba cannot be null'); + } + if ((mb_strlen($business_dba) > 500)) { + throw new InvalidArgumentException('invalid length for $business_dba when calling TfvSubmissionInfo., must be smaller than or equal to 500.'); + } + + $this->container['business_dba'] = $business_dba; + + return $this; + } + + /** + * Gets business_registration_number + * + * @return string|null + */ + public function getBusinessRegistrationNumber(): ?string + { + return $this->container['business_registration_number']; + } + + /** + * Sets business_registration_number + * + * @param string|null $business_registration_number Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.** + * + * @return $this + */ + public function setBusinessRegistrationNumber(?string $business_registration_number): static + { + if (is_null($business_registration_number)) { + array_push($this->openAPINullablesSetToNull, 'business_registration_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('business_registration_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($business_registration_number) && (mb_strlen($business_registration_number) > 500)) { + throw new InvalidArgumentException('invalid length for $business_registration_number when calling TfvSubmissionInfo., must be smaller than or equal to 500.'); + } + + $this->container['business_registration_number'] = $business_registration_number; + + return $this; + } + + /** + * Gets business_registration_type + * + * @return \Bandwidth\Model\BusinessRegistrationTypeEnum|null + */ + public function getBusinessRegistrationType(): ?\Bandwidth\Model\BusinessRegistrationTypeEnum + { + return $this->container['business_registration_type']; + } + + /** + * Sets business_registration_type + * + * @param \Bandwidth\Model\BusinessRegistrationTypeEnum|null $business_registration_type business_registration_type + * + * @return $this + */ + public function setBusinessRegistrationType(?\Bandwidth\Model\BusinessRegistrationTypeEnum $business_registration_type): static + { + if (is_null($business_registration_type)) { + array_push($this->openAPINullablesSetToNull, 'business_registration_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('business_registration_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['business_registration_type'] = $business_registration_type; + + return $this; + } + + /** + * Gets business_registration_issuing_country + * + * @return string|null + */ + public function getBusinessRegistrationIssuingCountry(): ?string + { + return $this->container['business_registration_issuing_country']; + } + + /** + * Sets business_registration_issuing_country + * + * @param string|null $business_registration_issuing_country The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code | + * + * @return $this + */ + public function setBusinessRegistrationIssuingCountry(?string $business_registration_issuing_country): static + { + if (is_null($business_registration_issuing_country)) { + array_push($this->openAPINullablesSetToNull, 'business_registration_issuing_country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('business_registration_issuing_country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['business_registration_issuing_country'] = $business_registration_issuing_country; + + return $this; + } + + /** + * Gets business_entity_type + * + * @return \Bandwidth\Model\BusinessEntityTypeEnum|null + */ + public function getBusinessEntityType(): ?\Bandwidth\Model\BusinessEntityTypeEnum + { + return $this->container['business_entity_type']; + } + + /** + * Sets business_entity_type + * + * @param \Bandwidth\Model\BusinessEntityTypeEnum|null $business_entity_type business_entity_type + * + * @return $this + */ + public function setBusinessEntityType(?\Bandwidth\Model\BusinessEntityTypeEnum $business_entity_type): static + { + if (is_null($business_entity_type)) { + throw new InvalidArgumentException('non-nullable business_entity_type cannot be null'); + } + $this->container['business_entity_type'] = $business_entity_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TfvSubmissionWrapper.php b/src/Model/TfvSubmissionWrapper.php new file mode 100644 index 0000000..ceda5ba --- /dev/null +++ b/src/Model/TfvSubmissionWrapper.php @@ -0,0 +1,384 @@ + + */ +class TfvSubmissionWrapper implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'tfvSubmissionWrapper'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'submission' => '\Bandwidth\Model\VerificationUpdateRequest' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'submission' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'submission' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'submission' => 'submission' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'submission' => 'setSubmission' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'submission' => 'getSubmission' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('submission', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets submission + * + * @return \Bandwidth\Model\VerificationUpdateRequest|null + */ + public function getSubmission(): ?\Bandwidth\Model\VerificationUpdateRequest + { + return $this->container['submission']; + } + + /** + * Sets submission + * + * @param \Bandwidth\Model\VerificationUpdateRequest|null $submission submission + * + * @return $this + */ + public function setSubmission(?\Bandwidth\Model\VerificationUpdateRequest $submission): static + { + if (is_null($submission)) { + throw new InvalidArgumentException('non-nullable submission cannot be null'); + } + $this->container['submission'] = $submission; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ThumbnailAlignmentEnum.php b/src/Model/ThumbnailAlignmentEnum.php new file mode 100644 index 0000000..20a76b5 --- /dev/null +++ b/src/Model/ThumbnailAlignmentEnum.php @@ -0,0 +1,46 @@ + + */ +class TranscribeRecording implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'transcribeRecording'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'callback_url' => 'string', + 'callback_method' => '\Bandwidth\Model\CallbackMethodEnum', + 'username' => 'string', + 'password' => 'string', + 'tag' => 'string', + 'callback_timeout' => 'float', + 'detect_language' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'callback_url' => 'uri', + 'callback_method' => null, + 'username' => null, + 'password' => null, + 'tag' => null, + 'callback_timeout' => 'double', + 'detect_language' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'callback_url' => false, + 'callback_method' => true, + 'username' => true, + 'password' => true, + 'tag' => true, + 'callback_timeout' => true, + 'detect_language' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'callback_url' => 'callbackUrl', + 'callback_method' => 'callbackMethod', + 'username' => 'username', + 'password' => 'password', + 'tag' => 'tag', + 'callback_timeout' => 'callbackTimeout', + 'detect_language' => 'detectLanguage' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'callback_url' => 'setCallbackUrl', + 'callback_method' => 'setCallbackMethod', + 'username' => 'setUsername', + 'password' => 'setPassword', + 'tag' => 'setTag', + 'callback_timeout' => 'setCallbackTimeout', + 'detect_language' => 'setDetectLanguage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'callback_url' => 'getCallbackUrl', + 'callback_method' => 'getCallbackMethod', + 'username' => 'getUsername', + 'password' => 'getPassword', + 'tag' => 'getTag', + 'callback_timeout' => 'getCallbackTimeout', + 'detect_language' => 'getDetectLanguage' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('callback_method', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('callback_timeout', $data ?? [], 15); + $this->setIfExists('detect_language', $data ?? [], false); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['username']) && (mb_strlen($this->container['username']) > 1024)) { + $invalidProperties[] = "invalid value for 'username', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) > 1024)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['callback_timeout']) && ($this->container['callback_timeout'] > 25)) { + $invalidProperties[] = "invalid value for 'callback_timeout', must be smaller than or equal to 25."; + } + + if (!is_null($this->container['callback_timeout']) && ($this->container['callback_timeout'] < 1)) { + $invalidProperties[] = "invalid value for 'callback_timeout', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets callback_url + * + * @return string|null + */ + public function getCallbackUrl(): ?string + { + return $this->container['callback_url']; + } + + /** + * Sets callback_url + * + * @param string|null $callback_url 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 $this + */ + public function setCallbackUrl(?string $callback_url): static + { + if (is_null($callback_url)) { + throw new InvalidArgumentException('non-nullable callback_url cannot be null'); + } + $this->container['callback_url'] = $callback_url; + + return $this; + } + + /** + * Gets callback_method + * + * @return \Bandwidth\Model\CallbackMethodEnum|null + */ + public function getCallbackMethod(): ?\Bandwidth\Model\CallbackMethodEnum + { + return $this->container['callback_method']; + } + + /** + * Sets callback_method + * + * @param \Bandwidth\Model\CallbackMethodEnum|null $callback_method callback_method + * + * @return $this + */ + public function setCallbackMethod(?\Bandwidth\Model\CallbackMethodEnum $callback_method): static + { + if (is_null($callback_method)) { + array_push($this->openAPINullablesSetToNull, 'callback_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('callback_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['callback_method'] = $callback_method; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username Basic auth username. + * + * @return $this + */ + public function setUsername(?string $username): static + { + if (is_null($username)) { + array_push($this->openAPINullablesSetToNull, 'username'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('username', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($username) && (mb_strlen($username) > 1024)) { + throw new InvalidArgumentException('invalid length for $username when calling TranscribeRecording., must be smaller than or equal to 1024.'); + } + + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password Basic auth password. + * + * @return $this + */ + public function setPassword(?string $password): static + { + if (is_null($password)) { + array_push($this->openAPINullablesSetToNull, 'password'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('password', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($password) && (mb_strlen($password) > 1024)) { + throw new InvalidArgumentException('invalid length for $password when calling TranscribeRecording., must be smaller than or equal to 1024.'); + } + + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets callback_timeout + * + * @return float|null + */ + public function getCallbackTimeout(): ?float + { + return $this->container['callback_timeout']; + } + + /** + * Sets callback_timeout + * + * @param float|null $callback_timeout 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. + * + * @return $this + */ + public function setCallbackTimeout(?float $callback_timeout): static + { + if (is_null($callback_timeout)) { + array_push($this->openAPINullablesSetToNull, 'callback_timeout'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('callback_timeout', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($callback_timeout) && ($callback_timeout > 25)) { + throw new InvalidArgumentException('invalid value for $callback_timeout when calling TranscribeRecording., must be smaller than or equal to 25.'); + } + if (!is_null($callback_timeout) && ($callback_timeout < 1)) { + throw new InvalidArgumentException('invalid value for $callback_timeout when calling TranscribeRecording., must be bigger than or equal to 1.'); + } + + $this->container['callback_timeout'] = $callback_timeout; + + return $this; + } + + /** + * Gets detect_language + * + * @return bool|null + */ + public function getDetectLanguage(): ?bool + { + return $this->container['detect_language']; + } + + /** + * Sets detect_language + * + * @param bool|null $detect_language 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 $this + */ + public function setDetectLanguage(?bool $detect_language): static + { + if (is_null($detect_language)) { + array_push($this->openAPINullablesSetToNull, 'detect_language'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('detect_language', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['detect_language'] = $detect_language; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/Transcription.php b/src/Model/Transcription.php new file mode 100644 index 0000000..5365b64 --- /dev/null +++ b/src/Model/Transcription.php @@ -0,0 +1,452 @@ + + */ +class Transcription implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'transcription'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'speaker' => 'int', + 'text' => 'string', + 'confidence' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'speaker' => null, + 'text' => null, + 'confidence' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'speaker' => false, + 'text' => false, + 'confidence' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'speaker' => 'speaker', + 'text' => 'text', + 'confidence' => 'confidence' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'speaker' => 'setSpeaker', + 'text' => 'setText', + 'confidence' => 'setConfidence' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'speaker' => 'getSpeaker', + 'text' => 'getText', + 'confidence' => 'getConfidence' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('speaker', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('confidence', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets speaker + * + * @return int|null + */ + public function getSpeaker(): ?int + { + return $this->container['speaker']; + } + + /** + * Sets speaker + * + * @param int|null $speaker Zero-based index identifying the speaker. + * + * @return $this + */ + public function setSpeaker(?int $speaker): static + { + if (is_null($speaker)) { + throw new InvalidArgumentException('non-nullable speaker cannot be null'); + } + $this->container['speaker'] = $speaker; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText(): ?string + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text The transcribed text + * + * @return $this + */ + public function setText(?string $text): static + { + if (is_null($text)) { + throw new InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets confidence + * + * @return float|null + */ + public function getConfidence(): ?float + { + return $this->container['confidence']; + } + + /** + * Sets confidence + * + * @param float|null $confidence The confidence on the recognized content, ranging from `0.0` to `1.0` with `1.0` being the highest confidence. + * + * @return $this + */ + public function setConfidence(?float $confidence): static + { + if (is_null($confidence)) { + throw new InvalidArgumentException('non-nullable confidence cannot be null'); + } + $this->container['confidence'] = $confidence; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TranscriptionAvailableCallback.php b/src/Model/TranscriptionAvailableCallback.php new file mode 100644 index 0000000..23f1219 --- /dev/null +++ b/src/Model/TranscriptionAvailableCallback.php @@ -0,0 +1,1086 @@ + + */ +class TranscriptionAvailableCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'transcriptionAvailableCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'media_url' => 'string', + 'parent_call_id' => 'string', + 'recording_id' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'end_time' => '\DateTime', + 'duration' => 'string', + 'file_format' => '\Bandwidth\Model\FileFormatEnum', + 'tag' => 'string', + 'transcription' => '\Bandwidth\Model\Transcription', + 'transfer_caller_id' => 'string', + 'transfer_to' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'media_url' => 'uri', + 'parent_call_id' => null, + 'recording_id' => null, + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'end_time' => 'date-time', + 'duration' => null, + 'file_format' => null, + 'tag' => null, + 'transcription' => null, + 'transfer_caller_id' => null, + 'transfer_to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'media_url' => true, + 'parent_call_id' => false, + 'recording_id' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'end_time' => false, + 'duration' => false, + 'file_format' => false, + 'tag' => true, + 'transcription' => false, + 'transfer_caller_id' => false, + 'transfer_to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'media_url' => 'mediaUrl', + 'parent_call_id' => 'parentCallId', + 'recording_id' => 'recordingId', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'end_time' => 'endTime', + 'duration' => 'duration', + 'file_format' => 'fileFormat', + 'tag' => 'tag', + 'transcription' => 'transcription', + 'transfer_caller_id' => 'transferCallerId', + 'transfer_to' => 'transferTo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'media_url' => 'setMediaUrl', + 'parent_call_id' => 'setParentCallId', + 'recording_id' => 'setRecordingId', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'end_time' => 'setEndTime', + 'duration' => 'setDuration', + 'file_format' => 'setFileFormat', + 'tag' => 'setTag', + 'transcription' => 'setTranscription', + 'transfer_caller_id' => 'setTransferCallerId', + 'transfer_to' => 'setTransferTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'media_url' => 'getMediaUrl', + 'parent_call_id' => 'getParentCallId', + 'recording_id' => 'getRecordingId', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'end_time' => 'getEndTime', + 'duration' => 'getDuration', + 'file_format' => 'getFileFormat', + 'tag' => 'getTag', + 'transcription' => 'getTranscription', + 'transfer_caller_id' => 'getTransferCallerId', + 'transfer_to' => 'getTransferTo' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('media_url', $data ?? [], null); + $this->setIfExists('parent_call_id', $data ?? [], null); + $this->setIfExists('recording_id', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('duration', $data ?? [], null); + $this->setIfExists('file_format', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('transcription', $data ?? [], null); + $this->setIfExists('transfer_caller_id', $data ?? [], null); + $this->setIfExists('transfer_to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets media_url + * + * @return string|null + */ + public function getMediaUrl(): ?string + { + return $this->container['media_url']; + } + + /** + * Sets media_url + * + * @param string|null $media_url The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * + * @return $this + */ + public function setMediaUrl(?string $media_url): static + { + if (is_null($media_url)) { + array_push($this->openAPINullablesSetToNull, 'media_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('media_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['media_url'] = $media_url; + + return $this; + } + + /** + * Gets parent_call_id + * + * @return string|null + */ + public function getParentCallId(): ?string + { + return $this->container['parent_call_id']; + } + + /** + * Sets parent_call_id + * + * @param string|null $parent_call_id (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. + * + * @return $this + */ + public function setParentCallId(?string $parent_call_id): static + { + if (is_null($parent_call_id)) { + throw new InvalidArgumentException('non-nullable parent_call_id cannot be null'); + } + $this->container['parent_call_id'] = $parent_call_id; + + return $this; + } + + /** + * Gets recording_id + * + * @return string|null + */ + public function getRecordingId(): ?string + { + return $this->container['recording_id']; + } + + /** + * Sets recording_id + * + * @param string|null $recording_id The unique ID of this recording + * + * @return $this + */ + public function setRecordingId(?string $recording_id): static + { + if (is_null($recording_id)) { + throw new InvalidArgumentException('non-nullable recording_id cannot be null'); + } + $this->container['recording_id'] = $recording_id; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets end_time + * + * @return \DateTime|null + */ + public function getEndTime(): ?\DateTime + { + return $this->container['end_time']; + } + + /** + * Sets end_time + * + * @param \DateTime|null $end_time The time that the recording ended in ISO-8601 format + * + * @return $this + */ + public function setEndTime(?\DateTime $end_time): static + { + if (is_null($end_time)) { + throw new InvalidArgumentException('non-nullable end_time cannot be null'); + } + $this->container['end_time'] = $end_time; + + return $this; + } + + /** + * Gets duration + * + * @return string|null + */ + public function getDuration(): ?string + { + return $this->container['duration']; + } + + /** + * Sets duration + * + * @param string|null $duration The duration of the recording in ISO-8601 format + * + * @return $this + */ + public function setDuration(?string $duration): static + { + if (is_null($duration)) { + throw new InvalidArgumentException('non-nullable duration cannot be null'); + } + $this->container['duration'] = $duration; + + return $this; + } + + /** + * Gets file_format + * + * @return \Bandwidth\Model\FileFormatEnum|null + */ + public function getFileFormat(): ?\Bandwidth\Model\FileFormatEnum + { + return $this->container['file_format']; + } + + /** + * Sets file_format + * + * @param \Bandwidth\Model\FileFormatEnum|null $file_format file_format + * + * @return $this + */ + public function setFileFormat(?\Bandwidth\Model\FileFormatEnum $file_format): static + { + if (is_null($file_format)) { + throw new InvalidArgumentException('non-nullable file_format cannot be null'); + } + $this->container['file_format'] = $file_format; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets transcription + * + * @return \Bandwidth\Model\Transcription|null + */ + public function getTranscription(): ?\Bandwidth\Model\Transcription + { + return $this->container['transcription']; + } + + /** + * Sets transcription + * + * @param \Bandwidth\Model\Transcription|null $transcription transcription + * + * @return $this + */ + public function setTranscription(?\Bandwidth\Model\Transcription $transcription): static + { + if (is_null($transcription)) { + throw new InvalidArgumentException('non-nullable transcription cannot be null'); + } + $this->container['transcription'] = $transcription; + + return $this; + } + + /** + * Gets transfer_caller_id + * + * @return string|null + */ + public function getTransferCallerId(): ?string + { + return $this->container['transfer_caller_id']; + } + + /** + * Sets transfer_caller_id + * + * @param string|null $transfer_caller_id The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferCallerId(?string $transfer_caller_id): static + { + if (is_null($transfer_caller_id)) { + throw new InvalidArgumentException('non-nullable transfer_caller_id cannot be null'); + } + $this->container['transfer_caller_id'] = $transfer_caller_id; + + return $this; + } + + /** + * Gets transfer_to + * + * @return string|null + */ + public function getTransferTo(): ?string + { + return $this->container['transfer_to']; + } + + /** + * Sets transfer_to + * + * @param string|null $transfer_to The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferTo(?string $transfer_to): static + { + if (is_null($transfer_to)) { + throw new InvalidArgumentException('non-nullable transfer_to cannot be null'); + } + $this->container['transfer_to'] = $transfer_to; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TransferAnswerCallback.php b/src/Model/TransferAnswerCallback.php new file mode 100644 index 0000000..8a81490 --- /dev/null +++ b/src/Model/TransferAnswerCallback.php @@ -0,0 +1,882 @@ + + */ +class TransferAnswerCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'transferAnswerCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'tag' => 'string', + 'transfer_caller_id' => 'string', + 'transfer_to' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'tag' => null, + 'transfer_caller_id' => null, + 'transfer_to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'tag' => true, + 'transfer_caller_id' => false, + 'transfer_to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'tag' => 'tag', + 'transfer_caller_id' => 'transferCallerId', + 'transfer_to' => 'transferTo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'tag' => 'setTag', + 'transfer_caller_id' => 'setTransferCallerId', + 'transfer_to' => 'setTransferTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'tag' => 'getTag', + 'transfer_caller_id' => 'getTransferCallerId', + 'transfer_to' => 'getTransferTo' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('transfer_caller_id', $data ?? [], null); + $this->setIfExists('transfer_to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets transfer_caller_id + * + * @return string|null + */ + public function getTransferCallerId(): ?string + { + return $this->container['transfer_caller_id']; + } + + /** + * Sets transfer_caller_id + * + * @param string|null $transfer_caller_id The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferCallerId(?string $transfer_caller_id): static + { + if (is_null($transfer_caller_id)) { + throw new InvalidArgumentException('non-nullable transfer_caller_id cannot be null'); + } + $this->container['transfer_caller_id'] = $transfer_caller_id; + + return $this; + } + + /** + * Gets transfer_to + * + * @return string|null + */ + public function getTransferTo(): ?string + { + return $this->container['transfer_to']; + } + + /** + * Sets transfer_to + * + * @param string|null $transfer_to The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferTo(?string $transfer_to): static + { + if (is_null($transfer_to)) { + throw new InvalidArgumentException('non-nullable transfer_to cannot be null'); + } + $this->container['transfer_to'] = $transfer_to; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TransferCompleteCallback.php b/src/Model/TransferCompleteCallback.php new file mode 100644 index 0000000..f36d92f --- /dev/null +++ b/src/Model/TransferCompleteCallback.php @@ -0,0 +1,998 @@ + + */ +class TransferCompleteCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'transferCompleteCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'tag' => 'string', + 'transfer_caller_id' => 'string', + 'transfer_to' => 'string', + 'cause' => 'string', + 'error_message' => 'string', + 'error_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'tag' => null, + 'transfer_caller_id' => null, + 'transfer_to' => null, + 'cause' => null, + 'error_message' => null, + 'error_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'tag' => true, + 'transfer_caller_id' => false, + 'transfer_to' => false, + 'cause' => false, + 'error_message' => true, + 'error_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'tag' => 'tag', + 'transfer_caller_id' => 'transferCallerId', + 'transfer_to' => 'transferTo', + 'cause' => 'cause', + 'error_message' => 'errorMessage', + 'error_id' => 'errorId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'tag' => 'setTag', + 'transfer_caller_id' => 'setTransferCallerId', + 'transfer_to' => 'setTransferTo', + 'cause' => 'setCause', + 'error_message' => 'setErrorMessage', + 'error_id' => 'setErrorId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'tag' => 'getTag', + 'transfer_caller_id' => 'getTransferCallerId', + 'transfer_to' => 'getTransferTo', + 'cause' => 'getCause', + 'error_message' => 'getErrorMessage', + 'error_id' => 'getErrorId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('transfer_caller_id', $data ?? [], null); + $this->setIfExists('transfer_to', $data ?? [], null); + $this->setIfExists('cause', $data ?? [], null); + $this->setIfExists('error_message', $data ?? [], null); + $this->setIfExists('error_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets transfer_caller_id + * + * @return string|null + */ + public function getTransferCallerId(): ?string + { + return $this->container['transfer_caller_id']; + } + + /** + * Sets transfer_caller_id + * + * @param string|null $transfer_caller_id The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferCallerId(?string $transfer_caller_id): static + { + if (is_null($transfer_caller_id)) { + throw new InvalidArgumentException('non-nullable transfer_caller_id cannot be null'); + } + $this->container['transfer_caller_id'] = $transfer_caller_id; + + return $this; + } + + /** + * Gets transfer_to + * + * @return string|null + */ + public function getTransferTo(): ?string + { + return $this->container['transfer_to']; + } + + /** + * Sets transfer_to + * + * @param string|null $transfer_to The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferTo(?string $transfer_to): static + { + if (is_null($transfer_to)) { + throw new InvalidArgumentException('non-nullable transfer_to cannot be null'); + } + $this->container['transfer_to'] = $transfer_to; + + return $this; + } + + /** + * Gets cause + * + * @return string|null + */ + public function getCause(): ?string + { + return $this->container['cause']; + } + + /** + * Sets cause + * + * @param string|null $cause Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. + * + * @return $this + */ + public function setCause(?string $cause): static + { + if (is_null($cause)) { + throw new InvalidArgumentException('non-nullable cause cannot be null'); + } + $this->container['cause'] = $cause; + + return $this; + } + + /** + * Gets error_message + * + * @return string|null + */ + public function getErrorMessage(): ?string + { + return $this->container['error_message']; + } + + /** + * Sets error_message + * + * @param string|null $error_message Text explaining the reason that caused the call to fail in case of errors. + * + * @return $this + */ + public function setErrorMessage(?string $error_message): static + { + if (is_null($error_message)) { + array_push($this->openAPINullablesSetToNull, 'error_message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error_message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error_message'] = $error_message; + + return $this; + } + + /** + * Gets error_id + * + * @return string|null + */ + public function getErrorId(): ?string + { + return $this->container['error_id']; + } + + /** + * Sets error_id + * + * @param string|null $error_id Bandwidth's internal id that references the error event. + * + * @return $this + */ + public function setErrorId(?string $error_id): static + { + if (is_null($error_id)) { + array_push($this->openAPINullablesSetToNull, 'error_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error_id'] = $error_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/TransferDisconnectCallback.php b/src/Model/TransferDisconnectCallback.php new file mode 100644 index 0000000..c961103 --- /dev/null +++ b/src/Model/TransferDisconnectCallback.php @@ -0,0 +1,1066 @@ + + */ +class TransferDisconnectCallback implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'transferDisconnectCallback'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'event_type' => 'string', + 'event_time' => '\DateTime', + 'account_id' => 'string', + 'application_id' => 'string', + 'from' => 'string', + 'to' => 'string', + 'direction' => '\Bandwidth\Model\CallDirectionEnum', + 'call_id' => 'string', + 'call_url' => 'string', + 'parent_call_id' => 'string', + 'enqueued_time' => '\DateTime', + 'start_time' => '\DateTime', + 'answer_time' => '\DateTime', + 'end_time' => '\DateTime', + 'tag' => 'string', + 'transfer_caller_id' => 'string', + 'transfer_to' => 'string', + 'cause' => 'string', + 'error_message' => 'string', + 'error_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'event_type' => null, + 'event_time' => 'date-time', + 'account_id' => null, + 'application_id' => null, + 'from' => null, + 'to' => null, + 'direction' => null, + 'call_id' => null, + 'call_url' => 'uri', + 'parent_call_id' => null, + 'enqueued_time' => 'date-time', + 'start_time' => 'date-time', + 'answer_time' => 'date-time', + 'end_time' => 'date-time', + 'tag' => null, + 'transfer_caller_id' => null, + 'transfer_to' => null, + 'cause' => null, + 'error_message' => null, + 'error_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'event_type' => false, + 'event_time' => false, + 'account_id' => false, + 'application_id' => false, + 'from' => false, + 'to' => false, + 'direction' => false, + 'call_id' => false, + 'call_url' => false, + 'parent_call_id' => false, + 'enqueued_time' => true, + 'start_time' => false, + 'answer_time' => true, + 'end_time' => false, + 'tag' => true, + 'transfer_caller_id' => false, + 'transfer_to' => false, + 'cause' => false, + 'error_message' => true, + 'error_id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'event_type' => 'eventType', + 'event_time' => 'eventTime', + 'account_id' => 'accountId', + 'application_id' => 'applicationId', + 'from' => 'from', + 'to' => 'to', + 'direction' => 'direction', + 'call_id' => 'callId', + 'call_url' => 'callUrl', + 'parent_call_id' => 'parentCallId', + 'enqueued_time' => 'enqueuedTime', + 'start_time' => 'startTime', + 'answer_time' => 'answerTime', + 'end_time' => 'endTime', + 'tag' => 'tag', + 'transfer_caller_id' => 'transferCallerId', + 'transfer_to' => 'transferTo', + 'cause' => 'cause', + 'error_message' => 'errorMessage', + 'error_id' => 'errorId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'event_type' => 'setEventType', + 'event_time' => 'setEventTime', + 'account_id' => 'setAccountId', + 'application_id' => 'setApplicationId', + 'from' => 'setFrom', + 'to' => 'setTo', + 'direction' => 'setDirection', + 'call_id' => 'setCallId', + 'call_url' => 'setCallUrl', + 'parent_call_id' => 'setParentCallId', + 'enqueued_time' => 'setEnqueuedTime', + 'start_time' => 'setStartTime', + 'answer_time' => 'setAnswerTime', + 'end_time' => 'setEndTime', + 'tag' => 'setTag', + 'transfer_caller_id' => 'setTransferCallerId', + 'transfer_to' => 'setTransferTo', + 'cause' => 'setCause', + 'error_message' => 'setErrorMessage', + 'error_id' => 'setErrorId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'event_type' => 'getEventType', + 'event_time' => 'getEventTime', + 'account_id' => 'getAccountId', + 'application_id' => 'getApplicationId', + 'from' => 'getFrom', + 'to' => 'getTo', + 'direction' => 'getDirection', + 'call_id' => 'getCallId', + 'call_url' => 'getCallUrl', + 'parent_call_id' => 'getParentCallId', + 'enqueued_time' => 'getEnqueuedTime', + 'start_time' => 'getStartTime', + 'answer_time' => 'getAnswerTime', + 'end_time' => 'getEndTime', + 'tag' => 'getTag', + 'transfer_caller_id' => 'getTransferCallerId', + 'transfer_to' => 'getTransferTo', + 'cause' => 'getCause', + 'error_message' => 'getErrorMessage', + 'error_id' => 'getErrorId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('application_id', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('direction', $data ?? [], null); + $this->setIfExists('call_id', $data ?? [], null); + $this->setIfExists('call_url', $data ?? [], null); + $this->setIfExists('parent_call_id', $data ?? [], null); + $this->setIfExists('enqueued_time', $data ?? [], null); + $this->setIfExists('start_time', $data ?? [], null); + $this->setIfExists('answer_time', $data ?? [], null); + $this->setIfExists('end_time', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + $this->setIfExists('transfer_caller_id', $data ?? [], null); + $this->setIfExists('transfer_to', $data ?? [], null); + $this->setIfExists('cause', $data ?? [], null); + $this->setIfExists('error_message', $data ?? [], null); + $this->setIfExists('error_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets event_type + * + * @return string|null + */ + public function getEventType(): ?string + { + return $this->container['event_type']; + } + + /** + * Sets event_type + * + * @param string|null $event_type 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 $this + */ + public function setEventType(?string $event_type): static + { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } + $this->container['event_type'] = $event_type; + + return $this; + } + + /** + * Gets event_time + * + * @return \DateTime|null + */ + public function getEventTime(): ?\DateTime + { + return $this->container['event_time']; + } + + /** + * Sets event_time + * + * @param \DateTime|null $event_time 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 $this + */ + public function setEventTime(?\DateTime $event_time): static + { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } + $this->container['event_time'] = $event_time; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id The user account associated with the call. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets application_id + * + * @return string|null + */ + public function getApplicationId(): ?string + { + return $this->container['application_id']; + } + + /** + * Sets application_id + * + * @param string|null $application_id The id of the application associated with the call. + * + * @return $this + */ + public function setApplicationId(?string $application_id): static + { + if (is_null($application_id)) { + throw new InvalidArgumentException('non-nullable application_id cannot be null'); + } + $this->container['application_id'] = $application_id; + + return $this; + } + + /** + * Gets from + * + * @return string|null + */ + public function getFrom(): ?string + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param string|null $from The provided identifier of the caller. Must be a phone number in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setFrom(?string $from): static + { + if (is_null($from)) { + throw new InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets to + * + * @return string|null + */ + public function getTo(): ?string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string|null $to The phone number that received the call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTo(?string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets direction + * + * @return \Bandwidth\Model\CallDirectionEnum|null + */ + public function getDirection(): ?\Bandwidth\Model\CallDirectionEnum + { + return $this->container['direction']; + } + + /** + * Sets direction + * + * @param \Bandwidth\Model\CallDirectionEnum|null $direction direction + * + * @return $this + */ + public function setDirection(?\Bandwidth\Model\CallDirectionEnum $direction): static + { + if (is_null($direction)) { + throw new InvalidArgumentException('non-nullable direction cannot be null'); + } + $this->container['direction'] = $direction; + + return $this; + } + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id The call id associated with the event. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + + /** + * Gets call_url + * + * @return string|null + */ + public function getCallUrl(): ?string + { + return $this->container['call_url']; + } + + /** + * Sets call_url + * + * @param string|null $call_url The URL of the call associated with the event. + * + * @return $this + */ + public function setCallUrl(?string $call_url): static + { + if (is_null($call_url)) { + throw new InvalidArgumentException('non-nullable call_url cannot be null'); + } + $this->container['call_url'] = $call_url; + + return $this; + } + + /** + * Gets parent_call_id + * + * @return string|null + */ + public function getParentCallId(): ?string + { + return $this->container['parent_call_id']; + } + + /** + * Sets parent_call_id + * + * @param string|null $parent_call_id (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. + * + * @return $this + */ + public function setParentCallId(?string $parent_call_id): static + { + if (is_null($parent_call_id)) { + throw new InvalidArgumentException('non-nullable parent_call_id cannot be null'); + } + $this->container['parent_call_id'] = $parent_call_id; + + return $this; + } + + /** + * Gets enqueued_time + * + * @return \DateTime|null + */ + public function getEnqueuedTime(): ?\DateTime + { + return $this->container['enqueued_time']; + } + + /** + * Sets enqueued_time + * + * @param \DateTime|null $enqueued_time (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * + * @return $this + */ + public function setEnqueuedTime(?\DateTime $enqueued_time): static + { + if (is_null($enqueued_time)) { + array_push($this->openAPINullablesSetToNull, 'enqueued_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('enqueued_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['enqueued_time'] = $enqueued_time; + + return $this; + } + + /** + * Gets start_time + * + * @return \DateTime|null + */ + public function getStartTime(): ?\DateTime + { + return $this->container['start_time']; + } + + /** + * Sets start_time + * + * @param \DateTime|null $start_time Time the call was started, in ISO 8601 format. + * + * @return $this + */ + public function setStartTime(?\DateTime $start_time): static + { + if (is_null($start_time)) { + throw new InvalidArgumentException('non-nullable start_time cannot be null'); + } + $this->container['start_time'] = $start_time; + + return $this; + } + + /** + * Gets answer_time + * + * @return \DateTime|null + */ + public function getAnswerTime(): ?\DateTime + { + return $this->container['answer_time']; + } + + /** + * Sets answer_time + * + * @param \DateTime|null $answer_time Time the call was answered, in ISO 8601 format. + * + * @return $this + */ + public function setAnswerTime(?\DateTime $answer_time): static + { + if (is_null($answer_time)) { + array_push($this->openAPINullablesSetToNull, 'answer_time'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('answer_time', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['answer_time'] = $answer_time; + + return $this; + } + + /** + * Gets end_time + * + * @return \DateTime|null + */ + public function getEndTime(): ?\DateTime + { + return $this->container['end_time']; + } + + /** + * Sets end_time + * + * @param \DateTime|null $end_time The time that the recording ended in ISO-8601 format + * + * @return $this + */ + public function setEndTime(?\DateTime $end_time): static + { + if (is_null($end_time)) { + throw new InvalidArgumentException('non-nullable end_time cannot be null'); + } + $this->container['end_time'] = $end_time; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['tag'] = $tag; + + return $this; + } + + /** + * Gets transfer_caller_id + * + * @return string|null + */ + public function getTransferCallerId(): ?string + { + return $this->container['transfer_caller_id']; + } + + /** + * Sets transfer_caller_id + * + * @param string|null $transfer_caller_id The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferCallerId(?string $transfer_caller_id): static + { + if (is_null($transfer_caller_id)) { + throw new InvalidArgumentException('non-nullable transfer_caller_id cannot be null'); + } + $this->container['transfer_caller_id'] = $transfer_caller_id; + + return $this; + } + + /** + * Gets transfer_to + * + * @return string|null + */ + public function getTransferTo(): ?string + { + return $this->container['transfer_to']; + } + + /** + * Sets transfer_to + * + * @param string|null $transfer_to The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * + * @return $this + */ + public function setTransferTo(?string $transfer_to): static + { + if (is_null($transfer_to)) { + throw new InvalidArgumentException('non-nullable transfer_to cannot be null'); + } + $this->container['transfer_to'] = $transfer_to; + + return $this; + } + + /** + * Gets cause + * + * @return string|null + */ + public function getCause(): ?string + { + return $this->container['cause']; + } + + /** + * Sets cause + * + * @param string|null $cause Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. + * + * @return $this + */ + public function setCause(?string $cause): static + { + if (is_null($cause)) { + throw new InvalidArgumentException('non-nullable cause cannot be null'); + } + $this->container['cause'] = $cause; + + return $this; + } + + /** + * Gets error_message + * + * @return string|null + */ + public function getErrorMessage(): ?string + { + return $this->container['error_message']; + } + + /** + * Sets error_message + * + * @param string|null $error_message Text explaining the reason that caused the call to fail in case of errors. + * + * @return $this + */ + public function setErrorMessage(?string $error_message): static + { + if (is_null($error_message)) { + array_push($this->openAPINullablesSetToNull, 'error_message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error_message', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error_message'] = $error_message; + + return $this; + } + + /** + * Gets error_id + * + * @return string|null + */ + public function getErrorId(): ?string + { + return $this->container['error_id']; + } + + /** + * Sets error_id + * + * @param string|null $error_id Bandwidth's internal id that references the error event. + * + * @return $this + */ + public function setErrorId(?string $error_id): static + { + if (is_null($error_id)) { + array_push($this->openAPINullablesSetToNull, 'error_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error_id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error_id'] = $error_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UpdateCall.php b/src/Model/UpdateCall.php new file mode 100644 index 0000000..1f0f1a8 --- /dev/null +++ b/src/Model/UpdateCall.php @@ -0,0 +1,800 @@ + + */ +class UpdateCall implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateCall'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'state' => '\Bandwidth\Model\CallStateEnum', + 'redirect_url' => 'string', + 'redirect_method' => '\Bandwidth\Model\RedirectMethodEnum', + 'username' => 'string', + 'password' => 'string', + 'redirect_fallback_url' => 'string', + 'redirect_fallback_method' => '\Bandwidth\Model\RedirectMethodEnum', + 'fallback_username' => 'string', + 'fallback_password' => 'string', + 'tag' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'state' => null, + 'redirect_url' => 'uri', + 'redirect_method' => null, + 'username' => null, + 'password' => null, + 'redirect_fallback_url' => 'uri', + 'redirect_fallback_method' => null, + 'fallback_username' => null, + 'fallback_password' => null, + 'tag' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'state' => true, + 'redirect_url' => true, + 'redirect_method' => true, + 'username' => true, + 'password' => true, + 'redirect_fallback_url' => true, + 'redirect_fallback_method' => true, + 'fallback_username' => true, + 'fallback_password' => true, + 'tag' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'state' => 'state', + 'redirect_url' => 'redirectUrl', + 'redirect_method' => 'redirectMethod', + 'username' => 'username', + 'password' => 'password', + 'redirect_fallback_url' => 'redirectFallbackUrl', + 'redirect_fallback_method' => 'redirectFallbackMethod', + 'fallback_username' => 'fallbackUsername', + 'fallback_password' => 'fallbackPassword', + 'tag' => 'tag' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'state' => 'setState', + 'redirect_url' => 'setRedirectUrl', + 'redirect_method' => 'setRedirectMethod', + 'username' => 'setUsername', + 'password' => 'setPassword', + 'redirect_fallback_url' => 'setRedirectFallbackUrl', + 'redirect_fallback_method' => 'setRedirectFallbackMethod', + 'fallback_username' => 'setFallbackUsername', + 'fallback_password' => 'setFallbackPassword', + 'tag' => 'setTag' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'state' => 'getState', + 'redirect_url' => 'getRedirectUrl', + 'redirect_method' => 'getRedirectMethod', + 'username' => 'getUsername', + 'password' => 'getPassword', + 'redirect_fallback_url' => 'getRedirectFallbackUrl', + 'redirect_fallback_method' => 'getRedirectFallbackMethod', + 'fallback_username' => 'getFallbackUsername', + 'fallback_password' => 'getFallbackPassword', + 'tag' => 'getTag' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('redirect_url', $data ?? [], null); + $this->setIfExists('redirect_method', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('redirect_fallback_url', $data ?? [], null); + $this->setIfExists('redirect_fallback_method', $data ?? [], null); + $this->setIfExists('fallback_username', $data ?? [], null); + $this->setIfExists('fallback_password', $data ?? [], null); + $this->setIfExists('tag', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['username']) && (mb_strlen($this->container['username']) > 1024)) { + $invalidProperties[] = "invalid value for 'username', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) > 1024)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['fallback_username']) && (mb_strlen($this->container['fallback_username']) > 1024)) { + $invalidProperties[] = "invalid value for 'fallback_username', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['fallback_password']) && (mb_strlen($this->container['fallback_password']) > 1024)) { + $invalidProperties[] = "invalid value for 'fallback_password', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['tag']) && (mb_strlen($this->container['tag']) > 4096)) { + $invalidProperties[] = "invalid value for 'tag', the character length must be smaller than or equal to 4096."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets state + * + * @return \Bandwidth\Model\CallStateEnum|null + */ + public function getState(): ?\Bandwidth\Model\CallStateEnum + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param \Bandwidth\Model\CallStateEnum|null $state state + * + * @return $this + */ + public function setState(?\Bandwidth\Model\CallStateEnum $state): static + { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets redirect_url + * + * @return string|null + */ + public function getRedirectUrl(): ?string + { + return $this->container['redirect_url']; + } + + /** + * Sets redirect_url + * + * @param string|null $redirect_url 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 $this + */ + public function setRedirectUrl(?string $redirect_url): static + { + if (is_null($redirect_url)) { + array_push($this->openAPINullablesSetToNull, 'redirect_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redirect_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redirect_url'] = $redirect_url; + + return $this; + } + + /** + * Gets redirect_method + * + * @return \Bandwidth\Model\RedirectMethodEnum|null + */ + public function getRedirectMethod(): ?\Bandwidth\Model\RedirectMethodEnum + { + return $this->container['redirect_method']; + } + + /** + * Sets redirect_method + * + * @param \Bandwidth\Model\RedirectMethodEnum|null $redirect_method redirect_method + * + * @return $this + */ + public function setRedirectMethod(?\Bandwidth\Model\RedirectMethodEnum $redirect_method): static + { + if (is_null($redirect_method)) { + array_push($this->openAPINullablesSetToNull, 'redirect_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redirect_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redirect_method'] = $redirect_method; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username Basic auth username. + * + * @return $this + */ + public function setUsername(?string $username): static + { + if (is_null($username)) { + array_push($this->openAPINullablesSetToNull, 'username'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('username', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($username) && (mb_strlen($username) > 1024)) { + throw new InvalidArgumentException('invalid length for $username when calling UpdateCall., must be smaller than or equal to 1024.'); + } + + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password Basic auth password. + * + * @return $this + */ + public function setPassword(?string $password): static + { + if (is_null($password)) { + array_push($this->openAPINullablesSetToNull, 'password'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('password', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($password) && (mb_strlen($password) > 1024)) { + throw new InvalidArgumentException('invalid length for $password when calling UpdateCall., must be smaller than or equal to 1024.'); + } + + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets redirect_fallback_url + * + * @return string|null + */ + public function getRedirectFallbackUrl(): ?string + { + return $this->container['redirect_fallback_url']; + } + + /** + * Sets redirect_fallback_url + * + * @param string|null $redirect_fallback_url A fallback url which, if provided, will be used to retry the redirect callback delivery in case `redirectUrl` fails to respond. + * + * @return $this + */ + public function setRedirectFallbackUrl(?string $redirect_fallback_url): static + { + if (is_null($redirect_fallback_url)) { + array_push($this->openAPINullablesSetToNull, 'redirect_fallback_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redirect_fallback_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redirect_fallback_url'] = $redirect_fallback_url; + + return $this; + } + + /** + * Gets redirect_fallback_method + * + * @return \Bandwidth\Model\RedirectMethodEnum|null + */ + public function getRedirectFallbackMethod(): ?\Bandwidth\Model\RedirectMethodEnum + { + return $this->container['redirect_fallback_method']; + } + + /** + * Sets redirect_fallback_method + * + * @param \Bandwidth\Model\RedirectMethodEnum|null $redirect_fallback_method redirect_fallback_method + * + * @return $this + */ + public function setRedirectFallbackMethod(?\Bandwidth\Model\RedirectMethodEnum $redirect_fallback_method): static + { + if (is_null($redirect_fallback_method)) { + array_push($this->openAPINullablesSetToNull, 'redirect_fallback_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redirect_fallback_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redirect_fallback_method'] = $redirect_fallback_method; + + return $this; + } + + /** + * Gets fallback_username + * + * @return string|null + */ + public function getFallbackUsername(): ?string + { + return $this->container['fallback_username']; + } + + /** + * Sets fallback_username + * + * @param string|null $fallback_username Basic auth username. + * + * @return $this + */ + public function setFallbackUsername(?string $fallback_username): static + { + if (is_null($fallback_username)) { + array_push($this->openAPINullablesSetToNull, 'fallback_username'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_username', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($fallback_username) && (mb_strlen($fallback_username) > 1024)) { + throw new InvalidArgumentException('invalid length for $fallback_username when calling UpdateCall., must be smaller than or equal to 1024.'); + } + + $this->container['fallback_username'] = $fallback_username; + + return $this; + } + + /** + * Gets fallback_password + * + * @return string|null + */ + public function getFallbackPassword(): ?string + { + return $this->container['fallback_password']; + } + + /** + * Sets fallback_password + * + * @param string|null $fallback_password Basic auth password. + * + * @return $this + */ + public function setFallbackPassword(?string $fallback_password): static + { + if (is_null($fallback_password)) { + array_push($this->openAPINullablesSetToNull, 'fallback_password'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_password', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($fallback_password) && (mb_strlen($fallback_password) > 1024)) { + throw new InvalidArgumentException('invalid length for $fallback_password when calling UpdateCall., must be smaller than or equal to 1024.'); + } + + $this->container['fallback_password'] = $fallback_password; + + return $this; + } + + /** + * Gets tag + * + * @return string|null + */ + public function getTag(): ?string + { + return $this->container['tag']; + } + + /** + * Sets tag + * + * @param string|null $tag 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 4096 characters. Not allowed if `state` is `completed`. + * + * @return $this + */ + public function setTag(?string $tag): static + { + if (is_null($tag)) { + array_push($this->openAPINullablesSetToNull, 'tag'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('tag', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($tag) && (mb_strlen($tag) > 4096)) { + throw new InvalidArgumentException('invalid length for $tag when calling UpdateCall., must be smaller than or equal to 4096.'); + } + + $this->container['tag'] = $tag; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UpdateCallRecording.php b/src/Model/UpdateCallRecording.php new file mode 100644 index 0000000..b7e64fc --- /dev/null +++ b/src/Model/UpdateCallRecording.php @@ -0,0 +1,387 @@ + + */ +class UpdateCallRecording implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateCallRecording'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'state' => '\Bandwidth\Model\RecordingStateEnum' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'state' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'state' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'state' => 'state' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'state' => 'setState' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'state' => 'getState' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('state', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['state'] === null) { + $invalidProperties[] = "'state' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets state + * + * @return \Bandwidth\Model\RecordingStateEnum + */ + public function getState(): \Bandwidth\Model\RecordingStateEnum + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param \Bandwidth\Model\RecordingStateEnum $state state + * + * @return $this + */ + public function setState(\Bandwidth\Model\RecordingStateEnum $state): static + { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UpdateConference.php b/src/Model/UpdateConference.php new file mode 100644 index 0000000..aacaf8a --- /dev/null +++ b/src/Model/UpdateConference.php @@ -0,0 +1,751 @@ + + */ +class UpdateConference implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateConference'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'status' => '\Bandwidth\Model\ConferenceStateEnum', + 'redirect_url' => 'string', + 'redirect_method' => '\Bandwidth\Model\RedirectMethodEnum', + 'username' => 'string', + 'password' => 'string', + 'redirect_fallback_url' => 'string', + 'redirect_fallback_method' => '\Bandwidth\Model\RedirectMethodEnum', + 'fallback_username' => 'string', + 'fallback_password' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'status' => null, + 'redirect_url' => 'uri', + 'redirect_method' => null, + 'username' => null, + 'password' => null, + 'redirect_fallback_url' => 'uri', + 'redirect_fallback_method' => null, + 'fallback_username' => null, + 'fallback_password' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'status' => true, + 'redirect_url' => true, + 'redirect_method' => true, + 'username' => true, + 'password' => true, + 'redirect_fallback_url' => true, + 'redirect_fallback_method' => true, + 'fallback_username' => true, + 'fallback_password' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'status' => 'status', + 'redirect_url' => 'redirectUrl', + 'redirect_method' => 'redirectMethod', + 'username' => 'username', + 'password' => 'password', + 'redirect_fallback_url' => 'redirectFallbackUrl', + 'redirect_fallback_method' => 'redirectFallbackMethod', + 'fallback_username' => 'fallbackUsername', + 'fallback_password' => 'fallbackPassword' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'status' => 'setStatus', + 'redirect_url' => 'setRedirectUrl', + 'redirect_method' => 'setRedirectMethod', + 'username' => 'setUsername', + 'password' => 'setPassword', + 'redirect_fallback_url' => 'setRedirectFallbackUrl', + 'redirect_fallback_method' => 'setRedirectFallbackMethod', + 'fallback_username' => 'setFallbackUsername', + 'fallback_password' => 'setFallbackPassword' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'status' => 'getStatus', + 'redirect_url' => 'getRedirectUrl', + 'redirect_method' => 'getRedirectMethod', + 'username' => 'getUsername', + 'password' => 'getPassword', + 'redirect_fallback_url' => 'getRedirectFallbackUrl', + 'redirect_fallback_method' => 'getRedirectFallbackMethod', + 'fallback_username' => 'getFallbackUsername', + 'fallback_password' => 'getFallbackPassword' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('redirect_url', $data ?? [], null); + $this->setIfExists('redirect_method', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('redirect_fallback_url', $data ?? [], null); + $this->setIfExists('redirect_fallback_method', $data ?? [], null); + $this->setIfExists('fallback_username', $data ?? [], null); + $this->setIfExists('fallback_password', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['username']) && (mb_strlen($this->container['username']) > 1024)) { + $invalidProperties[] = "invalid value for 'username', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['password']) && (mb_strlen($this->container['password']) > 1024)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['fallback_username']) && (mb_strlen($this->container['fallback_username']) > 1024)) { + $invalidProperties[] = "invalid value for 'fallback_username', the character length must be smaller than or equal to 1024."; + } + + if (!is_null($this->container['fallback_password']) && (mb_strlen($this->container['fallback_password']) > 1024)) { + $invalidProperties[] = "invalid value for 'fallback_password', the character length must be smaller than or equal to 1024."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets status + * + * @return \Bandwidth\Model\ConferenceStateEnum|null + */ + public function getStatus(): ?\Bandwidth\Model\ConferenceStateEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\ConferenceStateEnum|null $status status + * + * @return $this + */ + public function setStatus(?\Bandwidth\Model\ConferenceStateEnum $status): static + { + if (is_null($status)) { + array_push($this->openAPINullablesSetToNull, 'status'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('status', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets redirect_url + * + * @return string|null + */ + public function getRedirectUrl(): ?string + { + return $this->container['redirect_url']; + } + + /** + * Sets redirect_url + * + * @param string|null $redirect_url 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 $this + */ + public function setRedirectUrl(?string $redirect_url): static + { + if (is_null($redirect_url)) { + array_push($this->openAPINullablesSetToNull, 'redirect_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redirect_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redirect_url'] = $redirect_url; + + return $this; + } + + /** + * Gets redirect_method + * + * @return \Bandwidth\Model\RedirectMethodEnum|null + */ + public function getRedirectMethod(): ?\Bandwidth\Model\RedirectMethodEnum + { + return $this->container['redirect_method']; + } + + /** + * Sets redirect_method + * + * @param \Bandwidth\Model\RedirectMethodEnum|null $redirect_method redirect_method + * + * @return $this + */ + public function setRedirectMethod(?\Bandwidth\Model\RedirectMethodEnum $redirect_method): static + { + if (is_null($redirect_method)) { + array_push($this->openAPINullablesSetToNull, 'redirect_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redirect_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redirect_method'] = $redirect_method; + + return $this; + } + + /** + * Gets username + * + * @return string|null + */ + public function getUsername(): ?string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string|null $username Basic auth username. + * + * @return $this + */ + public function setUsername(?string $username): static + { + if (is_null($username)) { + array_push($this->openAPINullablesSetToNull, 'username'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('username', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($username) && (mb_strlen($username) > 1024)) { + throw new InvalidArgumentException('invalid length for $username when calling UpdateConference., must be smaller than or equal to 1024.'); + } + + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password + * + * @return string|null + */ + public function getPassword(): ?string + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string|null $password Basic auth password. + * + * @return $this + */ + public function setPassword(?string $password): static + { + if (is_null($password)) { + array_push($this->openAPINullablesSetToNull, 'password'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('password', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($password) && (mb_strlen($password) > 1024)) { + throw new InvalidArgumentException('invalid length for $password when calling UpdateConference., must be smaller than or equal to 1024.'); + } + + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets redirect_fallback_url + * + * @return string|null + */ + public function getRedirectFallbackUrl(): ?string + { + return $this->container['redirect_fallback_url']; + } + + /** + * Sets redirect_fallback_url + * + * @param string|null $redirect_fallback_url 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 $this + */ + public function setRedirectFallbackUrl(?string $redirect_fallback_url): static + { + if (is_null($redirect_fallback_url)) { + array_push($this->openAPINullablesSetToNull, 'redirect_fallback_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redirect_fallback_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redirect_fallback_url'] = $redirect_fallback_url; + + return $this; + } + + /** + * Gets redirect_fallback_method + * + * @return \Bandwidth\Model\RedirectMethodEnum|null + */ + public function getRedirectFallbackMethod(): ?\Bandwidth\Model\RedirectMethodEnum + { + return $this->container['redirect_fallback_method']; + } + + /** + * Sets redirect_fallback_method + * + * @param \Bandwidth\Model\RedirectMethodEnum|null $redirect_fallback_method redirect_fallback_method + * + * @return $this + */ + public function setRedirectFallbackMethod(?\Bandwidth\Model\RedirectMethodEnum $redirect_fallback_method): static + { + if (is_null($redirect_fallback_method)) { + array_push($this->openAPINullablesSetToNull, 'redirect_fallback_method'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('redirect_fallback_method', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['redirect_fallback_method'] = $redirect_fallback_method; + + return $this; + } + + /** + * Gets fallback_username + * + * @return string|null + */ + public function getFallbackUsername(): ?string + { + return $this->container['fallback_username']; + } + + /** + * Sets fallback_username + * + * @param string|null $fallback_username Basic auth username. + * + * @return $this + */ + public function setFallbackUsername(?string $fallback_username): static + { + if (is_null($fallback_username)) { + array_push($this->openAPINullablesSetToNull, 'fallback_username'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_username', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($fallback_username) && (mb_strlen($fallback_username) > 1024)) { + throw new InvalidArgumentException('invalid length for $fallback_username when calling UpdateConference., must be smaller than or equal to 1024.'); + } + + $this->container['fallback_username'] = $fallback_username; + + return $this; + } + + /** + * Gets fallback_password + * + * @return string|null + */ + public function getFallbackPassword(): ?string + { + return $this->container['fallback_password']; + } + + /** + * Sets fallback_password + * + * @param string|null $fallback_password Basic auth password. + * + * @return $this + */ + public function setFallbackPassword(?string $fallback_password): static + { + if (is_null($fallback_password)) { + array_push($this->openAPINullablesSetToNull, 'fallback_password'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fallback_password', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($fallback_password) && (mb_strlen($fallback_password) > 1024)) { + throw new InvalidArgumentException('invalid length for $fallback_password when calling UpdateConference., must be smaller than or equal to 1024.'); + } + + $this->container['fallback_password'] = $fallback_password; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/UpdateConferenceMember.php b/src/Model/UpdateConferenceMember.php new file mode 100644 index 0000000..d2e400d --- /dev/null +++ b/src/Model/UpdateConferenceMember.php @@ -0,0 +1,459 @@ + + */ +class UpdateConferenceMember implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'updateConferenceMember'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'mute' => 'bool', + 'hold' => 'bool', + 'call_ids_to_coach' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'mute' => null, + 'hold' => null, + 'call_ids_to_coach' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'mute' => false, + 'hold' => false, + 'call_ids_to_coach' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'mute' => 'mute', + 'hold' => 'hold', + 'call_ids_to_coach' => 'callIdsToCoach' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'mute' => 'setMute', + 'hold' => 'setHold', + 'call_ids_to_coach' => 'setCallIdsToCoach' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'mute' => 'getMute', + 'hold' => 'getHold', + 'call_ids_to_coach' => 'getCallIdsToCoach' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('mute', $data ?? [], null); + $this->setIfExists('hold', $data ?? [], null); + $this->setIfExists('call_ids_to_coach', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mute + * + * @return bool|null + */ + public function getMute(): ?bool + { + return $this->container['mute']; + } + + /** + * Sets mute + * + * @param bool|null $mute 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 $this + */ + public function setMute(?bool $mute): static + { + if (is_null($mute)) { + throw new InvalidArgumentException('non-nullable mute cannot be null'); + } + $this->container['mute'] = $mute; + + return $this; + } + + /** + * Gets hold + * + * @return bool|null + */ + public function getHold(): ?bool + { + return $this->container['hold']; + } + + /** + * Sets hold + * + * @param bool|null $hold 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 $this + */ + public function setHold(?bool $hold): static + { + if (is_null($hold)) { + throw new InvalidArgumentException('non-nullable hold cannot be null'); + } + $this->container['hold'] = $hold; + + return $this; + } + + /** + * Gets call_ids_to_coach + * + * @return string[]|null + */ + public function getCallIdsToCoach(): ?array + { + return $this->container['call_ids_to_coach']; + } + + /** + * Sets call_ids_to_coach + * + * @param string[]|null $call_ids_to_coach 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 $this + */ + public function setCallIdsToCoach(?array $call_ids_to_coach): static + { + if (is_null($call_ids_to_coach)) { + array_push($this->openAPINullablesSetToNull, 'call_ids_to_coach'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('call_ids_to_coach', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['call_ids_to_coach'] = $call_ids_to_coach; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/VerificationDenialWebhook.php b/src/Model/VerificationDenialWebhook.php new file mode 100644 index 0000000..64e176b --- /dev/null +++ b/src/Model/VerificationDenialWebhook.php @@ -0,0 +1,712 @@ + + */ +class VerificationDenialWebhook implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'verificationDenialWebhook'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'account_id' => 'string', + 'additional_denial_reasons' => '\Bandwidth\Model\AdditionalDenialReason[]', + 'decline_reason_description' => 'string', + 'denial_status_code' => 'int', + 'internal_ticket_number' => 'string', + 'phone_number' => 'string', + 'resubmit_allowed' => 'bool', + 'status' => 'string', + 'blocked' => 'bool', + 'blocked_reason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'account_id' => null, + 'additional_denial_reasons' => null, + 'decline_reason_description' => null, + 'denial_status_code' => null, + 'internal_ticket_number' => null, + 'phone_number' => null, + 'resubmit_allowed' => null, + 'status' => null, + 'blocked' => null, + 'blocked_reason' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'additional_denial_reasons' => false, + 'decline_reason_description' => false, + 'denial_status_code' => false, + 'internal_ticket_number' => false, + 'phone_number' => false, + 'resubmit_allowed' => false, + 'status' => false, + 'blocked' => false, + 'blocked_reason' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'account_id' => 'accountId', + 'additional_denial_reasons' => 'additionalDenialReasons', + 'decline_reason_description' => 'declineReasonDescription', + 'denial_status_code' => 'denialStatusCode', + 'internal_ticket_number' => 'internalTicketNumber', + 'phone_number' => 'phoneNumber', + 'resubmit_allowed' => 'resubmitAllowed', + 'status' => 'status', + 'blocked' => 'blocked', + 'blocked_reason' => 'blockedReason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'account_id' => 'setAccountId', + 'additional_denial_reasons' => 'setAdditionalDenialReasons', + 'decline_reason_description' => 'setDeclineReasonDescription', + 'denial_status_code' => 'setDenialStatusCode', + 'internal_ticket_number' => 'setInternalTicketNumber', + 'phone_number' => 'setPhoneNumber', + 'resubmit_allowed' => 'setResubmitAllowed', + 'status' => 'setStatus', + 'blocked' => 'setBlocked', + 'blocked_reason' => 'setBlockedReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'account_id' => 'getAccountId', + 'additional_denial_reasons' => 'getAdditionalDenialReasons', + 'decline_reason_description' => 'getDeclineReasonDescription', + 'denial_status_code' => 'getDenialStatusCode', + 'internal_ticket_number' => 'getInternalTicketNumber', + 'phone_number' => 'getPhoneNumber', + 'resubmit_allowed' => 'getResubmitAllowed', + 'status' => 'getStatus', + 'blocked' => 'getBlocked', + 'blocked_reason' => 'getBlockedReason' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('additional_denial_reasons', $data ?? [], null); + $this->setIfExists('decline_reason_description', $data ?? [], null); + $this->setIfExists('denial_status_code', $data ?? [], null); + $this->setIfExists('internal_ticket_number', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('resubmit_allowed', $data ?? [], null); + $this->setIfExists('status', $data ?? [], 'UNVERIFIED'); + $this->setIfExists('blocked', $data ?? [], null); + $this->setIfExists('blocked_reason', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) > 12)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be smaller than or equal to 12."; + } + + if (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) < 12)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be bigger than or equal to 12."; + } + + if (!is_null($this->container['phone_number']) && !preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $this->container['phone_number'])) { + $invalidProperties[] = "invalid value for 'phone_number', must be conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id User's account ID. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets additional_denial_reasons + * + * @return \Bandwidth\Model\AdditionalDenialReason[]|null + */ + public function getAdditionalDenialReasons(): ?array + { + return $this->container['additional_denial_reasons']; + } + + /** + * Sets additional_denial_reasons + * + * @param \Bandwidth\Model\AdditionalDenialReason[]|null $additional_denial_reasons An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. + * + * @return $this + */ + public function setAdditionalDenialReasons(?array $additional_denial_reasons): static + { + if (is_null($additional_denial_reasons)) { + throw new InvalidArgumentException('non-nullable additional_denial_reasons cannot be null'); + } + $this->container['additional_denial_reasons'] = $additional_denial_reasons; + + return $this; + } + + /** + * Gets decline_reason_description + * + * @return string|null + */ + public function getDeclineReasonDescription(): ?string + { + return $this->container['decline_reason_description']; + } + + /** + * Sets decline_reason_description + * + * @param string|null $decline_reason_description Explanation for why a verification request was declined. + * + * @return $this + */ + public function setDeclineReasonDescription(?string $decline_reason_description): static + { + if (is_null($decline_reason_description)) { + throw new InvalidArgumentException('non-nullable decline_reason_description cannot be null'); + } + $this->container['decline_reason_description'] = $decline_reason_description; + + return $this; + } + + /** + * Gets denial_status_code + * + * @return int|null + */ + public function getDenialStatusCode(): ?int + { + return $this->container['denial_status_code']; + } + + /** + * Sets denial_status_code + * + * @param int|null $denial_status_code Reason code for denial. + * + * @return $this + */ + public function setDenialStatusCode(?int $denial_status_code): static + { + if (is_null($denial_status_code)) { + throw new InvalidArgumentException('non-nullable denial_status_code cannot be null'); + } + $this->container['denial_status_code'] = $denial_status_code; + + return $this; + } + + /** + * Gets internal_ticket_number + * + * @return string|null + */ + public function getInternalTicketNumber(): ?string + { + return $this->container['internal_ticket_number']; + } + + /** + * Sets internal_ticket_number + * + * @param string|null $internal_ticket_number Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + * + * @return $this + */ + public function setInternalTicketNumber(?string $internal_ticket_number): static + { + if (is_null($internal_ticket_number)) { + throw new InvalidArgumentException('non-nullable internal_ticket_number cannot be null'); + } + $this->container['internal_ticket_number'] = $internal_ticket_number; + + return $this; + } + + /** + * Gets phone_number + * + * @return string|null + */ + public function getPhoneNumber(): ?string + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string|null $phone_number Toll-free telephone number in E.164 format. + * + * @return $this + */ + public function setPhoneNumber(?string $phone_number): static + { + if (is_null($phone_number)) { + throw new InvalidArgumentException('non-nullable phone_number cannot be null'); + } + if ((mb_strlen($phone_number) > 12)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling VerificationDenialWebhook., must be smaller than or equal to 12.'); + } + if ((mb_strlen($phone_number) < 12)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling VerificationDenialWebhook., must be bigger than or equal to 12.'); + } + if ((!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", ObjectSerializer::toString($phone_number)))) { + throw new InvalidArgumentException("invalid value for \$phone_number when calling VerificationDenialWebhook., must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets resubmit_allowed + * + * @return bool|null + */ + public function getResubmitAllowed(): ?bool + { + return $this->container['resubmit_allowed']; + } + + /** + * Sets resubmit_allowed + * + * @param bool|null $resubmit_allowed Whether a Toll-Free Verification request qualifies for resubmission via PUT. + * + * @return $this + */ + public function setResubmitAllowed(?bool $resubmit_allowed): static + { + if (is_null($resubmit_allowed)) { + throw new InvalidArgumentException('non-nullable resubmit_allowed cannot be null'); + } + $this->container['resubmit_allowed'] = $resubmit_allowed; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus(): ?string + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return $this + */ + public function setStatus(?string $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets blocked + * + * @return bool|null + */ + public function getBlocked(): ?bool + { + return $this->container['blocked']; + } + + /** + * Sets blocked + * + * @param bool|null $blocked Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. + * + * @return $this + */ + public function setBlocked(?bool $blocked): static + { + if (is_null($blocked)) { + throw new InvalidArgumentException('non-nullable blocked cannot be null'); + } + $this->container['blocked'] = $blocked; + + return $this; + } + + /** + * Gets blocked_reason + * + * @return string|null + */ + public function getBlockedReason(): ?string + { + return $this->container['blocked_reason']; + } + + /** + * Sets blocked_reason + * + * @param string|null $blocked_reason The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. + * + * @return $this + */ + public function setBlockedReason(?string $blocked_reason): static + { + if (is_null($blocked_reason)) { + throw new InvalidArgumentException('non-nullable blocked_reason cannot be null'); + } + $this->container['blocked_reason'] = $blocked_reason; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/VerificationRequest.php b/src/Model/VerificationRequest.php new file mode 100644 index 0000000..a7e9e50 --- /dev/null +++ b/src/Model/VerificationRequest.php @@ -0,0 +1,1265 @@ + + */ +class VerificationRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'verificationRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'business_address' => '\Bandwidth\Model\Address', + 'business_contact' => '\Bandwidth\Model\Contact', + 'message_volume' => 'int', + 'phone_numbers' => 'string[]', + 'use_case' => 'string', + 'use_case_summary' => 'string', + 'production_message_content' => 'string', + 'opt_in_workflow' => '\Bandwidth\Model\OptInWorkflow', + 'additional_information' => 'string', + 'isv_reseller' => 'string', + 'privacy_policy_url' => 'string', + 'terms_and_conditions_url' => 'string', + 'business_dba' => 'string', + 'business_registration_number' => 'string', + 'business_registration_type' => '\Bandwidth\Model\BusinessRegistrationTypeEnum', + 'business_registration_issuing_country' => 'string', + 'business_entity_type' => '\Bandwidth\Model\BusinessEntityTypeEnum', + 'help_message_response' => 'string', + 'age_gated_content' => 'bool', + 'cv_token' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'business_address' => null, + 'business_contact' => null, + 'message_volume' => null, + 'phone_numbers' => null, + 'use_case' => null, + 'use_case_summary' => null, + 'production_message_content' => null, + 'opt_in_workflow' => null, + 'additional_information' => null, + 'isv_reseller' => null, + 'privacy_policy_url' => null, + 'terms_and_conditions_url' => null, + 'business_dba' => null, + 'business_registration_number' => null, + 'business_registration_type' => null, + 'business_registration_issuing_country' => null, + 'business_entity_type' => null, + 'help_message_response' => null, + 'age_gated_content' => null, + 'cv_token' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'business_address' => false, + 'business_contact' => false, + 'message_volume' => false, + 'phone_numbers' => false, + 'use_case' => false, + 'use_case_summary' => false, + 'production_message_content' => false, + 'opt_in_workflow' => false, + 'additional_information' => true, + 'isv_reseller' => true, + 'privacy_policy_url' => false, + 'terms_and_conditions_url' => false, + 'business_dba' => false, + 'business_registration_number' => true, + 'business_registration_type' => true, + 'business_registration_issuing_country' => true, + 'business_entity_type' => false, + 'help_message_response' => true, + 'age_gated_content' => false, + 'cv_token' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'business_address' => 'businessAddress', + 'business_contact' => 'businessContact', + 'message_volume' => 'messageVolume', + 'phone_numbers' => 'phoneNumbers', + 'use_case' => 'useCase', + 'use_case_summary' => 'useCaseSummary', + 'production_message_content' => 'productionMessageContent', + 'opt_in_workflow' => 'optInWorkflow', + 'additional_information' => 'additionalInformation', + 'isv_reseller' => 'isvReseller', + 'privacy_policy_url' => 'privacyPolicyUrl', + 'terms_and_conditions_url' => 'termsAndConditionsUrl', + 'business_dba' => 'businessDba', + 'business_registration_number' => 'businessRegistrationNumber', + 'business_registration_type' => 'businessRegistrationType', + 'business_registration_issuing_country' => 'businessRegistrationIssuingCountry', + 'business_entity_type' => 'businessEntityType', + 'help_message_response' => 'helpMessageResponse', + 'age_gated_content' => 'ageGatedContent', + 'cv_token' => 'cvToken' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'business_address' => 'setBusinessAddress', + 'business_contact' => 'setBusinessContact', + 'message_volume' => 'setMessageVolume', + 'phone_numbers' => 'setPhoneNumbers', + 'use_case' => 'setUseCase', + 'use_case_summary' => 'setUseCaseSummary', + 'production_message_content' => 'setProductionMessageContent', + 'opt_in_workflow' => 'setOptInWorkflow', + 'additional_information' => 'setAdditionalInformation', + 'isv_reseller' => 'setIsvReseller', + 'privacy_policy_url' => 'setPrivacyPolicyUrl', + 'terms_and_conditions_url' => 'setTermsAndConditionsUrl', + 'business_dba' => 'setBusinessDba', + 'business_registration_number' => 'setBusinessRegistrationNumber', + 'business_registration_type' => 'setBusinessRegistrationType', + 'business_registration_issuing_country' => 'setBusinessRegistrationIssuingCountry', + 'business_entity_type' => 'setBusinessEntityType', + 'help_message_response' => 'setHelpMessageResponse', + 'age_gated_content' => 'setAgeGatedContent', + 'cv_token' => 'setCvToken' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'business_address' => 'getBusinessAddress', + 'business_contact' => 'getBusinessContact', + 'message_volume' => 'getMessageVolume', + 'phone_numbers' => 'getPhoneNumbers', + 'use_case' => 'getUseCase', + 'use_case_summary' => 'getUseCaseSummary', + 'production_message_content' => 'getProductionMessageContent', + 'opt_in_workflow' => 'getOptInWorkflow', + 'additional_information' => 'getAdditionalInformation', + 'isv_reseller' => 'getIsvReseller', + 'privacy_policy_url' => 'getPrivacyPolicyUrl', + 'terms_and_conditions_url' => 'getTermsAndConditionsUrl', + 'business_dba' => 'getBusinessDba', + 'business_registration_number' => 'getBusinessRegistrationNumber', + 'business_registration_type' => 'getBusinessRegistrationType', + 'business_registration_issuing_country' => 'getBusinessRegistrationIssuingCountry', + 'business_entity_type' => 'getBusinessEntityType', + 'help_message_response' => 'getHelpMessageResponse', + 'age_gated_content' => 'getAgeGatedContent', + 'cv_token' => 'getCvToken' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('business_address', $data ?? [], null); + $this->setIfExists('business_contact', $data ?? [], null); + $this->setIfExists('message_volume', $data ?? [], null); + $this->setIfExists('phone_numbers', $data ?? [], null); + $this->setIfExists('use_case', $data ?? [], null); + $this->setIfExists('use_case_summary', $data ?? [], null); + $this->setIfExists('production_message_content', $data ?? [], null); + $this->setIfExists('opt_in_workflow', $data ?? [], null); + $this->setIfExists('additional_information', $data ?? [], null); + $this->setIfExists('isv_reseller', $data ?? [], null); + $this->setIfExists('privacy_policy_url', $data ?? [], null); + $this->setIfExists('terms_and_conditions_url', $data ?? [], null); + $this->setIfExists('business_dba', $data ?? [], null); + $this->setIfExists('business_registration_number', $data ?? [], null); + $this->setIfExists('business_registration_type', $data ?? [], null); + $this->setIfExists('business_registration_issuing_country', $data ?? [], null); + $this->setIfExists('business_entity_type', $data ?? [], null); + $this->setIfExists('help_message_response', $data ?? [], null); + $this->setIfExists('age_gated_content', $data ?? [], null); + $this->setIfExists('cv_token', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['business_address'] === null) { + $invalidProperties[] = "'business_address' can't be null"; + } + if ($this->container['business_contact'] === null) { + $invalidProperties[] = "'business_contact' can't be null"; + } + if ($this->container['message_volume'] === null) { + $invalidProperties[] = "'message_volume' can't be null"; + } + if (($this->container['message_volume'] > 10000000)) { + $invalidProperties[] = "invalid value for 'message_volume', must be smaller than or equal to 10000000."; + } + + if (($this->container['message_volume'] < 10)) { + $invalidProperties[] = "invalid value for 'message_volume', must be bigger than or equal to 10."; + } + + if ($this->container['phone_numbers'] === null) { + $invalidProperties[] = "'phone_numbers' can't be null"; + } + if ((count($this->container['phone_numbers']) > 10)) { + $invalidProperties[] = "invalid value for 'phone_numbers', number of items must be less than or equal to 10."; + } + + if ((count($this->container['phone_numbers']) < 1)) { + $invalidProperties[] = "invalid value for 'phone_numbers', number of items must be greater than or equal to 1."; + } + + if ($this->container['use_case'] === null) { + $invalidProperties[] = "'use_case' can't be null"; + } + if ((mb_strlen($this->container['use_case']) > 500)) { + $invalidProperties[] = "invalid value for 'use_case', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['use_case']) < 0)) { + $invalidProperties[] = "invalid value for 'use_case', the character length must be bigger than or equal to 0."; + } + + if ($this->container['use_case_summary'] === null) { + $invalidProperties[] = "'use_case_summary' can't be null"; + } + if ((mb_strlen($this->container['use_case_summary']) > 500)) { + $invalidProperties[] = "invalid value for 'use_case_summary', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['use_case_summary']) < 0)) { + $invalidProperties[] = "invalid value for 'use_case_summary', the character length must be bigger than or equal to 0."; + } + + if ($this->container['production_message_content'] === null) { + $invalidProperties[] = "'production_message_content' can't be null"; + } + if ((mb_strlen($this->container['production_message_content']) > 500)) { + $invalidProperties[] = "invalid value for 'production_message_content', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['production_message_content']) < 0)) { + $invalidProperties[] = "invalid value for 'production_message_content', the character length must be bigger than or equal to 0."; + } + + if ($this->container['opt_in_workflow'] === null) { + $invalidProperties[] = "'opt_in_workflow' can't be null"; + } + if (!is_null($this->container['additional_information']) && (mb_strlen($this->container['additional_information']) > 500)) { + $invalidProperties[] = "invalid value for 'additional_information', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['additional_information']) && (mb_strlen($this->container['additional_information']) < 0)) { + $invalidProperties[] = "invalid value for 'additional_information', the character length must be bigger than or equal to 0."; + } + + if (!is_null($this->container['isv_reseller']) && (mb_strlen($this->container['isv_reseller']) > 500)) { + $invalidProperties[] = "invalid value for 'isv_reseller', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['isv_reseller']) && (mb_strlen($this->container['isv_reseller']) < 0)) { + $invalidProperties[] = "invalid value for 'isv_reseller', the character length must be bigger than or equal to 0."; + } + + if (!is_null($this->container['privacy_policy_url']) && (mb_strlen($this->container['privacy_policy_url']) > 500)) { + $invalidProperties[] = "invalid value for 'privacy_policy_url', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['terms_and_conditions_url']) && (mb_strlen($this->container['terms_and_conditions_url']) > 500)) { + $invalidProperties[] = "invalid value for 'terms_and_conditions_url', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['business_dba']) && (mb_strlen($this->container['business_dba']) > 500)) { + $invalidProperties[] = "invalid value for 'business_dba', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['business_registration_number']) && (mb_strlen($this->container['business_registration_number']) > 500)) { + $invalidProperties[] = "invalid value for 'business_registration_number', the character length must be smaller than or equal to 500."; + } + + if ($this->container['business_entity_type'] === null) { + $invalidProperties[] = "'business_entity_type' can't be null"; + } + if (!is_null($this->container['help_message_response']) && (mb_strlen($this->container['help_message_response']) > 500)) { + $invalidProperties[] = "invalid value for 'help_message_response', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['cv_token']) && (mb_strlen($this->container['cv_token']) > 500)) { + $invalidProperties[] = "invalid value for 'cv_token', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['cv_token']) && (mb_strlen($this->container['cv_token']) < 0)) { + $invalidProperties[] = "invalid value for 'cv_token', the character length must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets business_address + * + * @return \Bandwidth\Model\Address + */ + public function getBusinessAddress(): \Bandwidth\Model\Address + { + return $this->container['business_address']; + } + + /** + * Sets business_address + * + * @param \Bandwidth\Model\Address $business_address business_address + * + * @return $this + */ + public function setBusinessAddress(\Bandwidth\Model\Address $business_address): static + { + if (is_null($business_address)) { + throw new InvalidArgumentException('non-nullable business_address cannot be null'); + } + $this->container['business_address'] = $business_address; + + return $this; + } + + /** + * Gets business_contact + * + * @return \Bandwidth\Model\Contact + */ + public function getBusinessContact(): \Bandwidth\Model\Contact + { + return $this->container['business_contact']; + } + + /** + * Sets business_contact + * + * @param \Bandwidth\Model\Contact $business_contact business_contact + * + * @return $this + */ + public function setBusinessContact(\Bandwidth\Model\Contact $business_contact): static + { + if (is_null($business_contact)) { + throw new InvalidArgumentException('non-nullable business_contact cannot be null'); + } + $this->container['business_contact'] = $business_contact; + + return $this; + } + + /** + * Gets message_volume + * + * @return int + */ + public function getMessageVolume(): int + { + return $this->container['message_volume']; + } + + /** + * Sets message_volume + * + * @param int $message_volume Estimated monthly volume of messages from the toll-free number. + * + * @return $this + */ + public function setMessageVolume(int $message_volume): static + { + if (is_null($message_volume)) { + throw new InvalidArgumentException('non-nullable message_volume cannot be null'); + } + if (($message_volume > 10000000)) { + throw new InvalidArgumentException('invalid value for $message_volume when calling VerificationRequest., must be smaller than or equal to 10000000.'); + } + if (($message_volume < 10)) { + throw new InvalidArgumentException('invalid value for $message_volume when calling VerificationRequest., must be bigger than or equal to 10.'); + } + + $this->container['message_volume'] = $message_volume; + + return $this; + } + + /** + * Gets phone_numbers + * + * @return string[] + */ + public function getPhoneNumbers(): array + { + return $this->container['phone_numbers']; + } + + /** + * Sets phone_numbers + * + * @param string[] $phone_numbers phone_numbers + * + * @return $this + */ + public function setPhoneNumbers(array $phone_numbers): static + { + if (is_null($phone_numbers)) { + throw new InvalidArgumentException('non-nullable phone_numbers cannot be null'); + } + if ((count($phone_numbers) > 10)) { + throw new InvalidArgumentException('invalid value for $phone_numbers when calling VerificationRequest., number of items must be less than or equal to 10.'); + } + if ((count($phone_numbers) < 1)) { + throw new InvalidArgumentException('invalid length for $phone_numbers when calling VerificationRequest., number of items must be greater than or equal to 1.'); + } + $this->container['phone_numbers'] = $phone_numbers; + + return $this; + } + + /** + * Gets use_case + * + * @return string + */ + public function getUseCase(): string + { + return $this->container['use_case']; + } + + /** + * Sets use_case + * + * @param string $use_case The category of the use case. + * + * @return $this + */ + public function setUseCase(string $use_case): static + { + if (is_null($use_case)) { + throw new InvalidArgumentException('non-nullable use_case cannot be null'); + } + if ((mb_strlen($use_case) > 500)) { + throw new InvalidArgumentException('invalid length for $use_case when calling VerificationRequest., must be smaller than or equal to 500.'); + } + if ((mb_strlen($use_case) < 0)) { + throw new InvalidArgumentException('invalid length for $use_case when calling VerificationRequest., must be bigger than or equal to 0.'); + } + + $this->container['use_case'] = $use_case; + + return $this; + } + + /** + * Gets use_case_summary + * + * @return string + */ + public function getUseCaseSummary(): string + { + return $this->container['use_case_summary']; + } + + /** + * Sets use_case_summary + * + * @param string $use_case_summary A general idea of the use case and customer. + * + * @return $this + */ + public function setUseCaseSummary(string $use_case_summary): static + { + if (is_null($use_case_summary)) { + throw new InvalidArgumentException('non-nullable use_case_summary cannot be null'); + } + if ((mb_strlen($use_case_summary) > 500)) { + throw new InvalidArgumentException('invalid length for $use_case_summary when calling VerificationRequest., must be smaller than or equal to 500.'); + } + if ((mb_strlen($use_case_summary) < 0)) { + throw new InvalidArgumentException('invalid length for $use_case_summary when calling VerificationRequest., must be bigger than or equal to 0.'); + } + + $this->container['use_case_summary'] = $use_case_summary; + + return $this; + } + + /** + * Gets production_message_content + * + * @return string + */ + public function getProductionMessageContent(): string + { + return $this->container['production_message_content']; + } + + /** + * Sets production_message_content + * + * @param string $production_message_content Example of message content. + * + * @return $this + */ + public function setProductionMessageContent(string $production_message_content): static + { + if (is_null($production_message_content)) { + throw new InvalidArgumentException('non-nullable production_message_content cannot be null'); + } + if ((mb_strlen($production_message_content) > 500)) { + throw new InvalidArgumentException('invalid length for $production_message_content when calling VerificationRequest., must be smaller than or equal to 500.'); + } + if ((mb_strlen($production_message_content) < 0)) { + throw new InvalidArgumentException('invalid length for $production_message_content when calling VerificationRequest., must be bigger than or equal to 0.'); + } + + $this->container['production_message_content'] = $production_message_content; + + return $this; + } + + /** + * Gets opt_in_workflow + * + * @return \Bandwidth\Model\OptInWorkflow + */ + public function getOptInWorkflow(): \Bandwidth\Model\OptInWorkflow + { + return $this->container['opt_in_workflow']; + } + + /** + * Sets opt_in_workflow + * + * @param \Bandwidth\Model\OptInWorkflow $opt_in_workflow opt_in_workflow + * + * @return $this + */ + public function setOptInWorkflow(\Bandwidth\Model\OptInWorkflow $opt_in_workflow): static + { + if (is_null($opt_in_workflow)) { + throw new InvalidArgumentException('non-nullable opt_in_workflow cannot be null'); + } + $this->container['opt_in_workflow'] = $opt_in_workflow; + + return $this; + } + + /** + * Gets additional_information + * + * @return string|null + */ + public function getAdditionalInformation(): ?string + { + return $this->container['additional_information']; + } + + /** + * Sets additional_information + * + * @param string|null $additional_information Any additional information. + * + * @return $this + */ + public function setAdditionalInformation(?string $additional_information): static + { + if (is_null($additional_information)) { + array_push($this->openAPINullablesSetToNull, 'additional_information'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additional_information', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($additional_information) && (mb_strlen($additional_information) > 500)) { + throw new InvalidArgumentException('invalid length for $additional_information when calling VerificationRequest., must be smaller than or equal to 500.'); + } + if (!is_null($additional_information) && (mb_strlen($additional_information) < 0)) { + throw new InvalidArgumentException('invalid length for $additional_information when calling VerificationRequest., must be bigger than or equal to 0.'); + } + + $this->container['additional_information'] = $additional_information; + + return $this; + } + + /** + * Gets isv_reseller + * + * @return string|null + */ + public function getIsvReseller(): ?string + { + return $this->container['isv_reseller']; + } + + /** + * Sets isv_reseller + * + * @param string|null $isv_reseller ISV name. + * + * @return $this + */ + public function setIsvReseller(?string $isv_reseller): static + { + if (is_null($isv_reseller)) { + array_push($this->openAPINullablesSetToNull, 'isv_reseller'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isv_reseller', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($isv_reseller) && (mb_strlen($isv_reseller) > 500)) { + throw new InvalidArgumentException('invalid length for $isv_reseller when calling VerificationRequest., must be smaller than or equal to 500.'); + } + if (!is_null($isv_reseller) && (mb_strlen($isv_reseller) < 0)) { + throw new InvalidArgumentException('invalid length for $isv_reseller when calling VerificationRequest., must be bigger than or equal to 0.'); + } + + $this->container['isv_reseller'] = $isv_reseller; + + return $this; + } + + /** + * Gets privacy_policy_url + * + * @return string|null + */ + public function getPrivacyPolicyUrl(): ?string + { + return $this->container['privacy_policy_url']; + } + + /** + * Sets privacy_policy_url + * + * @param string|null $privacy_policy_url The Toll-Free Verification request privacy policy URL. + * + * @return $this + */ + public function setPrivacyPolicyUrl(?string $privacy_policy_url): static + { + if (is_null($privacy_policy_url)) { + throw new InvalidArgumentException('non-nullable privacy_policy_url cannot be null'); + } + if ((mb_strlen($privacy_policy_url) > 500)) { + throw new InvalidArgumentException('invalid length for $privacy_policy_url when calling VerificationRequest., must be smaller than or equal to 500.'); + } + + $this->container['privacy_policy_url'] = $privacy_policy_url; + + return $this; + } + + /** + * Gets terms_and_conditions_url + * + * @return string|null + */ + public function getTermsAndConditionsUrl(): ?string + { + return $this->container['terms_and_conditions_url']; + } + + /** + * Sets terms_and_conditions_url + * + * @param string|null $terms_and_conditions_url The Toll-Free Verification request terms and conditions policy URL. + * + * @return $this + */ + public function setTermsAndConditionsUrl(?string $terms_and_conditions_url): static + { + if (is_null($terms_and_conditions_url)) { + throw new InvalidArgumentException('non-nullable terms_and_conditions_url cannot be null'); + } + if ((mb_strlen($terms_and_conditions_url) > 500)) { + throw new InvalidArgumentException('invalid length for $terms_and_conditions_url when calling VerificationRequest., must be smaller than or equal to 500.'); + } + + $this->container['terms_and_conditions_url'] = $terms_and_conditions_url; + + return $this; + } + + /** + * Gets business_dba + * + * @return string|null + */ + public function getBusinessDba(): ?string + { + return $this->container['business_dba']; + } + + /** + * Sets business_dba + * + * @param string|null $business_dba The company 'Doing Business As'. + * + * @return $this + */ + public function setBusinessDba(?string $business_dba): static + { + if (is_null($business_dba)) { + throw new InvalidArgumentException('non-nullable business_dba cannot be null'); + } + if ((mb_strlen($business_dba) > 500)) { + throw new InvalidArgumentException('invalid length for $business_dba when calling VerificationRequest., must be smaller than or equal to 500.'); + } + + $this->container['business_dba'] = $business_dba; + + return $this; + } + + /** + * Gets business_registration_number + * + * @return string|null + */ + public function getBusinessRegistrationNumber(): ?string + { + return $this->container['business_registration_number']; + } + + /** + * Sets business_registration_number + * + * @param string|null $business_registration_number Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.** + * + * @return $this + */ + public function setBusinessRegistrationNumber(?string $business_registration_number): static + { + if (is_null($business_registration_number)) { + array_push($this->openAPINullablesSetToNull, 'business_registration_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('business_registration_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($business_registration_number) && (mb_strlen($business_registration_number) > 500)) { + throw new InvalidArgumentException('invalid length for $business_registration_number when calling VerificationRequest., must be smaller than or equal to 500.'); + } + + $this->container['business_registration_number'] = $business_registration_number; + + return $this; + } + + /** + * Gets business_registration_type + * + * @return \Bandwidth\Model\BusinessRegistrationTypeEnum|null + */ + public function getBusinessRegistrationType(): ?\Bandwidth\Model\BusinessRegistrationTypeEnum + { + return $this->container['business_registration_type']; + } + + /** + * Sets business_registration_type + * + * @param \Bandwidth\Model\BusinessRegistrationTypeEnum|null $business_registration_type business_registration_type + * + * @return $this + */ + public function setBusinessRegistrationType(?\Bandwidth\Model\BusinessRegistrationTypeEnum $business_registration_type): static + { + if (is_null($business_registration_type)) { + array_push($this->openAPINullablesSetToNull, 'business_registration_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('business_registration_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['business_registration_type'] = $business_registration_type; + + return $this; + } + + /** + * Gets business_registration_issuing_country + * + * @return string|null + */ + public function getBusinessRegistrationIssuingCountry(): ?string + { + return $this->container['business_registration_issuing_country']; + } + + /** + * Sets business_registration_issuing_country + * + * @param string|null $business_registration_issuing_country The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code | + * + * @return $this + */ + public function setBusinessRegistrationIssuingCountry(?string $business_registration_issuing_country): static + { + if (is_null($business_registration_issuing_country)) { + array_push($this->openAPINullablesSetToNull, 'business_registration_issuing_country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('business_registration_issuing_country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['business_registration_issuing_country'] = $business_registration_issuing_country; + + return $this; + } + + /** + * Gets business_entity_type + * + * @return \Bandwidth\Model\BusinessEntityTypeEnum + */ + public function getBusinessEntityType(): \Bandwidth\Model\BusinessEntityTypeEnum + { + return $this->container['business_entity_type']; + } + + /** + * Sets business_entity_type + * + * @param \Bandwidth\Model\BusinessEntityTypeEnum $business_entity_type business_entity_type + * + * @return $this + */ + public function setBusinessEntityType(\Bandwidth\Model\BusinessEntityTypeEnum $business_entity_type): static + { + if (is_null($business_entity_type)) { + throw new InvalidArgumentException('non-nullable business_entity_type cannot be null'); + } + $this->container['business_entity_type'] = $business_entity_type; + + return $this; + } + + /** + * Gets help_message_response + * + * @return string|null + */ + public function getHelpMessageResponse(): ?string + { + return $this->container['help_message_response']; + } + + /** + * Sets help_message_response + * + * @param string|null $help_message_response A message that gets sent to users requesting help. + * + * @return $this + */ + public function setHelpMessageResponse(?string $help_message_response): static + { + if (is_null($help_message_response)) { + array_push($this->openAPINullablesSetToNull, 'help_message_response'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('help_message_response', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($help_message_response) && (mb_strlen($help_message_response) > 500)) { + throw new InvalidArgumentException('invalid length for $help_message_response when calling VerificationRequest., must be smaller than or equal to 500.'); + } + + $this->container['help_message_response'] = $help_message_response; + + return $this; + } + + /** + * Gets age_gated_content + * + * @return bool|null + */ + public function getAgeGatedContent(): ?bool + { + return $this->container['age_gated_content']; + } + + /** + * Sets age_gated_content + * + * @param bool|null $age_gated_content Indicates whether the content is age-gated. + * + * @return $this + */ + public function setAgeGatedContent(?bool $age_gated_content): static + { + if (is_null($age_gated_content)) { + throw new InvalidArgumentException('non-nullable age_gated_content cannot be null'); + } + $this->container['age_gated_content'] = $age_gated_content; + + return $this; + } + + /** + * Gets cv_token + * + * @return string|null + */ + public function getCvToken(): ?string + { + return $this->container['cv_token']; + } + + /** + * Sets cv_token + * + * @param string|null $cv_token The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection. + * + * @return $this + */ + public function setCvToken(?string $cv_token): static + { + if (is_null($cv_token)) { + array_push($this->openAPINullablesSetToNull, 'cv_token'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cv_token', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($cv_token) && (mb_strlen($cv_token) > 500)) { + throw new InvalidArgumentException('invalid length for $cv_token when calling VerificationRequest., must be smaller than or equal to 500.'); + } + if (!is_null($cv_token) && (mb_strlen($cv_token) < 0)) { + throw new InvalidArgumentException('invalid length for $cv_token when calling VerificationRequest., must be bigger than or equal to 0.'); + } + + $this->container['cv_token'] = $cv_token; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/VerificationUpdateRequest.php b/src/Model/VerificationUpdateRequest.php new file mode 100644 index 0000000..5b23330 --- /dev/null +++ b/src/Model/VerificationUpdateRequest.php @@ -0,0 +1,1211 @@ + + */ +class VerificationUpdateRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'verificationUpdateRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'business_address' => '\Bandwidth\Model\Address', + 'business_contact' => '\Bandwidth\Model\Contact', + 'message_volume' => 'int', + 'use_case' => 'string', + 'use_case_summary' => 'string', + 'production_message_content' => 'string', + 'opt_in_workflow' => '\Bandwidth\Model\OptInWorkflow', + 'additional_information' => 'string', + 'isv_reseller' => 'string', + 'privacy_policy_url' => 'string', + 'terms_and_conditions_url' => 'string', + 'business_dba' => 'string', + 'business_registration_number' => 'string', + 'business_registration_type' => '\Bandwidth\Model\BusinessRegistrationTypeEnum', + 'business_entity_type' => '\Bandwidth\Model\BusinessEntityTypeEnum', + 'business_registration_issuing_country' => 'string', + 'help_message_response' => 'string', + 'age_gated_content' => 'bool', + 'cv_token' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'business_address' => null, + 'business_contact' => null, + 'message_volume' => null, + 'use_case' => null, + 'use_case_summary' => null, + 'production_message_content' => null, + 'opt_in_workflow' => null, + 'additional_information' => null, + 'isv_reseller' => null, + 'privacy_policy_url' => null, + 'terms_and_conditions_url' => null, + 'business_dba' => null, + 'business_registration_number' => null, + 'business_registration_type' => null, + 'business_entity_type' => null, + 'business_registration_issuing_country' => null, + 'help_message_response' => null, + 'age_gated_content' => null, + 'cv_token' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'business_address' => false, + 'business_contact' => false, + 'message_volume' => false, + 'use_case' => false, + 'use_case_summary' => false, + 'production_message_content' => false, + 'opt_in_workflow' => false, + 'additional_information' => true, + 'isv_reseller' => true, + 'privacy_policy_url' => false, + 'terms_and_conditions_url' => false, + 'business_dba' => false, + 'business_registration_number' => true, + 'business_registration_type' => true, + 'business_entity_type' => false, + 'business_registration_issuing_country' => true, + 'help_message_response' => true, + 'age_gated_content' => false, + 'cv_token' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'business_address' => 'businessAddress', + 'business_contact' => 'businessContact', + 'message_volume' => 'messageVolume', + 'use_case' => 'useCase', + 'use_case_summary' => 'useCaseSummary', + 'production_message_content' => 'productionMessageContent', + 'opt_in_workflow' => 'optInWorkflow', + 'additional_information' => 'additionalInformation', + 'isv_reseller' => 'isvReseller', + 'privacy_policy_url' => 'privacyPolicyUrl', + 'terms_and_conditions_url' => 'termsAndConditionsUrl', + 'business_dba' => 'businessDba', + 'business_registration_number' => 'businessRegistrationNumber', + 'business_registration_type' => 'businessRegistrationType', + 'business_entity_type' => 'businessEntityType', + 'business_registration_issuing_country' => 'businessRegistrationIssuingCountry', + 'help_message_response' => 'helpMessageResponse', + 'age_gated_content' => 'ageGatedContent', + 'cv_token' => 'cvToken' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'business_address' => 'setBusinessAddress', + 'business_contact' => 'setBusinessContact', + 'message_volume' => 'setMessageVolume', + 'use_case' => 'setUseCase', + 'use_case_summary' => 'setUseCaseSummary', + 'production_message_content' => 'setProductionMessageContent', + 'opt_in_workflow' => 'setOptInWorkflow', + 'additional_information' => 'setAdditionalInformation', + 'isv_reseller' => 'setIsvReseller', + 'privacy_policy_url' => 'setPrivacyPolicyUrl', + 'terms_and_conditions_url' => 'setTermsAndConditionsUrl', + 'business_dba' => 'setBusinessDba', + 'business_registration_number' => 'setBusinessRegistrationNumber', + 'business_registration_type' => 'setBusinessRegistrationType', + 'business_entity_type' => 'setBusinessEntityType', + 'business_registration_issuing_country' => 'setBusinessRegistrationIssuingCountry', + 'help_message_response' => 'setHelpMessageResponse', + 'age_gated_content' => 'setAgeGatedContent', + 'cv_token' => 'setCvToken' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'business_address' => 'getBusinessAddress', + 'business_contact' => 'getBusinessContact', + 'message_volume' => 'getMessageVolume', + 'use_case' => 'getUseCase', + 'use_case_summary' => 'getUseCaseSummary', + 'production_message_content' => 'getProductionMessageContent', + 'opt_in_workflow' => 'getOptInWorkflow', + 'additional_information' => 'getAdditionalInformation', + 'isv_reseller' => 'getIsvReseller', + 'privacy_policy_url' => 'getPrivacyPolicyUrl', + 'terms_and_conditions_url' => 'getTermsAndConditionsUrl', + 'business_dba' => 'getBusinessDba', + 'business_registration_number' => 'getBusinessRegistrationNumber', + 'business_registration_type' => 'getBusinessRegistrationType', + 'business_entity_type' => 'getBusinessEntityType', + 'business_registration_issuing_country' => 'getBusinessRegistrationIssuingCountry', + 'help_message_response' => 'getHelpMessageResponse', + 'age_gated_content' => 'getAgeGatedContent', + 'cv_token' => 'getCvToken' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('business_address', $data ?? [], null); + $this->setIfExists('business_contact', $data ?? [], null); + $this->setIfExists('message_volume', $data ?? [], null); + $this->setIfExists('use_case', $data ?? [], null); + $this->setIfExists('use_case_summary', $data ?? [], null); + $this->setIfExists('production_message_content', $data ?? [], null); + $this->setIfExists('opt_in_workflow', $data ?? [], null); + $this->setIfExists('additional_information', $data ?? [], null); + $this->setIfExists('isv_reseller', $data ?? [], null); + $this->setIfExists('privacy_policy_url', $data ?? [], null); + $this->setIfExists('terms_and_conditions_url', $data ?? [], null); + $this->setIfExists('business_dba', $data ?? [], null); + $this->setIfExists('business_registration_number', $data ?? [], null); + $this->setIfExists('business_registration_type', $data ?? [], null); + $this->setIfExists('business_entity_type', $data ?? [], null); + $this->setIfExists('business_registration_issuing_country', $data ?? [], null); + $this->setIfExists('help_message_response', $data ?? [], null); + $this->setIfExists('age_gated_content', $data ?? [], null); + $this->setIfExists('cv_token', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['business_address'] === null) { + $invalidProperties[] = "'business_address' can't be null"; + } + if ($this->container['business_contact'] === null) { + $invalidProperties[] = "'business_contact' can't be null"; + } + if ($this->container['message_volume'] === null) { + $invalidProperties[] = "'message_volume' can't be null"; + } + if (($this->container['message_volume'] > 10000000)) { + $invalidProperties[] = "invalid value for 'message_volume', must be smaller than or equal to 10000000."; + } + + if (($this->container['message_volume'] < 10)) { + $invalidProperties[] = "invalid value for 'message_volume', must be bigger than or equal to 10."; + } + + if ($this->container['use_case'] === null) { + $invalidProperties[] = "'use_case' can't be null"; + } + if ((mb_strlen($this->container['use_case']) > 500)) { + $invalidProperties[] = "invalid value for 'use_case', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['use_case']) < 0)) { + $invalidProperties[] = "invalid value for 'use_case', the character length must be bigger than or equal to 0."; + } + + if ($this->container['use_case_summary'] === null) { + $invalidProperties[] = "'use_case_summary' can't be null"; + } + if ((mb_strlen($this->container['use_case_summary']) > 500)) { + $invalidProperties[] = "invalid value for 'use_case_summary', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['use_case_summary']) < 0)) { + $invalidProperties[] = "invalid value for 'use_case_summary', the character length must be bigger than or equal to 0."; + } + + if ($this->container['production_message_content'] === null) { + $invalidProperties[] = "'production_message_content' can't be null"; + } + if ((mb_strlen($this->container['production_message_content']) > 500)) { + $invalidProperties[] = "invalid value for 'production_message_content', the character length must be smaller than or equal to 500."; + } + + if ((mb_strlen($this->container['production_message_content']) < 0)) { + $invalidProperties[] = "invalid value for 'production_message_content', the character length must be bigger than or equal to 0."; + } + + if ($this->container['opt_in_workflow'] === null) { + $invalidProperties[] = "'opt_in_workflow' can't be null"; + } + if (!is_null($this->container['additional_information']) && (mb_strlen($this->container['additional_information']) > 500)) { + $invalidProperties[] = "invalid value for 'additional_information', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['additional_information']) && (mb_strlen($this->container['additional_information']) < 0)) { + $invalidProperties[] = "invalid value for 'additional_information', the character length must be bigger than or equal to 0."; + } + + if (!is_null($this->container['isv_reseller']) && (mb_strlen($this->container['isv_reseller']) > 500)) { + $invalidProperties[] = "invalid value for 'isv_reseller', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['isv_reseller']) && (mb_strlen($this->container['isv_reseller']) < 0)) { + $invalidProperties[] = "invalid value for 'isv_reseller', the character length must be bigger than or equal to 0."; + } + + if (!is_null($this->container['privacy_policy_url']) && (mb_strlen($this->container['privacy_policy_url']) > 500)) { + $invalidProperties[] = "invalid value for 'privacy_policy_url', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['terms_and_conditions_url']) && (mb_strlen($this->container['terms_and_conditions_url']) > 500)) { + $invalidProperties[] = "invalid value for 'terms_and_conditions_url', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['business_dba']) && (mb_strlen($this->container['business_dba']) > 500)) { + $invalidProperties[] = "invalid value for 'business_dba', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['business_registration_number']) && (mb_strlen($this->container['business_registration_number']) > 500)) { + $invalidProperties[] = "invalid value for 'business_registration_number', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['help_message_response']) && (mb_strlen($this->container['help_message_response']) > 500)) { + $invalidProperties[] = "invalid value for 'help_message_response', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['cv_token']) && (mb_strlen($this->container['cv_token']) > 500)) { + $invalidProperties[] = "invalid value for 'cv_token', the character length must be smaller than or equal to 500."; + } + + if (!is_null($this->container['cv_token']) && (mb_strlen($this->container['cv_token']) < 0)) { + $invalidProperties[] = "invalid value for 'cv_token', the character length must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets business_address + * + * @return \Bandwidth\Model\Address + */ + public function getBusinessAddress(): \Bandwidth\Model\Address + { + return $this->container['business_address']; + } + + /** + * Sets business_address + * + * @param \Bandwidth\Model\Address $business_address business_address + * + * @return $this + */ + public function setBusinessAddress(\Bandwidth\Model\Address $business_address): static + { + if (is_null($business_address)) { + throw new InvalidArgumentException('non-nullable business_address cannot be null'); + } + $this->container['business_address'] = $business_address; + + return $this; + } + + /** + * Gets business_contact + * + * @return \Bandwidth\Model\Contact + */ + public function getBusinessContact(): \Bandwidth\Model\Contact + { + return $this->container['business_contact']; + } + + /** + * Sets business_contact + * + * @param \Bandwidth\Model\Contact $business_contact business_contact + * + * @return $this + */ + public function setBusinessContact(\Bandwidth\Model\Contact $business_contact): static + { + if (is_null($business_contact)) { + throw new InvalidArgumentException('non-nullable business_contact cannot be null'); + } + $this->container['business_contact'] = $business_contact; + + return $this; + } + + /** + * Gets message_volume + * + * @return int + */ + public function getMessageVolume(): int + { + return $this->container['message_volume']; + } + + /** + * Sets message_volume + * + * @param int $message_volume Estimated monthly volume of messages from the toll-free number. + * + * @return $this + */ + public function setMessageVolume(int $message_volume): static + { + if (is_null($message_volume)) { + throw new InvalidArgumentException('non-nullable message_volume cannot be null'); + } + if (($message_volume > 10000000)) { + throw new InvalidArgumentException('invalid value for $message_volume when calling VerificationUpdateRequest., must be smaller than or equal to 10000000.'); + } + if (($message_volume < 10)) { + throw new InvalidArgumentException('invalid value for $message_volume when calling VerificationUpdateRequest., must be bigger than or equal to 10.'); + } + + $this->container['message_volume'] = $message_volume; + + return $this; + } + + /** + * Gets use_case + * + * @return string + */ + public function getUseCase(): string + { + return $this->container['use_case']; + } + + /** + * Sets use_case + * + * @param string $use_case The category of the use case. + * + * @return $this + */ + public function setUseCase(string $use_case): static + { + if (is_null($use_case)) { + throw new InvalidArgumentException('non-nullable use_case cannot be null'); + } + if ((mb_strlen($use_case) > 500)) { + throw new InvalidArgumentException('invalid length for $use_case when calling VerificationUpdateRequest., must be smaller than or equal to 500.'); + } + if ((mb_strlen($use_case) < 0)) { + throw new InvalidArgumentException('invalid length for $use_case when calling VerificationUpdateRequest., must be bigger than or equal to 0.'); + } + + $this->container['use_case'] = $use_case; + + return $this; + } + + /** + * Gets use_case_summary + * + * @return string + */ + public function getUseCaseSummary(): string + { + return $this->container['use_case_summary']; + } + + /** + * Sets use_case_summary + * + * @param string $use_case_summary A general idea of the use case and customer. + * + * @return $this + */ + public function setUseCaseSummary(string $use_case_summary): static + { + if (is_null($use_case_summary)) { + throw new InvalidArgumentException('non-nullable use_case_summary cannot be null'); + } + if ((mb_strlen($use_case_summary) > 500)) { + throw new InvalidArgumentException('invalid length for $use_case_summary when calling VerificationUpdateRequest., must be smaller than or equal to 500.'); + } + if ((mb_strlen($use_case_summary) < 0)) { + throw new InvalidArgumentException('invalid length for $use_case_summary when calling VerificationUpdateRequest., must be bigger than or equal to 0.'); + } + + $this->container['use_case_summary'] = $use_case_summary; + + return $this; + } + + /** + * Gets production_message_content + * + * @return string + */ + public function getProductionMessageContent(): string + { + return $this->container['production_message_content']; + } + + /** + * Sets production_message_content + * + * @param string $production_message_content Example of message content. + * + * @return $this + */ + public function setProductionMessageContent(string $production_message_content): static + { + if (is_null($production_message_content)) { + throw new InvalidArgumentException('non-nullable production_message_content cannot be null'); + } + if ((mb_strlen($production_message_content) > 500)) { + throw new InvalidArgumentException('invalid length for $production_message_content when calling VerificationUpdateRequest., must be smaller than or equal to 500.'); + } + if ((mb_strlen($production_message_content) < 0)) { + throw new InvalidArgumentException('invalid length for $production_message_content when calling VerificationUpdateRequest., must be bigger than or equal to 0.'); + } + + $this->container['production_message_content'] = $production_message_content; + + return $this; + } + + /** + * Gets opt_in_workflow + * + * @return \Bandwidth\Model\OptInWorkflow + */ + public function getOptInWorkflow(): \Bandwidth\Model\OptInWorkflow + { + return $this->container['opt_in_workflow']; + } + + /** + * Sets opt_in_workflow + * + * @param \Bandwidth\Model\OptInWorkflow $opt_in_workflow opt_in_workflow + * + * @return $this + */ + public function setOptInWorkflow(\Bandwidth\Model\OptInWorkflow $opt_in_workflow): static + { + if (is_null($opt_in_workflow)) { + throw new InvalidArgumentException('non-nullable opt_in_workflow cannot be null'); + } + $this->container['opt_in_workflow'] = $opt_in_workflow; + + return $this; + } + + /** + * Gets additional_information + * + * @return string|null + */ + public function getAdditionalInformation(): ?string + { + return $this->container['additional_information']; + } + + /** + * Sets additional_information + * + * @param string|null $additional_information Any additional information. + * + * @return $this + */ + public function setAdditionalInformation(?string $additional_information): static + { + if (is_null($additional_information)) { + array_push($this->openAPINullablesSetToNull, 'additional_information'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('additional_information', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($additional_information) && (mb_strlen($additional_information) > 500)) { + throw new InvalidArgumentException('invalid length for $additional_information when calling VerificationUpdateRequest., must be smaller than or equal to 500.'); + } + if (!is_null($additional_information) && (mb_strlen($additional_information) < 0)) { + throw new InvalidArgumentException('invalid length for $additional_information when calling VerificationUpdateRequest., must be bigger than or equal to 0.'); + } + + $this->container['additional_information'] = $additional_information; + + return $this; + } + + /** + * Gets isv_reseller + * + * @return string|null + */ + public function getIsvReseller(): ?string + { + return $this->container['isv_reseller']; + } + + /** + * Sets isv_reseller + * + * @param string|null $isv_reseller ISV name. + * + * @return $this + */ + public function setIsvReseller(?string $isv_reseller): static + { + if (is_null($isv_reseller)) { + array_push($this->openAPINullablesSetToNull, 'isv_reseller'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('isv_reseller', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($isv_reseller) && (mb_strlen($isv_reseller) > 500)) { + throw new InvalidArgumentException('invalid length for $isv_reseller when calling VerificationUpdateRequest., must be smaller than or equal to 500.'); + } + if (!is_null($isv_reseller) && (mb_strlen($isv_reseller) < 0)) { + throw new InvalidArgumentException('invalid length for $isv_reseller when calling VerificationUpdateRequest., must be bigger than or equal to 0.'); + } + + $this->container['isv_reseller'] = $isv_reseller; + + return $this; + } + + /** + * Gets privacy_policy_url + * + * @return string|null + */ + public function getPrivacyPolicyUrl(): ?string + { + return $this->container['privacy_policy_url']; + } + + /** + * Sets privacy_policy_url + * + * @param string|null $privacy_policy_url The Toll-Free Verification request privacy policy URL. + * + * @return $this + */ + public function setPrivacyPolicyUrl(?string $privacy_policy_url): static + { + if (is_null($privacy_policy_url)) { + throw new InvalidArgumentException('non-nullable privacy_policy_url cannot be null'); + } + if ((mb_strlen($privacy_policy_url) > 500)) { + throw new InvalidArgumentException('invalid length for $privacy_policy_url when calling VerificationUpdateRequest., must be smaller than or equal to 500.'); + } + + $this->container['privacy_policy_url'] = $privacy_policy_url; + + return $this; + } + + /** + * Gets terms_and_conditions_url + * + * @return string|null + */ + public function getTermsAndConditionsUrl(): ?string + { + return $this->container['terms_and_conditions_url']; + } + + /** + * Sets terms_and_conditions_url + * + * @param string|null $terms_and_conditions_url The Toll-Free Verification request terms and conditions policy URL. + * + * @return $this + */ + public function setTermsAndConditionsUrl(?string $terms_and_conditions_url): static + { + if (is_null($terms_and_conditions_url)) { + throw new InvalidArgumentException('non-nullable terms_and_conditions_url cannot be null'); + } + if ((mb_strlen($terms_and_conditions_url) > 500)) { + throw new InvalidArgumentException('invalid length for $terms_and_conditions_url when calling VerificationUpdateRequest., must be smaller than or equal to 500.'); + } + + $this->container['terms_and_conditions_url'] = $terms_and_conditions_url; + + return $this; + } + + /** + * Gets business_dba + * + * @return string|null + */ + public function getBusinessDba(): ?string + { + return $this->container['business_dba']; + } + + /** + * Sets business_dba + * + * @param string|null $business_dba The company 'Doing Business As'. + * + * @return $this + */ + public function setBusinessDba(?string $business_dba): static + { + if (is_null($business_dba)) { + throw new InvalidArgumentException('non-nullable business_dba cannot be null'); + } + if ((mb_strlen($business_dba) > 500)) { + throw new InvalidArgumentException('invalid length for $business_dba when calling VerificationUpdateRequest., must be smaller than or equal to 500.'); + } + + $this->container['business_dba'] = $business_dba; + + return $this; + } + + /** + * Gets business_registration_number + * + * @return string|null + */ + public function getBusinessRegistrationNumber(): ?string + { + return $this->container['business_registration_number']; + } + + /** + * Sets business_registration_number + * + * @param string|null $business_registration_number Government-issued business identifying number. **Note: As of October 19th, 2026 this field will be required when `businessEntityType` is _not_ `SOLE_PROPRIETOR`. If this field is provided, `businessRegistrationType` and `businessRegistrationIssuingCountry` are also required.** + * + * @return $this + */ + public function setBusinessRegistrationNumber(?string $business_registration_number): static + { + if (is_null($business_registration_number)) { + array_push($this->openAPINullablesSetToNull, 'business_registration_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('business_registration_number', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($business_registration_number) && (mb_strlen($business_registration_number) > 500)) { + throw new InvalidArgumentException('invalid length for $business_registration_number when calling VerificationUpdateRequest., must be smaller than or equal to 500.'); + } + + $this->container['business_registration_number'] = $business_registration_number; + + return $this; + } + + /** + * Gets business_registration_type + * + * @return \Bandwidth\Model\BusinessRegistrationTypeEnum|null + */ + public function getBusinessRegistrationType(): ?\Bandwidth\Model\BusinessRegistrationTypeEnum + { + return $this->container['business_registration_type']; + } + + /** + * Sets business_registration_type + * + * @param \Bandwidth\Model\BusinessRegistrationTypeEnum|null $business_registration_type business_registration_type + * + * @return $this + */ + public function setBusinessRegistrationType(?\Bandwidth\Model\BusinessRegistrationTypeEnum $business_registration_type): static + { + if (is_null($business_registration_type)) { + array_push($this->openAPINullablesSetToNull, 'business_registration_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('business_registration_type', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['business_registration_type'] = $business_registration_type; + + return $this; + } + + /** + * Gets business_entity_type + * + * @return \Bandwidth\Model\BusinessEntityTypeEnum|null + */ + public function getBusinessEntityType(): ?\Bandwidth\Model\BusinessEntityTypeEnum + { + return $this->container['business_entity_type']; + } + + /** + * Sets business_entity_type + * + * @param \Bandwidth\Model\BusinessEntityTypeEnum|null $business_entity_type business_entity_type + * + * @return $this + */ + public function setBusinessEntityType(?\Bandwidth\Model\BusinessEntityTypeEnum $business_entity_type): static + { + if (is_null($business_entity_type)) { + throw new InvalidArgumentException('non-nullable business_entity_type cannot be null'); + } + $this->container['business_entity_type'] = $business_entity_type; + + return $this; + } + + /** + * Gets business_registration_issuing_country + * + * @return string|null + */ + public function getBusinessRegistrationIssuingCountry(): ?string + { + return $this->container['business_registration_issuing_country']; + } + + /** + * Sets business_registration_issuing_country + * + * @param string|null $business_registration_issuing_country The country issuing the business registration in ISO-3166-1 alpha-3 format. Alpha-2 format is accepted by the API, but alpha-3 is highly encouraged. **Note: As of October 19th, 2026 this field will be required when `businessRegistrationNumber` is provided.** | Registration Type | Supported Countries | |----------------------|------------------------------------| | EIN | USA | | CBN | CAN | | NEQ | CAN | | PROVINCIAL_NUMBER | CAN | | CRN | GBR, HKG | | VAT | GBR, IRL, BRA, NLD | | ACN | AUS | | ABN | AUS | | BRN | HKG | | SIREN | FRA | | SIRET | FRA | | NZBN | NZL | | UST_IDNR | DEU | | CIF | ESP | | NIF | ESP | | CNPJ | BRA | | UID | CHE | | OTHER | Must Provide Country Code | + * + * @return $this + */ + public function setBusinessRegistrationIssuingCountry(?string $business_registration_issuing_country): static + { + if (is_null($business_registration_issuing_country)) { + array_push($this->openAPINullablesSetToNull, 'business_registration_issuing_country'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('business_registration_issuing_country', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['business_registration_issuing_country'] = $business_registration_issuing_country; + + return $this; + } + + /** + * Gets help_message_response + * + * @return string|null + */ + public function getHelpMessageResponse(): ?string + { + return $this->container['help_message_response']; + } + + /** + * Sets help_message_response + * + * @param string|null $help_message_response A message that gets sent to users requesting help. + * + * @return $this + */ + public function setHelpMessageResponse(?string $help_message_response): static + { + if (is_null($help_message_response)) { + array_push($this->openAPINullablesSetToNull, 'help_message_response'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('help_message_response', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($help_message_response) && (mb_strlen($help_message_response) > 500)) { + throw new InvalidArgumentException('invalid length for $help_message_response when calling VerificationUpdateRequest., must be smaller than or equal to 500.'); + } + + $this->container['help_message_response'] = $help_message_response; + + return $this; + } + + /** + * Gets age_gated_content + * + * @return bool|null + */ + public function getAgeGatedContent(): ?bool + { + return $this->container['age_gated_content']; + } + + /** + * Sets age_gated_content + * + * @param bool|null $age_gated_content Indicates whether the content is age-gated. + * + * @return $this + */ + public function setAgeGatedContent(?bool $age_gated_content): static + { + if (is_null($age_gated_content)) { + throw new InvalidArgumentException('non-nullable age_gated_content cannot be null'); + } + $this->container['age_gated_content'] = $age_gated_content; + + return $this; + } + + /** + * Gets cv_token + * + * @return string|null + */ + public function getCvToken(): ?string + { + return $this->container['cv_token']; + } + + /** + * Sets cv_token + * + * @param string|null $cv_token The token provided by Campaign Verify to validate your political use case. Only required for 527 political organizations. If you are not a 527 political organization, this field should be omitted. Supplying an empty string will likely result in rejection. + * + * @return $this + */ + public function setCvToken(?string $cv_token): static + { + if (is_null($cv_token)) { + array_push($this->openAPINullablesSetToNull, 'cv_token'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('cv_token', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($cv_token) && (mb_strlen($cv_token) > 500)) { + throw new InvalidArgumentException('invalid length for $cv_token when calling VerificationUpdateRequest., must be smaller than or equal to 500.'); + } + if (!is_null($cv_token) && (mb_strlen($cv_token) < 0)) { + throw new InvalidArgumentException('invalid length for $cv_token when calling VerificationUpdateRequest., must be bigger than or equal to 0.'); + } + + $this->container['cv_token'] = $cv_token; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/VerificationWebhook.php b/src/Model/VerificationWebhook.php new file mode 100644 index 0000000..96cd392 --- /dev/null +++ b/src/Model/VerificationWebhook.php @@ -0,0 +1,508 @@ + + */ +class VerificationWebhook implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'verificationWebhook'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'account_id' => 'string', + 'phone_number' => 'string', + 'status' => '\Bandwidth\Model\TfvCallbackStatusEnum', + 'internal_ticket_number' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'account_id' => null, + 'phone_number' => null, + 'status' => null, + 'internal_ticket_number' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'phone_number' => false, + 'status' => false, + 'internal_ticket_number' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'account_id' => 'accountId', + 'phone_number' => 'phoneNumber', + 'status' => 'status', + 'internal_ticket_number' => 'internalTicketNumber' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'account_id' => 'setAccountId', + 'phone_number' => 'setPhoneNumber', + 'status' => 'setStatus', + 'internal_ticket_number' => 'setInternalTicketNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'account_id' => 'getAccountId', + 'phone_number' => 'getPhoneNumber', + 'status' => 'getStatus', + 'internal_ticket_number' => 'getInternalTicketNumber' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('phone_number', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('internal_ticket_number', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) > 12)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be smaller than or equal to 12."; + } + + if (!is_null($this->container['phone_number']) && (mb_strlen($this->container['phone_number']) < 12)) { + $invalidProperties[] = "invalid value for 'phone_number', the character length must be bigger than or equal to 12."; + } + + if (!is_null($this->container['phone_number']) && !preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", $this->container['phone_number'])) { + $invalidProperties[] = "invalid value for 'phone_number', must be conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id User's account ID. + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets phone_number + * + * @return string|null + */ + public function getPhoneNumber(): ?string + { + return $this->container['phone_number']; + } + + /** + * Sets phone_number + * + * @param string|null $phone_number Toll-free telephone number in E.164 format. + * + * @return $this + */ + public function setPhoneNumber(?string $phone_number): static + { + if (is_null($phone_number)) { + throw new InvalidArgumentException('non-nullable phone_number cannot be null'); + } + if ((mb_strlen($phone_number) > 12)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling VerificationWebhook., must be smaller than or equal to 12.'); + } + if ((mb_strlen($phone_number) < 12)) { + throw new InvalidArgumentException('invalid length for $phone_number when calling VerificationWebhook., must be bigger than or equal to 12.'); + } + if ((!preg_match("/^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/", ObjectSerializer::toString($phone_number)))) { + throw new InvalidArgumentException("invalid value for \$phone_number when calling VerificationWebhook., must conform to the pattern /^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$/."); + } + + $this->container['phone_number'] = $phone_number; + + return $this; + } + + /** + * Gets status + * + * @return \Bandwidth\Model\TfvCallbackStatusEnum|null + */ + public function getStatus(): ?\Bandwidth\Model\TfvCallbackStatusEnum + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Bandwidth\Model\TfvCallbackStatusEnum|null $status status + * + * @return $this + */ + public function setStatus(?\Bandwidth\Model\TfvCallbackStatusEnum $status): static + { + if (is_null($status)) { + throw new InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets internal_ticket_number + * + * @return string|null + */ + public function getInternalTicketNumber(): ?string + { + return $this->container['internal_ticket_number']; + } + + /** + * Sets internal_ticket_number + * + * @param string|null $internal_ticket_number Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + * + * @return $this + */ + public function setInternalTicketNumber(?string $internal_ticket_number): static + { + if (is_null($internal_ticket_number)) { + throw new InvalidArgumentException('non-nullable internal_ticket_number cannot be null'); + } + $this->container['internal_ticket_number'] = $internal_ticket_number; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/VerifyCodeRequest.php b/src/Model/VerifyCodeRequest.php new file mode 100644 index 0000000..ef2a701 --- /dev/null +++ b/src/Model/VerifyCodeRequest.php @@ -0,0 +1,534 @@ + + */ +class VerifyCodeRequest implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'verifyCodeRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'to' => 'string', + 'scope' => 'string', + 'expiration_time_in_minutes' => 'float', + 'code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'to' => null, + 'scope' => null, + 'expiration_time_in_minutes' => null, + 'code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'to' => false, + 'scope' => false, + 'expiration_time_in_minutes' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'to' => 'to', + 'scope' => 'scope', + 'expiration_time_in_minutes' => 'expirationTimeInMinutes', + 'code' => 'code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'to' => 'setTo', + 'scope' => 'setScope', + 'expiration_time_in_minutes' => 'setExpirationTimeInMinutes', + 'code' => 'setCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'to' => 'getTo', + 'scope' => 'getScope', + 'expiration_time_in_minutes' => 'getExpirationTimeInMinutes', + 'code' => 'getCode' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('scope', $data ?? [], null); + $this->setIfExists('expiration_time_in_minutes', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if (!preg_match("/^\\+[1-9]\\d{1,14}$/", $this->container['to'])) { + $invalidProperties[] = "invalid value for 'to', must be conform to the pattern /^\\+[1-9]\\d{1,14}$/."; + } + + if ($this->container['expiration_time_in_minutes'] === null) { + $invalidProperties[] = "'expiration_time_in_minutes' can't be null"; + } + if (($this->container['expiration_time_in_minutes'] > 15)) { + $invalidProperties[] = "invalid value for 'expiration_time_in_minutes', must be smaller than or equal to 15."; + } + + if (($this->container['expiration_time_in_minutes'] < 1)) { + $invalidProperties[] = "invalid value for 'expiration_time_in_minutes', must be bigger than or equal to 1."; + } + + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + if ((mb_strlen($this->container['code']) > 8)) { + $invalidProperties[] = "invalid value for 'code', the character length must be smaller than or equal to 8."; + } + + if ((mb_strlen($this->container['code']) < 4)) { + $invalidProperties[] = "invalid value for 'code', the character length must be bigger than or equal to 4."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to + * + * @return string + */ + public function getTo(): string + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to The phone number to send the mfa code to. + * + * @return $this + */ + public function setTo(string $to): static + { + if (is_null($to)) { + throw new InvalidArgumentException('non-nullable to cannot be null'); + } + + if ((!preg_match("/^\\+[1-9]\\d{1,14}$/", ObjectSerializer::toString($to)))) { + throw new InvalidArgumentException("invalid value for \$to when calling VerifyCodeRequest., must conform to the pattern /^\\+[1-9]\\d{1,14}$/."); + } + + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets scope + * + * @return string|null + */ + public function getScope(): ?string + { + return $this->container['scope']; + } + + /** + * Sets scope + * + * @param string|null $scope An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\". + * + * @return $this + */ + public function setScope(?string $scope): static + { + if (is_null($scope)) { + throw new InvalidArgumentException('non-nullable scope cannot be null'); + } + $this->container['scope'] = $scope; + + return $this; + } + + /** + * Gets expiration_time_in_minutes + * + * @return float + */ + public function getExpirationTimeInMinutes(): float + { + return $this->container['expiration_time_in_minutes']; + } + + /** + * Sets expiration_time_in_minutes + * + * @param float $expiration_time_in_minutes 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. + * + * @return $this + */ + public function setExpirationTimeInMinutes(float $expiration_time_in_minutes): static + { + if (is_null($expiration_time_in_minutes)) { + throw new InvalidArgumentException('non-nullable expiration_time_in_minutes cannot be null'); + } + if (($expiration_time_in_minutes > 15)) { + throw new InvalidArgumentException('invalid value for $expiration_time_in_minutes when calling VerifyCodeRequest., must be smaller than or equal to 15.'); + } + if (($expiration_time_in_minutes < 1)) { + throw new InvalidArgumentException('invalid value for $expiration_time_in_minutes when calling VerifyCodeRequest., must be bigger than or equal to 1.'); + } + + $this->container['expiration_time_in_minutes'] = $expiration_time_in_minutes; + + return $this; + } + + /** + * Gets code + * + * @return string + */ + public function getCode(): string + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code The generated mfa code to check if valid. + * + * @return $this + */ + public function setCode(string $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + if ((mb_strlen($code) > 8)) { + throw new InvalidArgumentException('invalid length for $code when calling VerifyCodeRequest., must be smaller than or equal to 8.'); + } + if ((mb_strlen($code) < 4)) { + throw new InvalidArgumentException('invalid length for $code when calling VerifyCodeRequest., must be bigger than or equal to 4.'); + } + + $this->container['code'] = $code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/VerifyCodeResponse.php b/src/Model/VerifyCodeResponse.php new file mode 100644 index 0000000..8836474 --- /dev/null +++ b/src/Model/VerifyCodeResponse.php @@ -0,0 +1,384 @@ + + */ +class VerifyCodeResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'verifyCodeResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'valid' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'valid' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'valid' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'valid' => 'valid' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'valid' => 'setValid' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'valid' => 'getValid' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('valid', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets valid + * + * @return bool|null + */ + public function getValid(): ?bool + { + return $this->container['valid']; + } + + /** + * Sets valid + * + * @param bool|null $valid Whether or not the supplied code is valid. + * + * @return $this + */ + public function setValid(?bool $valid): static + { + if (is_null($valid)) { + throw new InvalidArgumentException('non-nullable valid cannot be null'); + } + $this->container['valid'] = $valid; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/VoiceApiError.php b/src/Model/VoiceApiError.php new file mode 100644 index 0000000..304c767 --- /dev/null +++ b/src/Model/VoiceApiError.php @@ -0,0 +1,459 @@ + + */ +class VoiceApiError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'voiceApiError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'type' => 'string', + 'description' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'type' => null, + 'description' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'type' => false, + 'description' => false, + 'id' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'type' => 'type', + 'description' => 'description', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'type' => 'setType', + 'description' => 'setDescription', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'type' => 'getType', + 'description' => 'getDescription', + 'id' => 'getId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string|null + */ + public function getType(): ?string + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return $this + */ + public function setType(?string $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + array_push($this->openAPINullablesSetToNull, 'id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('id', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/VoiceCodeResponse.php b/src/Model/VoiceCodeResponse.php new file mode 100644 index 0000000..5313288 --- /dev/null +++ b/src/Model/VoiceCodeResponse.php @@ -0,0 +1,384 @@ + + */ +class VoiceCodeResponse implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'voiceCodeResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'call_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'call_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'call_id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'call_id' => 'callId' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'call_id' => 'setCallId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'call_id' => 'getCallId' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('call_id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets call_id + * + * @return string|null + */ + public function getCallId(): ?string + { + return $this->container['call_id']; + } + + /** + * Sets call_id + * + * @param string|null $call_id Programmable Voice API Call ID. + * + * @return $this + */ + public function setCallId(?string $call_id): static + { + if (is_null($call_id)) { + throw new InvalidArgumentException('non-nullable call_id cannot be null'); + } + $this->container['call_id'] = $call_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/WebhookSubscription.php b/src/Model/WebhookSubscription.php new file mode 100644 index 0000000..395c5c8 --- /dev/null +++ b/src/Model/WebhookSubscription.php @@ -0,0 +1,621 @@ + + */ +class WebhookSubscription implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'webhookSubscription'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'id' => 'string', + 'account_id' => 'string', + 'callback_url' => 'string', + 'type' => '\Bandwidth\Model\WebhookSubscriptionTypeEnum', + 'basic_authentication' => '\Bandwidth\Model\WebhookSubscriptionBasicAuthentication', + 'created_date' => '\DateTime', + 'modified_date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'id' => null, + 'account_id' => null, + 'callback_url' => 'url', + 'type' => null, + 'basic_authentication' => null, + 'created_date' => 'date-time', + 'modified_date' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'id' => false, + 'account_id' => false, + 'callback_url' => true, + 'type' => false, + 'basic_authentication' => false, + 'created_date' => false, + 'modified_date' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'id' => 'id', + 'account_id' => 'accountId', + 'callback_url' => 'callbackUrl', + 'type' => 'type', + 'basic_authentication' => 'basicAuthentication', + 'created_date' => 'createdDate', + 'modified_date' => 'modifiedDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'id' => 'setId', + 'account_id' => 'setAccountId', + 'callback_url' => 'setCallbackUrl', + 'type' => 'setType', + 'basic_authentication' => 'setBasicAuthentication', + 'created_date' => 'setCreatedDate', + 'modified_date' => 'setModifiedDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'id' => 'getId', + 'account_id' => 'getAccountId', + 'callback_url' => 'getCallbackUrl', + 'type' => 'getType', + 'basic_authentication' => 'getBasicAuthentication', + 'created_date' => 'getCreatedDate', + 'modified_date' => 'getModifiedDate' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('basic_authentication', $data ?? [], null); + $this->setIfExists('created_date', $data ?? [], null); + $this->setIfExists('modified_date', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['callback_url'] === null && !$this->isNullableSetToNull('callback_url')) { + $invalidProperties[] = "'callback_url' is required"; + } + if (!is_null($this->container['callback_url']) && (mb_strlen($this->container['callback_url']) > 2000)) { + $invalidProperties[] = "invalid value for 'callback_url', the character length must be smaller than or equal to 2000."; + } + + if (!is_null($this->container['callback_url']) && (mb_strlen($this->container['callback_url']) < 0)) { + $invalidProperties[] = "invalid value for 'callback_url', the character length must be bigger than or equal to 0."; + } + + if (!is_null($this->container['callback_url']) && !preg_match("/^$|(https?:\/\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#()?&\/\/=]*)/", $this->container['callback_url'])) { + $invalidProperties[] = "invalid value for 'callback_url', must be conform to the pattern /^$|(https?:\/\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#()?&\/\/=]*)/."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId(): ?string + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return $this + */ + public function setId(?string $id): static + { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets account_id + * + * @return string|null + */ + public function getAccountId(): ?string + { + return $this->container['account_id']; + } + + /** + * Sets account_id + * + * @param string|null $account_id account_id + * + * @return $this + */ + public function setAccountId(?string $account_id): static + { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } + $this->container['account_id'] = $account_id; + + return $this; + } + + /** + * Gets callback_url + * + * @return string|null + */ + public function getCallbackUrl(): ?string + { + return $this->container['callback_url']; + } + + /** + * Sets callback_url + * + * @param string|null $callback_url Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. + * + * @return $this + */ + public function setCallbackUrl(?string $callback_url): static + { + if (is_null($callback_url)) { + array_push($this->openAPINullablesSetToNull, 'callback_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('callback_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($callback_url) && (mb_strlen($callback_url) > 2000)) { + throw new InvalidArgumentException('invalid length for $callback_url when calling WebhookSubscription., must be smaller than or equal to 2000.'); + } + if (!is_null($callback_url) && (mb_strlen($callback_url) < 0)) { + throw new InvalidArgumentException('invalid length for $callback_url when calling WebhookSubscription., must be bigger than or equal to 0.'); + } + if (!is_null($callback_url) && (!preg_match("/^$|(https?:\/\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#()?&\/\/=]*)/", ObjectSerializer::toString($callback_url)))) { + throw new InvalidArgumentException("invalid value for \$callback_url when calling WebhookSubscription., must conform to the pattern /^$|(https?:\/\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#()?&\/\/=]*)/."); + } + + $this->container['callback_url'] = $callback_url; + + return $this; + } + + /** + * Gets type + * + * @return \Bandwidth\Model\WebhookSubscriptionTypeEnum|null + */ + public function getType(): ?\Bandwidth\Model\WebhookSubscriptionTypeEnum + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Bandwidth\Model\WebhookSubscriptionTypeEnum|null $type type + * + * @return $this + */ + public function setType(?\Bandwidth\Model\WebhookSubscriptionTypeEnum $type): static + { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets basic_authentication + * + * @return \Bandwidth\Model\WebhookSubscriptionBasicAuthentication|null + */ + public function getBasicAuthentication(): ?\Bandwidth\Model\WebhookSubscriptionBasicAuthentication + { + return $this->container['basic_authentication']; + } + + /** + * Sets basic_authentication + * + * @param \Bandwidth\Model\WebhookSubscriptionBasicAuthentication|null $basic_authentication basic_authentication + * + * @return $this + */ + public function setBasicAuthentication(?\Bandwidth\Model\WebhookSubscriptionBasicAuthentication $basic_authentication): static + { + if (is_null($basic_authentication)) { + throw new InvalidArgumentException('non-nullable basic_authentication cannot be null'); + } + $this->container['basic_authentication'] = $basic_authentication; + + return $this; + } + + /** + * Gets created_date + * + * @return \DateTime|null + */ + public function getCreatedDate(): ?\DateTime + { + return $this->container['created_date']; + } + + /** + * Sets created_date + * + * @param \DateTime|null $created_date created_date + * + * @return $this + */ + public function setCreatedDate(?\DateTime $created_date): static + { + if (is_null($created_date)) { + throw new InvalidArgumentException('non-nullable created_date cannot be null'); + } + $this->container['created_date'] = $created_date; + + return $this; + } + + /** + * Gets modified_date + * + * @return \DateTime|null + */ + public function getModifiedDate(): ?\DateTime + { + return $this->container['modified_date']; + } + + /** + * Sets modified_date + * + * @param \DateTime|null $modified_date modified_date + * + * @return $this + */ + public function setModifiedDate(?\DateTime $modified_date): static + { + if (is_null($modified_date)) { + throw new InvalidArgumentException('non-nullable modified_date cannot be null'); + } + $this->container['modified_date'] = $modified_date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/WebhookSubscriptionBasicAuthentication.php b/src/Model/WebhookSubscriptionBasicAuthentication.php new file mode 100644 index 0000000..fa0887d --- /dev/null +++ b/src/Model/WebhookSubscriptionBasicAuthentication.php @@ -0,0 +1,441 @@ + + */ +class WebhookSubscriptionBasicAuthentication implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'webhookSubscription_basicAuthentication'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'username' => 'string', + 'password' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'username' => null, + 'password' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'username' => false, + 'password' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'username' => 'username', + 'password' => 'password' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'username' => 'setUsername', + 'password' => 'setPassword' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'username' => 'getUsername', + 'password' => 'getPassword' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('username', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['username'] === null) { + $invalidProperties[] = "'username' can't be null"; + } + if ((mb_strlen($this->container['username']) > 100)) { + $invalidProperties[] = "invalid value for 'username', the character length must be smaller than or equal to 100."; + } + + if ($this->container['password'] === null) { + $invalidProperties[] = "'password' can't be null"; + } + if ((mb_strlen($this->container['password']) > 200)) { + $invalidProperties[] = "invalid value for 'password', the character length must be smaller than or equal to 200."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets username + * + * @return string + */ + public function getUsername(): string + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username username + * + * @return $this + */ + public function setUsername(string $username): static + { + if (is_null($username)) { + throw new InvalidArgumentException('non-nullable username cannot be null'); + } + if ((mb_strlen($username) > 100)) { + throw new InvalidArgumentException('invalid length for $username when calling WebhookSubscriptionBasicAuthentication., must be smaller than or equal to 100.'); + } + + $this->container['username'] = $username; + + return $this; + } + + /** + * Gets password + * + * @return string + */ + public function getPassword(): string + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string $password password + * + * @return $this + */ + public function setPassword(string $password): static + { + if (is_null($password)) { + throw new InvalidArgumentException('non-nullable password cannot be null'); + } + if ((mb_strlen($password) > 200)) { + throw new InvalidArgumentException('invalid length for $password when calling WebhookSubscriptionBasicAuthentication., must be smaller than or equal to 200.'); + } + + $this->container['password'] = $password; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/WebhookSubscriptionError.php b/src/Model/WebhookSubscriptionError.php new file mode 100644 index 0000000..ba0a9a7 --- /dev/null +++ b/src/Model/WebhookSubscriptionError.php @@ -0,0 +1,452 @@ + + */ +class WebhookSubscriptionError implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'webhookSubscriptionError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'code' => 'int', + 'description' => 'string', + 'telephone_numbers' => '\Bandwidth\Model\TelephoneNumber[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'code' => null, + 'description' => null, + 'telephone_numbers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'code' => false, + 'description' => false, + 'telephone_numbers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'code' => 'code', + 'description' => 'description', + 'telephone_numbers' => 'telephoneNumbers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'code' => 'setCode', + 'description' => 'setDescription', + 'telephone_numbers' => 'setTelephoneNumbers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'code' => 'getCode', + 'description' => 'getDescription', + 'telephone_numbers' => 'getTelephoneNumbers' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('telephone_numbers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets code + * + * @return int|null + */ + public function getCode(): ?int + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param int|null $code code + * + * @return $this + */ + public function setCode(?int $code): static + { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription(): ?string + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description description + * + * @return $this + */ + public function setDescription(?string $description): static + { + if (is_null($description)) { + throw new InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets telephone_numbers + * + * @return \Bandwidth\Model\TelephoneNumber[]|null + */ + public function getTelephoneNumbers(): ?array + { + return $this->container['telephone_numbers']; + } + + /** + * Sets telephone_numbers + * + * @param \Bandwidth\Model\TelephoneNumber[]|null $telephone_numbers telephone_numbers + * + * @return $this + */ + public function setTelephoneNumbers(?array $telephone_numbers): static + { + if (is_null($telephone_numbers)) { + throw new InvalidArgumentException('non-nullable telephone_numbers cannot be null'); + } + $this->container['telephone_numbers'] = $telephone_numbers; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/WebhookSubscriptionRequestSchema.php b/src/Model/WebhookSubscriptionRequestSchema.php new file mode 100644 index 0000000..91d3944 --- /dev/null +++ b/src/Model/WebhookSubscriptionRequestSchema.php @@ -0,0 +1,513 @@ + + */ +class WebhookSubscriptionRequestSchema implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'webhookSubscriptionRequestSchema'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'basic_authentication' => '\Bandwidth\Model\TfvBasicAuthentication', + 'callback_url' => 'string', + 'shared_secret_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'basic_authentication' => null, + 'callback_url' => 'url', + 'shared_secret_key' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'basic_authentication' => false, + 'callback_url' => true, + 'shared_secret_key' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'basic_authentication' => 'basicAuthentication', + 'callback_url' => 'callbackUrl', + 'shared_secret_key' => 'sharedSecretKey' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'basic_authentication' => 'setBasicAuthentication', + 'callback_url' => 'setCallbackUrl', + 'shared_secret_key' => 'setSharedSecretKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'basic_authentication' => 'getBasicAuthentication', + 'callback_url' => 'getCallbackUrl', + 'shared_secret_key' => 'getSharedSecretKey' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('basic_authentication', $data ?? [], null); + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('shared_secret_key', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['callback_url'] === null && !$this->isNullableSetToNull('callback_url')) { + $invalidProperties[] = "'callback_url' is required"; + } + if (!is_null($this->container['callback_url']) && (mb_strlen($this->container['callback_url']) > 2000)) { + $invalidProperties[] = "invalid value for 'callback_url', the character length must be smaller than or equal to 2000."; + } + + if (!is_null($this->container['callback_url']) && (mb_strlen($this->container['callback_url']) < 0)) { + $invalidProperties[] = "invalid value for 'callback_url', the character length must be bigger than or equal to 0."; + } + + if (!is_null($this->container['callback_url']) && !preg_match("/^$|(https?:\/\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#()?&\/\/=]*)/", $this->container['callback_url'])) { + $invalidProperties[] = "invalid value for 'callback_url', must be conform to the pattern /^$|(https?:\/\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#()?&\/\/=]*)/."; + } + + if (!is_null($this->container['shared_secret_key']) && (mb_strlen($this->container['shared_secret_key']) > 64)) { + $invalidProperties[] = "invalid value for 'shared_secret_key', the character length must be smaller than or equal to 64."; + } + + if (!is_null($this->container['shared_secret_key']) && (mb_strlen($this->container['shared_secret_key']) < 16)) { + $invalidProperties[] = "invalid value for 'shared_secret_key', the character length must be bigger than or equal to 16."; + } + + if (!is_null($this->container['shared_secret_key']) && !preg_match("/^[ -~]{16,64}$/", $this->container['shared_secret_key'])) { + $invalidProperties[] = "invalid value for 'shared_secret_key', must be conform to the pattern /^[ -~]{16,64}$/."; + } + + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets basic_authentication + * + * @return \Bandwidth\Model\TfvBasicAuthentication|null + */ + public function getBasicAuthentication(): ?\Bandwidth\Model\TfvBasicAuthentication + { + return $this->container['basic_authentication']; + } + + /** + * Sets basic_authentication + * + * @param \Bandwidth\Model\TfvBasicAuthentication|null $basic_authentication basic_authentication + * + * @return $this + */ + public function setBasicAuthentication(?\Bandwidth\Model\TfvBasicAuthentication $basic_authentication): static + { + if (is_null($basic_authentication)) { + throw new InvalidArgumentException('non-nullable basic_authentication cannot be null'); + } + $this->container['basic_authentication'] = $basic_authentication; + + return $this; + } + + /** + * Gets callback_url + * + * @return string|null + */ + public function getCallbackUrl(): ?string + { + return $this->container['callback_url']; + } + + /** + * Sets callback_url + * + * @param string|null $callback_url Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. + * + * @return $this + */ + public function setCallbackUrl(?string $callback_url): static + { + if (is_null($callback_url)) { + array_push($this->openAPINullablesSetToNull, 'callback_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('callback_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($callback_url) && (mb_strlen($callback_url) > 2000)) { + throw new InvalidArgumentException('invalid length for $callback_url when calling WebhookSubscriptionRequestSchema., must be smaller than or equal to 2000.'); + } + if (!is_null($callback_url) && (mb_strlen($callback_url) < 0)) { + throw new InvalidArgumentException('invalid length for $callback_url when calling WebhookSubscriptionRequestSchema., must be bigger than or equal to 0.'); + } + if (!is_null($callback_url) && (!preg_match("/^$|(https?:\/\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#()?&\/\/=]*)/", ObjectSerializer::toString($callback_url)))) { + throw new InvalidArgumentException("invalid value for \$callback_url when calling WebhookSubscriptionRequestSchema., must conform to the pattern /^$|(https?:\/\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,253}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#()?&\/\/=]*)/."); + } + + $this->container['callback_url'] = $callback_url; + + return $this; + } + + /** + * Gets shared_secret_key + * + * @return string|null + */ + public function getSharedSecretKey(): ?string + { + return $this->container['shared_secret_key']; + } + + /** + * Sets shared_secret_key + * + * @param string|null $shared_secret_key An ASCII string submitted by the user as a shared secret key for generating an HMAC header for callbacks. + * + * @return $this + */ + public function setSharedSecretKey(?string $shared_secret_key): static + { + if (is_null($shared_secret_key)) { + array_push($this->openAPINullablesSetToNull, 'shared_secret_key'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('shared_secret_key', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + if (!is_null($shared_secret_key) && (mb_strlen($shared_secret_key) > 64)) { + throw new InvalidArgumentException('invalid length for $shared_secret_key when calling WebhookSubscriptionRequestSchema., must be smaller than or equal to 64.'); + } + if (!is_null($shared_secret_key) && (mb_strlen($shared_secret_key) < 16)) { + throw new InvalidArgumentException('invalid length for $shared_secret_key when calling WebhookSubscriptionRequestSchema., must be bigger than or equal to 16.'); + } + if (!is_null($shared_secret_key) && (!preg_match("/^[ -~]{16,64}$/", ObjectSerializer::toString($shared_secret_key)))) { + throw new InvalidArgumentException("invalid value for \$shared_secret_key when calling WebhookSubscriptionRequestSchema., must conform to the pattern /^[ -~]{16,64}$/."); + } + + $this->container['shared_secret_key'] = $shared_secret_key; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/WebhookSubscriptionTypeEnum.php b/src/Model/WebhookSubscriptionTypeEnum.php new file mode 100644 index 0000000..f89beae --- /dev/null +++ b/src/Model/WebhookSubscriptionTypeEnum.php @@ -0,0 +1,45 @@ + + */ +class WebhookSubscriptionsListBody implements ModelInterface, ArrayAccess, JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static string $openAPIModelName = 'webhookSubscriptionsListBody'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPITypes = [ + 'links' => '\Bandwidth\Model\LinksObject', + 'errors' => '\Bandwidth\Model\WebhookSubscriptionError[]', + 'data' => '\Bandwidth\Model\WebhookSubscription[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var array + */ + protected static array $openAPIFormats = [ + 'links' => null, + 'errors' => null, + 'data' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var array + */ + protected static array $openAPINullables = [ + 'links' => false, + 'errors' => false, + 'data' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var array + */ + protected array $openAPINullablesSetToNull = []; + + /** + * {@inheritdoc} + */ + public static function openAPITypes(): array + { + return self::$openAPITypes; + } + + /** + * {@inheritdoc} + */ + public static function openAPIFormats(): array + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return array + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param array $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * {@inheritdoc} + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * {@inheritdoc} + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var array + */ + protected static array $attributeMap = [ + 'links' => 'links', + 'errors' => 'errors', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var array + */ + protected static array $setters = [ + 'links' => 'setLinks', + 'errors' => 'setErrors', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var array + */ + protected static array $getters = [ + 'links' => 'getLinks', + 'errors' => 'getErrors', + 'data' => 'getData' + ]; + + /** + * {@inheritdoc} + */ + public static function attributeMap(): array + { + return self::$attributeMap; + } + + /** + * {@inheritdoc} + */ + public static function setters(): array + { + return self::$setters; + } + + /** + * {@inheritdoc} + */ + public static function getters(): array + { + return self::$getters; + } + + /** + * {@inheritdoc} + */ + public function getModelName(): string + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var array + */ + protected array $container = []; + + /** + * Constructor + * + * @param array $data Associated array of property values initializing the model + */ + public function __construct(?array $data = null) + { + $this->setIfExists('links', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + $this->setIfExists('data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * {@inheritdoc} + */ + public function listInvalidProperties(): array + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + return $invalidProperties; + } + + /** + * {@inheritdoc} + */ + public function valid(): bool + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets links + * + * @return \Bandwidth\Model\LinksObject|null + */ + public function getLinks(): ?\Bandwidth\Model\LinksObject + { + return $this->container['links']; + } + + /** + * Sets links + * + * @param \Bandwidth\Model\LinksObject|null $links links + * + * @return $this + */ + public function setLinks(?\Bandwidth\Model\LinksObject $links): static + { + if (is_null($links)) { + throw new InvalidArgumentException('non-nullable links cannot be null'); + } + $this->container['links'] = $links; + + return $this; + } + + /** + * Gets errors + * + * @return \Bandwidth\Model\WebhookSubscriptionError[]|null + */ + public function getErrors(): ?array + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Bandwidth\Model\WebhookSubscriptionError[]|null $errors errors + * + * @return $this + */ + public function setErrors(?array $errors): static + { + if (is_null($errors)) { + throw new InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets data + * + * @return \Bandwidth\Model\WebhookSubscription[] + */ + public function getData(): array + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Bandwidth\Model\WebhookSubscription[] $data data + * + * @return $this + */ + public function setData(array $data): static + { + if (is_null($data)) { + throw new InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int|string $offset Offset + * + * @return boolean + */ + public function offsetExists(mixed $offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int|string $offset Offset + * + * @return mixed|null + */ + #[ReturnTypeWillChange] + public function offsetGet(mixed $offset): mixed + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|string|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int|string $offset Offset + * + * @return void + */ + public function offsetUnset(mixed $offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[ReturnTypeWillChange] + public function jsonSerialize(): mixed + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString(): string + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue(): string + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/MultiFactorAuth/Controllers/MFAController.php b/src/MultiFactorAuth/Controllers/MFAController.php deleted file mode 100644 index ea0eb44..0000000 --- a/src/MultiFactorAuth/Controllers/MFAController.php +++ /dev/null @@ -1,320 +0,0 @@ - $accountId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MULTIFACTORAUTHDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'multiFactorAuth'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ErrorWithRequestException( - 'If there is any issue with values passed in by the user', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new Exceptions\UnauthorizedRequestException( - 'Authentication is either incorrect or not present', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ForbiddenRequestException( - 'The user is not authorized to access this resource', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ErrorWithRequestException('An internal server error occurred', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\MultiFactorAuth\\Models\\TwoFactorVoiceResponse' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Multi-Factor authentication with Bandwidth Messaging services. Allows a user to send an MFA code via - * a text message (SMS). - * - * @param string $accountId Bandwidth Account ID with Messaging service enabled - * @param Models\TwoFactorCodeRequestSchema $body TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function createMessagingTwoFactor( - string $accountId, - Models\TwoFactorCodeRequestSchema $body - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/code/messaging'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MULTIFACTORAUTHDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'multiFactorAuth'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ErrorWithRequestException( - 'If there is any issue with values passed in by the user', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new Exceptions\UnauthorizedRequestException( - 'Authentication is either incorrect or not present', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ForbiddenRequestException( - 'The user is not authorized to access this resource', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ErrorWithRequestException('An internal server error occurred', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\MultiFactorAuth\\Models\\TwoFactorMessagingResponse' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Allows a user to verify an MFA code. - * - * @param string $accountId Bandwidth Account ID with Two-Factor enabled - * @param Models\TwoFactorVerifyRequestSchema $body TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function createVerifyTwoFactor( - string $accountId, - Models\TwoFactorVerifyRequestSchema $body - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/code/verify'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MULTIFACTORAUTHDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'multiFactorAuth'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ErrorWithRequestException( - 'If there is any issue with values passed in by the user', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new Exceptions\UnauthorizedRequestException( - 'Authentication is either incorrect or not present', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ForbiddenRequestException( - 'The user is not authorized to access this resource', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ErrorWithRequestException( - 'The user has made too many bad requests and is temporarily locked out', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ErrorWithRequestException('An internal server error occurred', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\MultiFactorAuth\\Models\\TwoFactorVerifyCodeResponse' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } -} diff --git a/src/MultiFactorAuth/Exceptions/ErrorWithRequestException.php b/src/MultiFactorAuth/Exceptions/ErrorWithRequestException.php deleted file mode 100644 index 302f371..0000000 --- a/src/MultiFactorAuth/Exceptions/ErrorWithRequestException.php +++ /dev/null @@ -1,44 +0,0 @@ -to = func_get_arg(0); - $this->from = func_get_arg(1); - $this->applicationId = func_get_arg(2); - $this->scope = func_get_arg(3); - $this->message = func_get_arg(4); - $this->digits = func_get_arg(5); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['to'] = $this->to; - $json['from'] = $this->from; - $json['applicationId'] = $this->applicationId; - $json['scope'] = $this->scope; - $json['message'] = $this->message; - $json['digits'] = $this->digits; - - return array_filter($json); - } -} diff --git a/src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php b/src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php deleted file mode 100644 index 3ffe87b..0000000 --- a/src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php +++ /dev/null @@ -1,41 +0,0 @@ -messageId = func_get_arg(0); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['messageId'] = $this->messageId; - - return array_filter($json); - } -} diff --git a/src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php b/src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php deleted file mode 100644 index d689f81..0000000 --- a/src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php +++ /dev/null @@ -1,41 +0,0 @@ -valid = func_get_arg(0); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['valid'] = $this->valid; - - return array_filter($json); - } -} diff --git a/src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php b/src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php deleted file mode 100644 index ebaa94d..0000000 --- a/src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php +++ /dev/null @@ -1,84 +0,0 @@ -to = func_get_arg(0); - $this->applicationId = func_get_arg(1); - $this->scope = func_get_arg(2); - $this->expirationTimeInMinutes = func_get_arg(3); - $this->code = func_get_arg(4); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['to'] = $this->to; - $json['applicationId'] = $this->applicationId; - $json['scope'] = $this->scope; - $json['expirationTimeInMinutes'] = $this->expirationTimeInMinutes; - $json['code'] = $this->code; - - return array_filter($json); - } -} diff --git a/src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php b/src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php deleted file mode 100644 index c8f4b69..0000000 --- a/src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php +++ /dev/null @@ -1,41 +0,0 @@ -callId = func_get_arg(0); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['callId'] = $this->callId; - - return array_filter($json); - } -} diff --git a/src/MultiFactorAuth/MultiFactorAuthClient.php b/src/MultiFactorAuth/MultiFactorAuthClient.php deleted file mode 100644 index 1c63a75..0000000 --- a/src/MultiFactorAuth/MultiFactorAuthClient.php +++ /dev/null @@ -1,37 +0,0 @@ -config = $config; - } - - - private $mFA; - - /** - * Provides access to MFA controller - * @return Controllers\MFAController - */ - public function getMFA() - { - if ($this->mFA == null) { - $this->mFA = new Controllers\MFAController($this->config); - } - return $this->mFA; - } -} diff --git a/src/ObjectSerializer.php b/src/ObjectSerializer.php new file mode 100644 index 0000000..0bfa45e --- /dev/null +++ b/src/ObjectSerializer.php @@ -0,0 +1,739 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if ($data instanceof \BackedEnum) { + return $data->value; + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if (is_subclass_of($openAPIType, '\BackedEnum')) { + if (is_scalar($value)) { + $value = $openAPIType::tryFrom($value); + if ($value === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $openAPIType::cases())); + throw new \InvalidArgumentException( + sprintf( + "Invalid value for enum '%s', must be one of: '%s'", + $openAPIType::class, + $imploded + ) + ); + } + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach ($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object) $values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename(string $filename): string + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp(string $timestamp): string + { + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue(string $value): string + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue(mixed $value, string $openApiType): bool + { + // If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + // Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + return match ($openApiType) { + // For numeric values, false and '' are considered empty. + // This comparison is safe for floating point values, since the previous call to empty() will + // filter out values that don't match 0. + 'int','integer' => $value !== 0, + 'number'|'float' => $value !== 0 && $value !== 0.0, + + // For boolean values, '' is considered empty + 'bool','boolean' => !in_array($value, [false, 0], true), + + // For string values, '' is considered empty. + 'string' => $value === '', + + // For all the other types, any value at this point can be considered empty. + default => true + }; + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType e.g. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + mixed $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + // Check if we should omit this parameter from the query. This should only happen when: + // - Parameter is NOT required; AND + // - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + // example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + // Handle DateTime objects in query + if ($openApiType === "string" && $value instanceof DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) { + return $arr; + } + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + + if ($v instanceof BackedEnum) { + $v = $v->value; + } + + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value): int|string + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue(string $value): string + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString(string|bool|DateTime $value): string + { + if ($value instanceof DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, string $style, bool $allowCollectionFormatMulti = false): string + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + return match ($style) { + 'pipeDelimited', 'pipes' => implode('|', $collection), + 'tsv' => implode("\t", $collection), + 'spaceDelimited', 'ssv' => implode(' ', $collection), + default => implode(',', $collection), + }; + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[]|null $httpHeaders HTTP headers + * + * @return mixed a single or an array of $class instances + */ + public static function deserialize(mixed $data, string $class, ?array $httpHeaders = null): mixed + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\Psr\Http\Message\StreamInterface') { + return Utils::streamFor($data); + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + // handle primitive types + if (in_array($class, ['\DateTime', '\SplFileObject'], true)) { + return $data; + } elseif (in_array($class, ['array', 'bool', 'boolean', 'float', 'double', 'int', 'integer', 'object', 'string', 'null'], true)) { + // type ref: https://www.php.net/manual/en/function.settype.php + // byte, mixed, void in the old php client were removed + settype($data, $class); + return $data; + } + + + if (is_subclass_of($class, '\BackedEnum')) { + $data = $class::tryFrom($data); + if ($data === null) { + $imploded = implode("', '", array_map(fn($case) => $case->value, $class::cases())); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + if (is_string($data)) { + $decoded = json_decode($data); + // Keep the original string if decode fails (nested values are already PHP strings). + $data = ($decoded !== null || $data === 'null') ? $decoded : $data; + } + + // A oneOf/anyOf schema is not a value object: dispatch here, after json_decode (so + // members get the decoded value) but before the array-to-object cast (which breaks arrays). + if (is_subclass_of($class, '\Bandwidth\Model\OneOfInterface')) { + return self::deserializeOneOf($data, $class, $httpHeaders); + } + if (is_subclass_of($class, '\Bandwidth\Model\AnyOfInterface')) { + return self::deserializeAnyOf($data, $class, $httpHeaders); + } + + if (is_array($data)) { + $data = (object) $data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\Bandwidth\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Returns true when $data's PHP type is compatible with the OpenAPI primitive $type. + * Prevents settype() coercion (e.g. "abc" → 0 for integer) from producing a false match + * when iterating over oneOf/anyOf candidate types. + * Non-primitive types always return true and are validated downstream by ModelInterface::valid(). + */ + private static function isPrimitiveTypeCompatible(mixed $data, string $type): bool + { + return match($type) { + 'int', 'integer' => is_int($data), + 'float', 'double', 'number' => is_int($data) || is_float($data), + 'bool', 'boolean' => is_bool($data), + 'string' => is_string($data), + 'array' => is_array($data), + 'object' => is_object($data), + default => true, + }; + } + + /** + * Deserialize data into one of the member types of a `oneOf` schema. + * + * When the schema declares a discriminator, its value selects the member type directly. + * Otherwise each member type is tried in turn and the first one that yields a valid model + * (or a non-null primitive) is returned. + * + * @param mixed $data the decoded data to resolve to a member type + * @param string $class a class name implementing OneOfInterface + * @param string[]|null $httpHeaders HTTP headers + * + * @return mixed an instance of one of the `oneOf` member types + */ + private static function deserializeOneOf(mixed $data, string $class, ?array $httpHeaders): mixed + { + // $data is already decoded (see deserialize()). Read the discriminator from an object view + // of it, but deserialize each member from the original $data so array and scalar members + // keep their own type handling instead of being coerced to an object here. + $probe = is_array($data) ? (object) $data : $data; + + $discriminator = $class::getOneOfDiscriminator(); + if ($discriminator !== null && is_object($probe) && isset($probe->{$discriminator}) && is_string($probe->{$discriminator})) { + $mappings = $class::getOneOfDiscriminatorMappings(); + if (isset($mappings[$probe->{$discriminator}])) { + return self::deserialize($data, $mappings[$probe->{$discriminator}], $httpHeaders); + } + } + + foreach ($class::getOneOfTypes() as $type) { + if (!self::isPrimitiveTypeCompatible($data, $type)) { + continue; + } + try { + $instance = self::deserialize($data, $type, $httpHeaders); + } catch (\Throwable $e) { + // Any failure means the data does not match this member type; try the next one. + // The broad catch is intentional: a real failure is not hidden, since the loop + // throws below when no member type matches. + continue; + } + + if ($instance instanceof ModelInterface) { + if ($instance->valid()) { + return $instance; + } + } elseif ($instance !== null) { + return $instance; + } + } + + throw new \InvalidArgumentException(sprintf('No matching schema in oneOf %s for the given data', $class)); + } + + /** + * Deserialize data into one of the member types of an `anyOf` schema. + * + * When the schema declares a discriminator, its value selects the member type directly. + * Otherwise each member type is tried in turn and the first one that yields a valid model + * (or a non-null primitive) is returned. + * + * @param mixed $data the decoded data to resolve to a member type + * @param string $class a class name implementing AnyOfInterface + * @param string[]|null $httpHeaders HTTP headers + * + * @return mixed an instance of one of the `anyOf` member types + */ + private static function deserializeAnyOf(mixed $data, string $class, ?array $httpHeaders): mixed + { + // $data is already decoded (see deserialize()). Read the discriminator from an object view + // of it, but deserialize each member from the original $data so array and scalar members + // keep their own type handling instead of being coerced to an object here. + $probe = is_array($data) ? (object) $data : $data; + + $discriminator = $class::getAnyOfDiscriminator(); + if ($discriminator !== null && is_object($probe) && isset($probe->{$discriminator}) && is_string($probe->{$discriminator})) { + $mappings = $class::getAnyOfDiscriminatorMappings(); + if (isset($mappings[$probe->{$discriminator}])) { + return self::deserialize($data, $mappings[$probe->{$discriminator}], $httpHeaders); + } + } + + foreach ($class::getAnyOfTypes() as $type) { + if (!self::isPrimitiveTypeCompatible($data, $type)) { + continue; + } + try { + $instance = self::deserialize($data, $type, $httpHeaders); + } catch (\Throwable $e) { + // Any failure means the data does not match this member type; try the next one. + // The broad catch is intentional: a real failure is not hidden, since the loop + // throws below when no member type matches. + continue; + } + + if ($instance instanceof ModelInterface) { + if ($instance->valid()) { + return $instance; + } + } elseif ($instance !== null) { + return $instance; + } + } + + throw new \InvalidArgumentException(sprintf('No matching schema in anyOf %s for the given data', $class)); + } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? substr($qs, 0, -1) : ''; + } +} diff --git a/src/PhoneNumberLookup/Controllers/APIController.php b/src/PhoneNumberLookup/Controllers/APIController.php deleted file mode 100644 index aa68036..0000000 --- a/src/PhoneNumberLookup/Controllers/APIController.php +++ /dev/null @@ -1,353 +0,0 @@ - $accountId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::PHONENUMBERLOOKUPDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'phoneNumberLookup'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\AccountsTnlookup400ErrorException( - 'Bad Request. Ensure that your request payload is properly formatted and that the telephone numbers ' . - 'used are valid.', - $_httpContext - ); - } - - if ($response->code == 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.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new APIException( - 'Invalid content-type. Ensure that your content-type header is set to application/json.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new APIException( - 'Too Many Requests. Reduce the amount of requests that you are sending in order to avoid receiving ' . - 'this status code.', - $_httpContext - ); - } - - if ($response->code >= 500) { - throw new APIException( - 'Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code ' . - 'for an extended period of time.', - $_httpContext - ); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\PhoneNumberLookup\\Models\\CreateAsyncBulkResponse' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Get a Bulk Async TN Lookup Order. - * - * @param string $accountId The ID of the Bandwidth account that the user belongs to. - * @param string $requestId The phone number lookup request ID from Bandwidth. - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getAsyncLookupRequestStatus( - string $accountId, - string $requestId - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/phoneNumberLookup/bulk/{requestId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'requestId' => $requestId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::PHONENUMBERLOOKUPDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'phoneNumberLookup'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new APIException( - 'Bad Request. Ensure that you have set the requestId as a URL path parameter.', - $_httpContext - ); - } - - if ($response->code == 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.', - $_httpContext - ); - } - - if ($response->code == 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.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new APIException( - 'Too Many Requests. Reduce the amount of requests that you are sending in order to avoid receiving ' . - 'this status code.', - $_httpContext - ); - } - - if ($response->code >= 500) { - throw new APIException( - 'Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code ' . - 'for an extended period of time.', - $_httpContext - ); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\PhoneNumberLookup\\Models\\LookupResponse' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Create a Sync TN Lookup Order. - * - * @param string $accountId The ID of the Bandwidth account that the user belongs to. - * @param Models\CreateLookupRequest $body - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function createSyncLookupRequest( - string $accountId, - Models\CreateLookupRequest $body - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/phoneNumberLookup'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::PHONENUMBERLOOKUPDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'phoneNumberLookup'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\AccountsTnlookup400ErrorException( - 'Bad Request. Ensure that your request payload is properly formatted and that the telephone numbers ' . - 'used are valid.', - $_httpContext - ); - } - - if ($response->code == 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.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new APIException( - 'Invalid content-type. Ensure that your content-type header is set to application/json.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new APIException( - 'Too Many Requests. Reduce the amount of requests that you are sending in order to avoid receiving ' . - 'this status code.', - $_httpContext - ); - } - - if ($response->code >= 500) { - throw new APIException( - 'Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code ' . - 'for an extended period of time.', - $_httpContext - ); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\PhoneNumberLookup\\Models\\LookupResponse' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } -} diff --git a/src/PhoneNumberLookup/Exceptions/AccountsTnlookup400ErrorException.php b/src/PhoneNumberLookup/Exceptions/AccountsTnlookup400ErrorException.php deleted file mode 100644 index 1d07d92..0000000 --- a/src/PhoneNumberLookup/Exceptions/AccountsTnlookup400ErrorException.php +++ /dev/null @@ -1,38 +0,0 @@ -links = func_get_arg(0); - $this->data = func_get_arg(1); - $this->errors = func_get_arg(2); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['links'] = isset($this->links) ? array_values($this->links) : null; - $json['data'] = $this->data; - $json['errors'] = isset($this->errors) ? array_values($this->errors) : null; - - return array_filter($json); - } -} diff --git a/src/PhoneNumberLookup/Models/CreateAsyncBulkResponseData.php b/src/PhoneNumberLookup/Models/CreateAsyncBulkResponseData.php deleted file mode 100644 index 1a6ae17..0000000 --- a/src/PhoneNumberLookup/Models/CreateAsyncBulkResponseData.php +++ /dev/null @@ -1,44 +0,0 @@ -requestId = func_get_arg(0); - $this->status = func_get_arg(1); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['requestId'] = $this->requestId; - $json['status'] = $this->status; - - return array_filter($json); - } -} diff --git a/src/PhoneNumberLookup/Models/CreateLookupRequest.php b/src/PhoneNumberLookup/Models/CreateLookupRequest.php deleted file mode 100644 index 8c9ec72..0000000 --- a/src/PhoneNumberLookup/Models/CreateLookupRequest.php +++ /dev/null @@ -1,38 +0,0 @@ -phoneNumbers = func_get_arg(0); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['phoneNumbers'] = isset($this->phoneNumbers) ? array_values($this->phoneNumbers) : null; - - return array_filter($json); - } -} diff --git a/src/PhoneNumberLookup/Models/Error.php b/src/PhoneNumberLookup/Models/Error.php deleted file mode 100644 index ae3d76f..0000000 --- a/src/PhoneNumberLookup/Models/Error.php +++ /dev/null @@ -1,60 +0,0 @@ -code = func_get_arg(0); - $this->description = func_get_arg(1); - $this->type = func_get_arg(2); - $this->meta = func_get_arg(3); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['code'] = $this->code; - $json['description'] = $this->description; - $json['type'] = $this->type; - $json['meta'] = $this->meta; - - return array_filter($json); - } -} diff --git a/src/PhoneNumberLookup/Models/ErrorMeta.php b/src/PhoneNumberLookup/Models/ErrorMeta.php deleted file mode 100644 index e0c6e33..0000000 --- a/src/PhoneNumberLookup/Models/ErrorMeta.php +++ /dev/null @@ -1,52 +0,0 @@ -phoneNumbers = func_get_arg(0); - $this->message = func_get_arg(1); - $this->code = func_get_arg(2); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['phoneNumbers'] = isset($this->phoneNumbers) ? array_values($this->phoneNumbers) : null; - $json['message'] = $this->message; - $json['code'] = $this->code; - - return array_filter($json); - } -} diff --git a/src/PhoneNumberLookup/Models/Link.php b/src/PhoneNumberLookup/Models/Link.php deleted file mode 100644 index 8172c00..0000000 --- a/src/PhoneNumberLookup/Models/Link.php +++ /dev/null @@ -1,52 +0,0 @@ -href = func_get_arg(0); - $this->rel = func_get_arg(1); - $this->method = func_get_arg(2); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['href'] = $this->href; - $json['rel'] = $this->rel; - $json['method'] = $this->method; - - return array_filter($json); - } -} diff --git a/src/PhoneNumberLookup/Models/LookupResponse.php b/src/PhoneNumberLookup/Models/LookupResponse.php deleted file mode 100644 index e91d445..0000000 --- a/src/PhoneNumberLookup/Models/LookupResponse.php +++ /dev/null @@ -1,52 +0,0 @@ -links = func_get_arg(0); - $this->data = func_get_arg(1); - $this->errors = func_get_arg(2); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['links'] = isset($this->links) ? array_values($this->links) : null; - $json['data'] = $this->data; - $json['errors'] = isset($this->errors) ? array_values($this->errors) : null; - - return array_filter($json); - } -} diff --git a/src/PhoneNumberLookup/Models/LookupResponseData.php b/src/PhoneNumberLookup/Models/LookupResponseData.php deleted file mode 100644 index 54e945b..0000000 --- a/src/PhoneNumberLookup/Models/LookupResponseData.php +++ /dev/null @@ -1,53 +0,0 @@ -requestId = func_get_arg(0); - $this->status = func_get_arg(1); - $this->results = func_get_arg(2); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['requestId'] = $this->requestId; - $json['status'] = $this->status; - $json['results'] = isset($this->results) ? array_values($this->results) : null; - - return array_filter($json); - } -} diff --git a/src/PhoneNumberLookup/Models/LookupResult.php b/src/PhoneNumberLookup/Models/LookupResult.php deleted file mode 100644 index 8a86ec3..0000000 --- a/src/PhoneNumberLookup/Models/LookupResult.php +++ /dev/null @@ -1,119 +0,0 @@ -phoneNumber = func_get_arg(0); - $this->lineType = func_get_arg(1); - $this->messagingProvider = func_get_arg(2); - $this->voiceProvider = func_get_arg(3); - $this->countryCodeA3 = func_get_arg(4); - $this->deactivationReporter = func_get_arg(5); - $this->deactivationDate = func_get_arg(6); - $this->deactivationEvent = func_get_arg(7); - $this->latestMessageDeliveryStatus = func_get_arg(8); - $this->initialMessageDeliveryStatusDate = func_get_arg(9); - $this->latestMessageDeliveryStatusDate = func_get_arg(10); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['phoneNumber'] = $this->phoneNumber; - $json['lineType'] = $this->lineType; - $json['messagingProvider'] = $this->messagingProvider; - $json['voiceProvider'] = $this->voiceProvider; - $json['countryCodeA3'] = $this->countryCodeA3; - $json['deactivationReporter'] = $this->deactivationReporter; - $json['deactivationDate'] = $this->deactivationDate; - $json['deactivationEvent'] = $this->deactivationEvent; - $json['latestMessageDeliveryStatus'] = $this->latestMessageDeliveryStatus; - $json['initialMessageDeliveryStatusDate'] = isset($this->initialMessageDeliveryStatusDate) ? - DateTimeHelper::toRfc3339DateTime($this->initialMessageDeliveryStatusDate) : null; - $json['latestMessageDeliveryStatusDate'] = isset($this->latestMessageDeliveryStatusDate) ? - DateTimeHelper::toRfc3339DateTime($this->latestMessageDeliveryStatusDate) : null; - - return array_filter($json); - } -} diff --git a/src/PhoneNumberLookup/PhoneNumberLookupClient.php b/src/PhoneNumberLookup/PhoneNumberLookupClient.php deleted file mode 100644 index 5c08aaa..0000000 --- a/src/PhoneNumberLookup/PhoneNumberLookupClient.php +++ /dev/null @@ -1,37 +0,0 @@ -config = $config; - } - - - private $client; - - /** - * Provides access to API controller - * @return Controllers\APIController - */ - public function getClient() - { - if ($this->client == null) { - $this->client = new Controllers\APIController($this->config); - } - return $this->client; - } -} diff --git a/src/Servers.php b/src/Servers.php deleted file mode 100644 index 4c22bea..0000000 --- a/src/Servers.php +++ /dev/null @@ -1,44 +0,0 @@ -format(DateTimeHelper::SIMPLE_DATE); - } else { - throw new Exception('Not a valid DateTime object.'); - } - } - - /** - * Convert an array of DateTime objects to an array of strings in simple date format - * @param array|null $dates The array of DateTime objects to convert - * @return array|null The array of datetime strings in simple date format - */ - public static function toSimpleDateArray(?array $dates) - { - if (is_null($dates)) { - return null; - } else { - return array_map('static::toSimpleDate', $dates); - } - } - - /** - * Parse a datetime string in simple date format to a DateTime object - * @param string|null $date A datetime string in simple date format - * @return \DateTime|null The parsed DateTime object - */ - public static function fromSimpleDate(?string $date) - { - if (is_null($date)) { - return null; - } else { - $x = DateTime::createFromFormat(static::SIMPLE_DATE, $date); - - if ($x instanceof DateTime) { - return $x; - } else { - throw new Exception('Incorrect format.'); - } - } - } - - /** - * Parse an array of datetime strings in simple date format to an array of DateTime objects - * @param array|null $dates An array of datetime strings in simple date format - * @return array|null An array of parsed DateTime objects - */ - public static function fromSimpleDateArray(?array $dates) - { - if (is_null($dates)) { - return null; - } else { - return array_map('static::fromSimpleDate', $dates); - } - } - - - /** - * Convert a DateTime object to a string in Rfc1123 format - * @param \DateTime|null $datetime The DateTime object to convert - * @return string|null The datetime as a string in Rfc1123 format - */ - public static function toRfc1123DateTime(?DateTime $datetime) - { - if (is_null($datetime)) { - return null; - } elseif ($datetime instanceof DateTime) { - return $datetime->setTimeZone(new DateTimeZone('GMT'))->format(static::RFC1123); - } else { - throw new Exception('Not a valid DateTime object.'); - } - } - - /** - * Convert an array of DateTime objects to an array of strings in Rfc1123 format - * @param array|null $datetimes The array of DateTime objects to convert - * @return array|null The array of datetime strings in Rfc1123 format - */ - public static function toRfc1123DateTimeArray(?array $datetimes) - { - if (is_null($datetimes)) { - return null; - } else { - return array_map('static::toRfc1123DateTime', $datetimes); - } - } - - /** - * Parse a datetime string in Rfc1123 format to a DateTime object - * @param string|null $datetime A datetime string in Rfc1123 format - * @return \DateTime|null The parsed DateTime object - */ - public static function fromRfc1123DateTime(?string $datetime) - { - if (is_null($datetime)) { - return null; - } else { - $x = DateTime::createFromFormat(DateTime::RFC1123, $datetime); - - if ($x instanceof DateTime) { - return $x->setTimeZone(new DateTimeZone('GMT')); - } else { - throw new Exception('Incorrect format.'); - } - } - } - - /** - * Parse an array of datetime strings in Rfc1123 format to an array of DateTime objects - * @param array|null $datetimes An array of datetime strings in Rfc1123 format - * @return array|null An array of parsed DateTime objects - */ - public static function fromRfc1123DateTimeArray(?array $datetimes) - { - if (is_null($datetimes)) { - return null; - } else { - return array_map('static::fromRfc1123DateTime', $datetimes); - } - } - - - /** - * Convert a DateTime object to a string in Rfc3339 format - * @param \DateTime|null $datetime The DateTime object to convert - * @return string|null The datetime as a string in Rfc3339 format - */ - public static function toRfc3339DateTime(?DateTime $datetime) - { - if (is_null($datetime)) { - return null; - } elseif ($datetime instanceof DateTime) { - return $datetime->setTimeZone(new DateTimeZone('UTC'))->format(DateTime::RFC3339); - } else { - throw new Exception('Not a valid DateTime object.'); - } - } - - /** - * Convert an array of DateTime objects to an array of strings in Rfc3339 format - * @param array|null $datetimes The array of DateTime objects to convert - * @return array|null The array of datetime strings in Rfc3339 format - */ - public static function toRfc3339DateTimeArray(?array $datetimes) - { - if (is_null($datetimes)) { - return null; - } else { - return array_map('static::toRfc3339DateTime', $datetimes); - } - } - - /** - * Parse a datetime string in Rfc3339 format to a DateTime object - * @param string|null $datetime A datetime string in Rfc3339 format - * @return \DateTime|null The parsed DateTime object - */ - public static function fromRfc3339DateTime(?string $datetime) - { - if (is_null($datetime)) { - return null; - } else { - // Check for timezone information and append it if missing - if (!(substr($datetime, strlen($datetime)-1) == 'Z' || strpos($datetime, '+'))) { - $datetime .= 'Z'; - } - - $x = DateTime::createFromFormat(DateTime::RFC3339, $datetime); - - if ($x instanceof DateTime) { - return $x->setTimeZone(new DateTimeZone('UTC')); - } else { - $x = DateTime::createFromFormat("Y-m-d\TH:i:s.uP", $datetime); // parse with up to 6 microseconds - if ($x instanceof DateTime) { - return $x->setTimeZone(new DateTimeZone('UTC')); - } else { - $x = DateTime::createFromFormat("Y-m-d\TH:i:s.uuP", $datetime); // parse with up to 12 microseconds - if ($x instanceof DateTime) { - return $x->setTimeZone(new DateTimeZone('UTC')); - } else { - throw new Exception('Incorrect format.'); - } - } - } - } - } - - /** - * Parse an array of datetime strings in Rfc3339 format to an array of DateTime objects - * @param array|null $datetimes An array of datetime strings in Rfc3339 format - * @return array|null An array of parsed DateTime objects - */ - public static function fromRfc3339DateTimeArray(?array $datetimes) - { - if (is_null($datetimes)) { - return null; - } else { - return array_map('static::fromRfc3339DateTime', $datetimes); - } - } - - - /** - * Convert a DateTime object to a Unix Timestamp - * @param \DateTime|null $datetime The DateTime object to convert - * @return int|null The converted Unix Timestamp - */ - public static function toUnixTimestamp(?DateTime $datetime) - { - if (is_null($datetime)) { - return null; - } elseif ($datetime instanceof DateTime) { - return $datetime->getTimestamp(); - } else { - throw new Exception('Not a valid DateTime object.'); - } - } - - /** - * Convert an array of DateTime objects to an array of Unix timestamps - * @param array|null $datetimes The array of DateTime objects to convert - * @return array|null The array of integers representing date-time in Unix timestamp - */ - public static function toUnixTimestampArray(?array $datetimes) - { - if (is_null($datetimes)) { - return null; - } else { - return array_map('static::toUnixTimestamp', $datetimes); - } - } - - /** - * Parse a Unix Timestamp to a DateTime object - * @param string|null $datetime The Unix Timestamp - * @return \DateTime|null The parsed DateTime object - */ - public static function fromUnixTimestamp(?string $datetime) - { - if (is_null($datetime)) { - return null; - } else { - $x = DateTime::createFromFormat("U", $datetime); - - if ($x instanceof DateTime) { - return $x; - } else { - throw new Exception('Incorrect format.'); - } - } - } - - /** - * Parse an array of Unix Timestamps to an array of DateTime objects - * @param array|null $datetimes An array of Unix Timestamps - * @return array|null An array of parsed DateTime objects - */ - public static function fromUnixTimestampArray(?array $datetimes) - { - if (is_null($datetimes)) { - return null; - } else { - return array_map('static::fromUnixTimestamp', $datetimes); - } - } -} diff --git a/src/Voice/Bxml/Bridge.php b/src/Voice/Bxml/Bridge.php deleted file mode 100644 index 67e0e43..0000000 --- a/src/Voice/Bxml/Bridge.php +++ /dev/null @@ -1,273 +0,0 @@ -targetCall = $targetCall; - } - - /** - * Sets the bridgeCompleteUrl attribute for Bridge - * - * @param string $bridgeCompleteUrl URL to send the bridge complete event to - */ - public function bridgeCompleteUrl(string $bridgeCompleteUrl): Bridge { - $this->bridgeCompleteUrl = $bridgeCompleteUrl; - return $this; - } - - /** - * Sets the bridgeCompleteMethod attribute for Bridge - * - * @param string $bridgeCompleteMethod HTTP method to send the bridge complete event - */ - public function bridgeCompleteMethod(string $bridgeCompleteMethod): Bridge { - $this->bridgeCompleteMethod = $bridgeCompleteMethod; - return $this; - } - - /** - * Sets the bridgeTargetCompleteUrl attribute for Bridge - * - * @param string $bridgeTargetCompleteUrl URL to send the bridge target complete event to - */ - public function bridgeTargetCompleteUrl(string $bridgeTargetCompleteUrl): Bridge { - $this->bridgeTargetCompleteUrl = $bridgeTargetCompleteUrl; - return $this; - } - - /** - * Sets the bridgeTargetCompleteMethod attribute for Bridge - * - * @param string $bridgeTargetCompleteMethod HTTP method to send the bridge target complete event - */ - public function bridgeTargetCompleteMethod(string $bridgeTargetCompleteMethod): Bridge { - $this->bridgeTargetCompleteMethod = $bridgeTargetCompleteMethod; - return $this; - } - - /** - * Sets the username attribute for Bridge - * - * @param string $username HTTP basic auth username for sending events - */ - public function username(string $username): Bridge { - $this->username = $username; - return $this; - } - - /** - * Sets the password attribute for Bridge - * - * @param string $password HTTP basic auth password for sending events - */ - public function password(string $password): Bridge { - $this->password = $password; - return $this; - } - - /** - * Sets the tag attribute for Bridge - * - * @param string $tag String to include in events - */ - public function tag(string $tag): Bridge { - $this->tag = $tag; - return $this; - } - - /** - * Sets the bridgeCompleteFallbackUrl attribute for Bridge - * - * @param string $bridgeCompleteFallbackUrl Fallback URL for bridge complete callback events - */ - public function bridgeCompleteFallbackUrl(string $bridgeCompleteFallbackUrl): Bridge { - $this->bridgeCompleteFallbackUrl = $bridgeCompleteFallbackUrl; - return $this; - } - - /** - * Sets the bridgeCompleteFallbackMethod attribute for Bridge - * - * @param string $bridgeCompleteFallbackMethod HTTP method for bridge complete fallback requests - */ - public function bridgeCompleteFallbackMethod(string $bridgeCompleteFallbackMethod): Bridge { - $this->bridgeCompleteFallbackMethod = $bridgeCompleteFallbackMethod; - return $this; - } - - /** - * Sets the bridgeTargetCompleteFallbackUrl attribute for Bridge - * - * @param string $bridgeTargetCompleteFallbackUrl Fallback URL for bridge target complete callback events - */ - public function bridgeTargetCompleteFallbackUrl(string $bridgeTargetCompleteFallbackUrl): Bridge { - $this->bridgeTargetCompleteFallbackUrl = $bridgeTargetCompleteFallbackUrl; - return $this; - } - - /** - * Sets the bridgeTargetCompleteFallbackMethod attribute for Bridge - * - * @param string $bridgeTargetCompleteFallbackMethod HTTP method for bridge target complete fallback events - */ - public function bridgeTargetCompleteFallbackMethod(string $bridgeTargetCompleteFallbackMethod): Bridge { - $this->bridgeTargetCompleteFallbackMethod = $bridgeTargetCompleteFallbackMethod; - return $this; - } - - /** - * Sets the fallbackUsername attribute for Bridge - * - * @param string $fallbackUsername HTTP basic auth username for fallback events - */ - public function fallbackUsername(string $fallbackUsername): Bridge { - $this->fallbackUsername = $fallbackUsername; - return $this; - } - - /** - * Sets the fallbackPassword attribute for Bridge - * - * @param string $fallbackPassword HTTP basic auth password - */ - public function fallbackPassword(string $fallbackPassword): Bridge { - $this->fallbackPassword = $fallbackPassword; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("Bridge"); - - $element->appendChild($doc->createTextNode($this->targetCall)); - - if(isset($this->bridgeCompleteUrl)) { - $element->setAttribute("bridgeCompleteUrl", $this->bridgeCompleteUrl); - } - - if(isset($this->bridgeCompleteMethod)) { - $element->setAttribute("bridgeCompleteMethod", $this->bridgeCompleteMethod); - } - - if(isset($this->bridgeTargetCompleteUrl)) { - $element->setAttribute("bridgeTargetCompleteUrl", $this->bridgeTargetCompleteUrl); - } - - if(isset($this->bridgeTargetCompleteMethod)) { - $element->setAttribute("bridgeTargetCompleteMethod", $this->bridgeTargetCompleteMethod); - } - - if(isset($this->username)) { - $element->setAttribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setAttribute("password", $this->password); - } - - if(isset($this->tag)) { - $element->setAttribute("tag", $this->tag); - } - - if(isset($this->bridgeCompleteFallbackUrl)) { - $element->setAttribute("bridgeCompleteFallbackUrl", $this->bridgeCompleteFallbackUrl); - } - - if(isset($this->bridgeCompleteFallbackMethod)) { - $element->setAttribute("bridgeCompleteFallbackMethod", $this->bridgeCompleteFallbackMethod); - } - - if(isset($this->bridgeTargetCompleteFallbackUrl)) { - $element->setAttribute("bridgeTargetCompleteFallbackUrl", $this->bridgeTargetCompleteFallbackUrl); - } - - if(isset($this->bridgeTargetCompleteFallbackMethod)) { - $element->setAttribute("bridgeTargetCompleteFallbackMethod", $this->bridgeTargetCompleteFallbackMethod); - } - - if(isset($this->fallbackUsername)) { - $element->setAttribute("fallbackUsername", $this->fallbackUsername); - } - - if(isset($this->fallbackPassword)) { - $element->setAttribute("fallbackPassword", $this->fallbackPassword); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/Bxml.php b/src/Voice/Bxml/Bxml.php deleted file mode 100644 index a6d4393..0000000 --- a/src/Voice/Bxml/Bxml.php +++ /dev/null @@ -1,54 +0,0 @@ -verbs = array(); - } - - /** - * Adds the verb to the verbs - * - * @param Verb $verb The verb to add to the list - */ - public function addVerb(Verb $verb): Bxml { - array_push($this->verbs, $verb); - return $this; - } - - /** - * Converts the Response class into its BXML representation - * - * @return string The xml representation of the class - */ - public function toBxml(): string { - $ssmlRegex = '/<([a-zA-Z\/\/].*?)>/'; - $doc = new DOMDocument('1.0', 'UTF-8'); - $bxmlElement = $doc->createElement("Bxml"); - - foreach ($this->verbs as $verb) { - $bxmlElement->appendChild($verb->toBxml($doc)); - } - - $doc->appendChild($bxmlElement); - return str_replace("\n", '', preg_replace($ssmlRegex, "<$1>", $doc->saveXML())); - } -} diff --git a/src/Voice/Bxml/Conference.php b/src/Voice/Bxml/Conference.php deleted file mode 100644 index c666666..0000000 --- a/src/Voice/Bxml/Conference.php +++ /dev/null @@ -1,273 +0,0 @@ -conferenceName = $conferenceName; - } - - /** - * Sets the tag attribute for Conference - * - * @param string $tag A custom string to be included in callbacks - */ - public function tag(string $tag): Conference { - $this->tag = $tag; - return $this; - } - - /** - * Sets the username attribute for Conference - * - * @param string $username Username for basic auth for callbacks - */ - public function username(string $username): Conference { - $this->username = $username; - return $this; - } - - /** - * Sets the password attribute for Conference - * - * @param string $password Password for basic auth for callbacks - */ - public function password(string $password): Conference { - $this->password = $password; - return $this; - } - - /** - * Sets the conferenceEventUrl attribute for Conference - * - * @param string $conferenceEventUrl URL to receive conference events - */ - public function conferenceEventUrl(string $conferenceEventUrl): Conference { - $this->conferenceEventUrl = $conferenceEventUrl; - return $this; - } - - /** - * Sets the conferenceEventMethod attribute for Conference - * - * @param string $conferenceEventMethod HTTP method for conference events - */ - public function conferenceEventMethod(string $conferenceEventMethod): Conference { - $this->conferenceEventMethod = $conferenceEventMethod; - return $this; - } - - /** - * Sets the callIdsToCoach attribute for Conference - * - * @param string $callIdsToCoach A string of comma separated call IDs to coach - */ - public function callIdsToCoach(string $callIdsToCoach): Conference { - $this->callIdsToCoach = $callIdsToCoach; - return $this; - } - - /** - * Sets the callIdsToCoach attribute for Conference - * - * @param array $callIdsToCoach An array of call IDs to coach - */ - public function callIdsToCoachArray(array $callIdsToCoach): Conference { - $this->callIdsToCoach = implode(",", $callIdsToCoach); - return $this; - } - - /** - * Sets the mute attribute for Conference - * - * @param boolean $mute Determines if conference members should be on mute - */ - public function mute(bool $mute): Conference { - $this->mute = $mute; - return $this; - } - - /** - * Sets the hold attribute for Conference - * - * @param boolean $hold Determines if conference members should be on hold - */ - public function hold(bool $hold): Conference { - $this->hold = $hold; - return $this; - } - - /** - * Sets the conferenceEventFallbackUrl attribute for Conference - * - * @param string $conferenceEventFallbackUrl Fallback url for conference events - */ - public function conferenceEventFallbackUrl(string $conferenceEventFallbackUrl): Conference { - $this->conferenceEventFallbackUrl = $conferenceEventFallbackUrl; - return $this; - } - - /** - * Sets the conferenceEventFallbackMethod attribute for Conference - * - * @param string $conferenceEventFallbackMethod HTTP method for fallback events - */ - public function conferenceEventFallbackMethod(string $conferenceEventFallbackMethod): Conference { - $this->conferenceEventFallbackMethod = $conferenceEventFallbackMethod; - return $this; - } - - /** - * Sets the fallbackUsername attribute for Conference - * - * @param string $fallbackUsername HTTP basic auth username for fallback events - */ - public function fallbackUsername(string $fallbackUsername): Conference { - $this->fallbackUsername = $fallbackUsername; - return $this; - } - - /** - * Sets the fallbackPassword attribute for Conference - * - * @param string $fallbackPassword HTTP basic auth password for fallback events - */ - public function fallbackPassword(string $fallbackPassword): Conference { - $this->fallbackPassword = $fallbackPassword; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("Conference"); - - $element->appendChild($doc->createTextNode($this->conferenceName)); - - if(isset($this->username)) { - $element->setattribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setattribute("password", $this->password); - } - - if(isset($this->tag)) { - $element->setattribute("tag", $this->tag); - } - - if(isset($this->mute)) { - if ($this->mute) { - $element->setattribute("mute", "true"); - } else { - $element->setattribute("mute", "false"); - } - } - - if(isset($this->hold)) { - if ($this->hold) { - $element->setattribute("hold", "true"); - } else { - $element->setattribute("hold", "false"); - } - } - - if(isset($this->callIdsToCoach)) { - $element->setattribute("callIdsToCoach", $this->callIdsToCoach); - } - - if(isset($this->conferenceEventUrl)) { - $element->setattribute("conferenceEventUrl", $this->conferenceEventUrl); - } - - if(isset($this->conferenceEventMethod)) { - $element->setattribute("conferenceEventMethod", $this->conferenceEventMethod); - } - - if(isset($this->conferenceEventFallbackUrl)) { - $element->setattribute("conferenceEventFallbackUrl", $this->conferenceEventFallbackUrl); - } - - if(isset($this->conferenceEventFallbackMethod)) { - $element->setattribute("conferenceEventFallbackMethod", $this->conferenceEventFallbackMethod); - } - - if(isset($this->fallbackUsername)) { - $element->setattribute("fallbackUsername", $this->fallbackUsername); - } - - if(isset($this->fallbackPassword)) { - $element->setattribute("fallbackPassword", $this->fallbackPassword); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/CustomParam.php b/src/Voice/Bxml/CustomParam.php deleted file mode 100644 index ee2fb6a..0000000 --- a/src/Voice/Bxml/CustomParam.php +++ /dev/null @@ -1,60 +0,0 @@ - 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. - * - * * @copyright Bandwidth INC - */ - -namespace BandwidthLib\Voice\Bxml; - -use DOMDocument; -use DOMElement; - -require_once "Verb.php"; - -class CustomParam extends Verb { - /** - * @var string - */ - private $value; - /** - * @var string - */ - private $name; - - /** - * Sets the name attribute for CustomParam - * - * @param string $name (required) The name of this parameter, up to 256 characters. - */ - public function name(string $name): CustomParam { - $this->name = $name; - return $this; - } - - /** - * Sets the value attribute for CustomParam - * - * @param string $value (required) The value of this parameter, up to 2048 characters. - */ - public function value(string $value): CustomParam { - $this->value = $value; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("CustomParam"); - - if(isset($this->name)) { - $element->setAttribute("name", $this->name); - } - - if(isset($this->value)) { - $element->setAttribute("value", $this->value); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/Forward.php b/src/Voice/Bxml/Forward.php deleted file mode 100644 index 18e12a1..0000000 --- a/src/Voice/Bxml/Forward.php +++ /dev/null @@ -1,114 +0,0 @@ -to = $to; - return $this; - } - - /** - * Sets the from attribute for Forward - * - * @param string $from The phone number to make the phone call - */ - public function from(string $from): Forward { - $this->from = $from; - return $this; - } - - /** - * Sets the callTimeout attribute for Forward - * - * @param string $callTimeout The timeout in seconds for the phone call - */ - public function callTimeout(string $callTimeout): Forward { - $this->callTimeout = $callTimeout; - return $this; - } - - /** - * Sets the diversionTreatment attribute for Forward - * - * @param string $diversionTreatment The diversion treatment for the phone call - */ - public function diversionTreatment(string $diversionTreatment): Forward { - $this->diversionTreatment = $diversionTreatment; - return $this; - } - - /** - * Sets the diversionReason attribute for Forward - * - * @param string $diversionReason The diversion treatment for the phone call - */ - public function diversionReason(string $diversionReason): Forward { - $this->diversionReason = $diversionReason; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("Forward"); - - if(isset($this->to)) { - $element->setAttribute("to", $this->to); - } - - if(isset($this->from)) { - $element->setAttribute("from", $this->from); - } - - if(isset($this->callTimeout)) { - $element->setAttribute("callTimeout", $this->callTimeout); - } - - if(isset($this->diversionTreatment)) { - $element->setAttribute("diversionTreatment", $this->diversionTreatment); - } - - if(isset($this->diversionReason)) { - $element->setAttribute("diversionReason", $this->diversionReason); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/Gather.php b/src/Voice/Bxml/Gather.php deleted file mode 100644 index 4353c5a..0000000 --- a/src/Voice/Bxml/Gather.php +++ /dev/null @@ -1,329 +0,0 @@ -username = $username; - return $this; - } - - /** - * Sets the password attribute for Gather - * - * @param string $password The password for http authentication for the gather callback - */ - public function password(string $password): Gather { - $this->password = $password; - return $this; - } - - /** - * Sets the gatherUrl attribute for Gather - * - * @param string $gatherUrl The url to receive the gather callback - */ - public function gatherUrl(string $gatherUrl): Gather { - $this->gatherUrl = $gatherUrl; - return $this; - } - - /** - * Sets the gatherMethod attribute for Gather - * - * @param string $gatherMethod The http method to send the gather callback - */ - public function gatherMethod(string $gatherMethod): Gather { - $this->gatherMethod = $gatherMethod; - return $this; - } - - /** - * Sets the tag attribute for Gather - * - * @param string $tag A custom string to be included in callbacks - */ - public function tag(string $tag): Gather { - $this->tag = $tag; - return $this; - } - - /** - * Sets the terminatingDigits attribute for Gather - * - * @param string $terminatingDigits Digits to terminate the gather - */ - public function terminatingDigits(string $terminatingDigits): Gather { - $this->terminatingDigits = $terminatingDigits; - return $this; - } - - /** - * Sets the maxDigits attribute for Gather - * - * @param int $maxDigits The maximum number of digits to collect in the gather - */ - public function maxDigits(int $maxDigits): Gather { - $this->maxDigits = $maxDigits; - return $this; - } - - /** - * Sets the interDigitTimeout attribute for Gather - * - * @param int $interDigitTimeout The time in secods between digit presses before timing out - */ - public function interDigitTimeout(int $interDigitTimeout): Gather { - $this->interDigitTimeout = $interDigitTimeout; - return $this; - } - - /** - * Sets the firstDigitTimeout attribute for Gather - * - * @param int $firstDigitTimeout The time in seconds before the first digit is pressed before timing out - */ - public function firstDigitTimeout(int $firstDigitTimeout): Gather { - $this->firstDigitTimeout = $firstDigitTimeout; - return $this; - } - - /** - * Sets the PlayAudio tag for Gather - * - * @param PlayAudio $playAudio The PlayAudio tag to include in the Gather - */ - public function playAudio(PlayAudio $playAudio): Gather { - $this->playAudio = $playAudio; - return $this->addNestableVerb($playAudio); - } - - /** - * Sets the repeatCount attribute for the Gather - * - * @param int $repeatCount The number of times to repeat the played audio - */ - public function repeatCount(int $repeatCount): Gather { - $this->repeatCount = $repeatCount; - return $this; - } - - /** - * Sets the SpeakSentence tag for Gather. - * - * @param SpeakSentence $speakSentence The SpeakSentence tag to include in the Gather - */ - public function speakSentence(SpeakSentence $speakSentence): Gather { - $this->speakSentence = $speakSentence; - return $this->addNestableVerb($speakSentence); - } - - /** - * Sets the gatherFallbackUrl attribute for Gather - * - * @param string $gatherFallbackUrl Fallback url for gather events - */ - public function gatherFallbackUrl(string $gatherFallbackUrl): Gather { - $this->gatherFallbackUrl = $gatherFallbackUrl; - return $this; - } - - /** - * Sets the gatherFallbackMethod attribute for Gather - * - * @param string $gatherFallbackMethod HTTP method for fallback events - */ - public function gatherFallbackMethod(string $gatherFallbackMethod): Gather { - $this->gatherFallbackMethod = $gatherFallbackMethod; - return $this; - } - - /** - * Sets the fallbackUsername attribute for Gather - * - * @param string $fallbackUsername HTTP basic auth username for fallback events - */ - public function fallbackUsername(string $fallbackUsername): Gather { - $this->fallbackUsername = $fallbackUsername; - return $this; - } - - /** - * Sets the fallbackPassword attribute for Gather - * - * @param string $fallbackPassword HTTP basic auth password for fallback events - */ - public function fallbackPassword(string $fallbackPassword): Gather { - $this->fallbackPassword = $fallbackPassword; - return $this; - } - - /** - * Adds a nestable verb being one of SpeakSentence or PlayAudio. - * - * @param SpeakSentence|PlayAudio $verb The nestable verb to add - */ - private function addNestableVerb($verb): Gather { - if(!isset($this->nestableVerbs)) { - $this->nestableVerbs = []; - } - array_push($this->nestableVerbs, $verb); - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("Gather"); - - if(isset($this->username)) { - $element->setAttribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setAttribute("password", $this->password); - } - - if(isset($this->tag)) { - $element->setAttribute("tag", $this->tag); - } - - if(isset($this->gatherUrl)) { - $element->setAttribute("gatherUrl", $this->gatherUrl); - } - - if(isset($this->gatherMethod)) { - $element->setAttribute("gatherMethod", $this->gatherMethod); - } - - if(isset($this->terminatingDigits)) { - $element->setAttribute("terminatingDigits", $this->terminatingDigits); - } - - if(isset($this->maxDigits)) { - $element->setAttribute("maxDigits", $this->maxDigits); - } - - if(isset($this->interDigitTimeout)) { - $element->setAttribute("interDigitTimeout", $this->interDigitTimeout); - } - - if(isset($this->firstDigitTimeout)) { - $element->setAttribute("firstDigitTimeout", $this->firstDigitTimeout); - } - - if(isset($this->repeatCount)) { - $element->setAttribute("repeatCount", $this->repeatCount); - } - - if(isset($this->gatherFallbackUrl)) { - $element->setAttribute("gatherFallbackUrl", $this->gatherFallbackUrl); - } - - if(isset($this->gatherFallbackMethod)) { - $element->setAttribute("gatherFallbackMethod", $this->gatherFallbackMethod); - } - - if(isset($this->fallbackUsername)) { - $element->setAttribute("fallbackUsername", $this->fallbackUsername); - } - - if(isset($this->fallbackPassword)) { - $element->setAttribute("fallbackPassword", $this->fallbackPassword); - } - - if(isset($this->nestableVerbs)) { - foreach ($this->nestableVerbs as $verb) { - $element->appendChild($verb->toBxml($doc)); - } - } - - return $element; - } -} diff --git a/src/Voice/Bxml/Hangup.php b/src/Voice/Bxml/Hangup.php deleted file mode 100644 index a8ca057..0000000 --- a/src/Voice/Bxml/Hangup.php +++ /dev/null @@ -1,23 +0,0 @@ -createElement("Hangup"); - return $element; - } -} diff --git a/src/Voice/Bxml/Pause.php b/src/Voice/Bxml/Pause.php deleted file mode 100644 index 94b1266..0000000 --- a/src/Voice/Bxml/Pause.php +++ /dev/null @@ -1,42 +0,0 @@ -duration = $duration; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("Pause"); - - if(isset($this->duration)) { - $element->setAttribute("duration", $this->duration); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/PauseRecording.php b/src/Voice/Bxml/PauseRecording.php deleted file mode 100644 index eb2839e..0000000 --- a/src/Voice/Bxml/PauseRecording.php +++ /dev/null @@ -1,23 +0,0 @@ -createElement("PauseRecording"); - return $element; - } -} diff --git a/src/Voice/Bxml/PhoneNumber.php b/src/Voice/Bxml/PhoneNumber.php deleted file mode 100644 index e5adcc1..0000000 --- a/src/Voice/Bxml/PhoneNumber.php +++ /dev/null @@ -1,237 +0,0 @@ -phoneNumber = $phoneNumber; - } - - /** - * Sets the username attribute for PhoneNumber - * - * @param string $username The username for http authentication on the audio url - */ - public function username(string $username): PhoneNumber { - $this->username = $username; - return $this; - } - - /** - * Sets the password attribute for PhoneNumber - * - * @param string $password The password for http authentication on the audio url - */ - public function password(string $password): PhoneNumber { - $this->password = $password; - return $this; - } - - /** - * Sets the transferAnswerUrl attribute for PhoneNumber - * - * @param string $transferAnswerUrl The url to receive the transfer answered callback - */ - public function transferAnswerUrl(string $transferAnswerUrl): PhoneNumber { - $this->transferAnswerUrl = $transferAnswerUrl; - return $this; - } - - /** - * Sets the transferAnswerMethod attribute for PhoneNumber - * - * @param string $transferAnswerMethod The http method to send the transfer answered callback - */ - public function transferAnswerMethod(string $transferAnswerMethod): PhoneNumber { - $this->transferAnswerMethod = $transferAnswerMethod; - return $this; - } - - /** - * Sets the transferDisconnectUrl attribute for PhoneNumber - * - * @param string $transferDisconnectUrl The url to receive the transfer disconnect callback - */ - public function transferDisconnectUrl(string $transferDisconnectUrl): PhoneNumber { - $this->transferDisconnectUrl = $transferDisconnectUrl; - return $this; - } - - /** - * Sets the transferDisconnectMethod attribute for PhoneNumber - * - * @param string $transferDisconnectMethod The http method to send the transfer disconnect callback - */ - public function transferDisconnectMethod(string $transferDisconnectMethod): PhoneNumber { - $this->transferDisconnectMethod = $transferDisconnectMethod; - return $this; - } - - /** - * Sets the tag attribute for PhoneNumber - * - * @param string $tag A custom string to be included in callbacks - */ - public function tag(string $tag): PhoneNumber { - $this->tag = $tag; - return $this; - } - - /** - * Sets the transferAnswerFallbackUrl attribute for PhoneNumber - * - * @param string $transferAnswerFallbackUrl Fallback URL for transfer answer events - */ - public function transferAnswerFallbackUrl(string $transferAnswerFallbackUrl): PhoneNumber { - $this->transferAnswerFallbackUrl = $transferAnswerFallbackUrl; - return $this; - } - - /** - * Sets the transferAnswerFallbackMethod attribute for PhoneNumber - * - * @param string $transferAnswerFallbackMethod HTTP method for fallback events - */ - public function transferAnswerFallbackMethod(string $transferAnswerFallbackMethod): PhoneNumber { - $this->transferAnswerFallbackMethod = $transferAnswerFallbackMethod; - return $this; - } - - /** - * Sets the fallbackUsername attribute for PhoneNumber - * - * @param string $fallbackUsername HTTP basic auth username for fallback events - */ - public function fallbackUsername(string $fallbackUsername): PhoneNumber { - $this->fallbackUsername = $fallbackUsername; - return $this; - } - - /** - * Sets the fallbackPassword attribute for PhoneNumber - * - * @param string $fallbackPassword HTTP basic auth password for fallback events - */ - public function fallbackPassword(string $fallbackPassword): PhoneNumber { - $this->fallbackPassword = $fallbackPassword; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("PhoneNumber"); - - $element->appendChild($doc->createTextNode($this->phoneNumber)); - - if(isset($this->username)) { - $element->setAttribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setAttribute("password", $this->password); - } - - if(isset($this->tag)) { - $element->setAttribute("tag", $this->tag); - } - - if(isset($this->transferAnswerUrl)) { - $element->setAttribute("transferAnswerUrl", $this->transferAnswerUrl); - } - - if(isset($this->transferAnswerMethod)) { - $element->setAttribute("transferAnswerMethod", $this->transferAnswerMethod); - } - - if(isset($this->transferDisconnectUrl)) { - $element->setAttribute("transferDisconnectUrl", $this->transferDisconnectUrl); - } - - if(isset($this->transferDisconnectMethod)) { - $element->setAttribute("transferDisconnectMethod", $this->transferDisconnectMethod); - } - - if(isset($this->transferAnswerFallbackUrl)) { - $element->setAttribute("transferAnswerFallbackUrl", $this->transferAnswerFallbackUrl); - } - - if(isset($this->transferAnswerFallbackMethod)) { - $element->setAttribute("transferAnswerFallbackMethod", $this->transferAnswerFallbackMethod); - } - - if(isset($this->fallbackUsername)) { - $element->setAttribute("fallbackUsername", $this->fallbackUsername); - } - - if(isset($this->fallbackPassword)) { - $element->setAttribute("fallbackPassword", $this->fallbackPassword); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/PlayAudio.php b/src/Voice/Bxml/PlayAudio.php deleted file mode 100644 index 4c4defd..0000000 --- a/src/Voice/Bxml/PlayAudio.php +++ /dev/null @@ -1,75 +0,0 @@ -url = $url; - } - - /** - * Sets the username attribute for PlayAudio - * - * @param string $username The username for http authentication on the audio url - */ - public function username(string $username): PlayAudio { - $this->username = $username; - return $this; - } - - /** - * Sets the password attribute for PlayAudio - * - * @param string $password The password for http authentication on the audio url - */ - public function password(string $password): PlayAudio { - $this->password = $password; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("PlayAudio"); - - $element->appendChild($doc->createTextNode($this->url)); - - if(isset($this->username)) { - $element->setAttribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setAttribute("password", $this->password); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/Record.php b/src/Voice/Bxml/Record.php deleted file mode 100644 index bff91c6..0000000 --- a/src/Voice/Bxml/Record.php +++ /dev/null @@ -1,376 +0,0 @@ -tag = $tag; - return $this; - } - - /** - * Sets the recordCompleteUrl attribute for Record - * - * @param string $recordCompleteUrl URL to send the record complete callback to - */ - public function recordCompleteUrl(string $recordCompleteUrl): Record { - $this->recordCompleteUrl = $recordCompleteUrl; - return $this; - } - - /** - * Sets the recordCompleteMethod attribute for Record - * - * @param string $recordCompleteMethod HTTP method to send record complete - * as ("GET" or "POST") - */ - public function recordCompleteMethod(string $recordCompleteMethod): Record { - $this->recordCompleteMethod = $recordCompleteMethod; - return $this; - } - - /** - * Sets the recordingAvailableUrl attribute for Record - * - * @param string $recordingAvailableUrl URL to send the record available callback to - */ - public function recordingAvailableUrl(string $recordingAvailableUrl): Record { - $this->recordingAvailableUrl = $recordingAvailableUrl; - return $this; - } - - /** - * Sets the recordingAvailableMethod attribute for Record - * - * @param string $recordingAvailableMethod HTTP method to send record available - * as ("GET" or "POST") - */ - public function recordingAvailableMethod(string $recordingAvailableMethod): Record { - $this->recordingAvailableMethod = $recordingAvailableMethod; - return $this; - } - - /** - * Sets the username attribute for Record - * - * @param string $username Username for basic auth for callbacks - */ - public function username(string $username): Record { - $this->username = $username; - return $this; - } - - /** - * Sets the password attribute for Record - * - * @param string $password Password for basic auth for callbacks - */ - public function password(string $password): Record { - $this->password = $password; - return $this; - } - - /** - * Sets the terminatingDigits attribute for Record - * - * @param string $terminatingDigits Digits to terminate the recording - */ - public function terminatingDigits(string $terminatingDigits): Record { - $this->terminatingDigits = $terminatingDigits; - return $this; - } - - /** - * Sets the maxDuration attribute for Record - * - * @param int $maxDuration Maximum length of the recording in secods - */ - public function maxDuration(int $maxDuration): Record { - $this->maxDuration = $maxDuration; - return $this; - } - - /** - * Sets the fileFormat attribute for Record - * - * @param string $fileFormat Audio format of the recording ("mp3" or "wav") - */ - public function fileFormat(string $fileFormat): Record { - $this->fileFormat = $fileFormat; - return $this; - } - - /** - * Sets the detectLanguage attribute for Record - * - * @param boolean $detectLanguage Indicates 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. - */ - public function detectLanguage($detectLanguage): Record { - $this->detectLanguage = $detectLanguage; - return $this; - } - - /** - * Sets the transcribe attribute for Record - * - * @param boolean $transcribe True to submit the recording for transcription, false otherwise - */ - public function transcribe(bool $transcribe): Record { - $this->transcribe = $transcribe; - return $this; - } - - /** - * Sets the transcriptionAvailableUrl for Record - * - * @param string $transcriptionAvailableUrl URL to send transcription available events to - */ - public function transcriptionAvailableUrl(string $transcriptionAvailableUrl): Record { - $this->transcriptionAvailableUrl = $transcriptionAvailableUrl; - return $this; - } - - /** - * Sets the transcriptionAvailableMethod for Record - * - * @param string $transcriptionAvailableMethod HTTP method (GET or POST) to send the transcription available event as - */ - public function transcriptionAvailableMethod(string $transcriptionAvailableMethod): Record { - $this->transcriptionAvailableMethod = $transcriptionAvailableMethod; - return $this; - } - - /** - * Sets the silenceTimeout for Record - * - * @param int $silenceTimeout Number of seconds of silence that ends the recording - */ - public function silenceTimeout(int $silenceTimeout): Record { - $this->silenceTimeout = $silenceTimeout; - return $this; - } - - /** - * Sets the recordCompleteFallbackUrl attribute for Record - * - * @param string $recordCompleteFallbackUrl Fallback URL for record complete events - */ - public function recordCompleteFallbackUrl(string $recordCompleteFallbackUrl): Record { - $this->recordCompleteFallbackUrl = $recordCompleteFallbackUrl; - return $this; - } - - /** - * Sets the recordCompleteFallbackMethod attribute for Record - * - * @param string $recordCompleteFallbackMethod HTTP method for fallback events - */ - public function recordCompleteFallbackMethod(string $recordCompleteFallbackMethod): Record { - $this->recordCompleteFallbackMethod = $recordCompleteFallbackMethod; - return $this; - } - - /** - * Sets the fallbackUsername attribute for Record - * - * @param string $fallbackUsername HTTP basic auth username for fallback events - */ - public function fallbackUsername(string $fallbackUsername): Record { - $this->fallbackUsername = $fallbackUsername; - return $this; - } - - /** - * Sets the fallbackPassword attribute for Record - * - * @param string $fallbackPassword HTTP basic auth password for fallback events - */ - public function fallbackPassword(string $fallbackPassword): Record { - $this->fallbackPassword = $fallbackPassword; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("Record"); - - if(isset($this->tag)) { - $element->setattribute("tag", $this->tag); - } - - if(isset($this->recordCompleteUrl)) { - $element->setattribute("recordCompleteUrl", $this->recordCompleteUrl); - } - - if(isset($this->recordCompleteMethod)) { - $element->setattribute("recordCompleteMethod", $this->recordCompleteMethod); - } - - if(isset($this->recordingAvailableUrl)) { - $element->setattribute("recordingAvailableUrl", $this->recordingAvailableUrl); - } - - if(isset($this->recordingAvailableMethod)) { - $element->setattribute("recordingAvailableMethod", $this->recordingAvailableMethod); - } - - if(isset($this->username)) { - $element->setattribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setattribute("password", $this->password); - } - - if(isset($this->terminatingDigits)) { - $element->setattribute("terminatingDigits", $this->terminatingDigits); - } - - if(isset($this->maxDuration)) { - $element->setattribute("maxDuration", $this->maxDuration); - } - - if(isset($this->fileFormat)) { - $element->setattribute("fileFormat", $this->fileFormat); - } - - if(isset($this->detectLanguage)) { - if ($this->detectLanguage) { - $element->setattribute("detectLanguage", "true"); - } else { - $element->setattribute("detectLanguage", "false"); - } - } - - if(isset($this->transcribe)) { - if ($this->transcribe) { - $element->setattribute("transcribe", "true"); - } else { - $element->setattribute("transcribe", "false"); - } - } - - if(isset($this->transcriptionAvailableUrl)) { - $element->setattribute("transcriptionAvailableUrl", $this->transcriptionAvailableUrl); - } - - if(isset($this->transcriptionAvailableMethod)) { - $element->setattribute("transcriptionAvailableMethod", $this->transcriptionAvailableMethod); - } - - if(isset($this->silenceTimeout)) { - $element->setattribute("silenceTimeout", $this->silenceTimeout); - } - - if(isset($this->recordCompleteFallbackUrl)) { - $element->setattribute("recordCompleteFallbackUrl", $this->recordCompleteFallbackUrl); - } - - if(isset($this->recordCompleteFallbackMethod)) { - $element->setattribute("recordCompleteFallbackMethod", $this->recordCompleteFallbackMethod); - } - - if(isset($this->fallbackUsername)) { - $element->setattribute("fallbackUsername", $this->fallbackUsername); - } - - if(isset($this->fallbackPassword)) { - $element->setattribute("fallbackPassword", $this->fallbackPassword); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/Redirect.php b/src/Voice/Bxml/Redirect.php deleted file mode 100644 index c2215ea..0000000 --- a/src/Voice/Bxml/Redirect.php +++ /dev/null @@ -1,186 +0,0 @@ -username = $username; - return $this; - } - - /** - * Sets the password attribute for Redirect - * - * @param string $password The password for http authentication on the redirect callback url - */ - public function password(string $password): Redirect { - $this->password = $password; - return $this; - } - - /** - * Sets the redirectUrl attribute for Redirect - * - * @param string $redirectUrl The url to receive the redirect callback - */ - public function redirectUrl(string $redirectUrl): Redirect { - $this->redirectUrl = $redirectUrl; - return $this; - } - - /** - * Sets the redirectMethod attribute for Redirect - * - * @param string $redirectMethod The http method to send the redirect callback - */ - public function redirectMethod(string $redirectMethod): Redirect { - $this->redirectMethod = $redirectMethod; - return $this; - } - - /** - * Sets the tag attribute for Redirect - * - * @param string $tag A custom string to be included in callbacks - */ - public function tag(string $tag): Redirect { - $this->tag = $tag; - return $this; - } - - /** - * Sets the redirectFallbackUrl attribute for Redirect - * - * @param string $redirectFallbackUrl Fallback url for redirect events - */ - public function redirectFallbackUrl(string $redirectFallbackUrl): Redirect { - $this->redirectFallbackUrl = $redirectFallbackUrl; - return $this; - } - - /** - * Sets the redirectFallbackMethod attribute for Redirect - * - * @param string $redirectFallbackMethod HTTP method for fallback events - */ - public function redirectFallbackMethod(string $redirectFallbackMethod): Redirect { - $this->redirectFallbackMethod = $redirectFallbackMethod; - return $this; - } - - /** - * Sets the fallbackUsername attribute for Redirect - * - * @param string $fallbackUsername HTTP basic auth username for fallback events - */ - public function fallbackUsername(string $fallbackUsername): Redirect { - $this->fallbackUsername = $fallbackUsername; - return $this; - } - - /** - * Sets the fallbackPassword attribute for Redirect - * - * @param string $fallbackPassword HTTP basic auth password for fallback events - */ - public function fallbackPassword(string $fallbackPassword): Redirect { - $this->fallbackPassword = $fallbackPassword; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("Redirect"); - - if(isset($this->username)) { - $element->setAttribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setAttribute("password", $this->password); - } - - if(isset($this->tag)) { - $element->setAttribute("tag", $this->tag); - } - - if(isset($this->redirectUrl)) { - $element->setAttribute("redirectUrl", $this->redirectUrl); - } - - if(isset($this->redirectMethod)) { - $element->setAttribute("redirectMethod", $this->redirectMethod); - } - - if(isset($this->redirectFallbackUrl)) { - $element->setAttribute("redirectFallbackUrl", $this->redirectFallbackUrl); - } - - if(isset($this->redirectFallbackMethod)) { - $element->setAttribute("redirectFallbackMethod", $this->redirectFallbackMethod); - } - - if(isset($this->fallbackUsername)) { - $element->setAttribute("fallbackUsername", $this->fallbackUsername); - } - - if(isset($this->fallbackPassword)) { - $element->setAttribute("fallbackPassword", $this->fallbackPassword); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/Response.php b/src/Voice/Bxml/Response.php deleted file mode 100644 index ffc80f1..0000000 --- a/src/Voice/Bxml/Response.php +++ /dev/null @@ -1,59 +0,0 @@ -verbs = array(); - } - - /** - * Adds the verb to the verbs - * - * @param Verb $verb The verb to add to the list - */ - public function addVerb(Verb $verb): Response { - array_push($this->verbs, $verb); - return $this; - } - - /** - * Converts the Response class into its BXML representation - * - * @return string The xml representation of the class - */ - public function toBxml(): string { - $ssmlRegex = '/<([a-zA-Z\/\/].*?)>/'; - $doc = new DOMDocument('1.0', 'UTF-8'); - $responseElement = $doc->createElement("Response"); - - foreach ($this->verbs as $verb) { - $responseElement->appendChild($verb->toBxml($doc)); - } - - $doc->appendChild($responseElement); - return str_replace("\n", '', preg_replace($ssmlRegex, "<$1>", $doc->saveXML())); - } - - public function __toString(): string - { - return $this->toBxml(); - } -} diff --git a/src/Voice/Bxml/ResumeRecording.php b/src/Voice/Bxml/ResumeRecording.php deleted file mode 100644 index d414cf8..0000000 --- a/src/Voice/Bxml/ResumeRecording.php +++ /dev/null @@ -1,23 +0,0 @@ -createElement("ResumeRecording"); - return $element; - } -} diff --git a/src/Voice/Bxml/Ring.php b/src/Voice/Bxml/Ring.php deleted file mode 100644 index a5cacfa..0000000 --- a/src/Voice/Bxml/Ring.php +++ /dev/null @@ -1,64 +0,0 @@ -duration = $duration; - return $this; - } - - /** - * Sets the answerCall attribute for Ring - * - * @param boolean $answerCall Determines whether or not to answer the call when Ring is executed on an unanswered incoming call - */ - public function answerCall(bool $answerCall): Ring { - $this->answerCall = $answerCall; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("Ring"); - - if(isset($this->duration)) { - $element->setAttribute("duration", $this->duration); - } - - if(isset($this->answerCall)) { - if ($this->answerCall) { - $element->setattribute("answerCall", "true"); - } else { - $element->setattribute("answerCall", "false"); - } - } - - return $element; - } -} diff --git a/src/Voice/Bxml/SendDtmf.php b/src/Voice/Bxml/SendDtmf.php deleted file mode 100644 index f07fddb..0000000 --- a/src/Voice/Bxml/SendDtmf.php +++ /dev/null @@ -1,75 +0,0 @@ -digits = $digits; - } - - /** - * Sets the toneDuration attribute for SendDtmf - * - * @param double $toneDuration The length in milliseconds of each DTMF tone - */ - public function toneDuration(float $toneDuration): SendDtmf { - $this->toneDuration = $toneDuration; - return $this; - } - - /** - * Sets the toneInterval attribute for SendDtmf - * - * @param double $toneInterval The duration of silence in milliseconds following each DTMF tone - */ - public function toneInterval(float $toneInterval): SendDtmf { - $this->toneInterval = $toneInterval; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("SendDtmf"); - - $element->appendChild($doc->createTextNode($this->digits)); - - if(isset($this->toneDuration)) { - $element->setattribute("toneDuration", $this->toneDuration); - } - - if(isset($this->toneInterval)) { - $element->setattribute("toneInterval", $this->toneInterval); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/SipUri.php b/src/Voice/Bxml/SipUri.php deleted file mode 100644 index 743f512..0000000 --- a/src/Voice/Bxml/SipUri.php +++ /dev/null @@ -1,255 +0,0 @@ -sip = $sip; - } - - /** - * Sets the username attribute for SipUri - * - * @param string $username The username for http authentication on the audio url - */ - public function username(string $username): SipUri { - $this->username = $username; - return $this; - } - - /** - * Sets the password attribute for SipUri - * - * @param string $password The password for http authentication on the audio url - */ - public function password(string $password): SipUri { - $this->password = $password; - return $this; - } - - /** - * Sets the transferAnswerUrl attribute for SipUri - * - * @param string $transferAnswerUrl The url to receive the transfer answered callback - */ - public function transferAnswerUrl(string $transferAnswerUrl): SipUri { - $this->transferAnswerUrl = $transferAnswerUrl; - return $this; - } - - /** - * Sets the transferAnswerMethod attribute for SipUri - * - * @param string $transferAnswerMethod The http method to send the transfer answered callback - */ - public function transferAnswerMethod(string $transferAnswerMethod): SipUri { - $this->transferAnswerMethod = $transferAnswerMethod; - return $this; - } - - /** - * Sets the transferDisconnectUrl attribute for SipUri - * - * @param string $transferDisconnectUrl The url to receive the transfer disconnect callback - */ - public function transferDisconnectUrl(string $transferDisconnectUrl): SipUri { - $this->transferDisconnectUrl = $transferDisconnectUrl; - return $this; - } - - /** - * Sets the transferDisconnectMethod attribute for SipUri - * - * @param string $transferDisconnectMethod The http method to send the transfer disconnect callback - */ - public function transferDisconnectMethod(string $transferDisconnectMethod): SipUri { - $this->transferDisconnectMethod = $transferDisconnectMethod; - return $this; - } - - /** - * Sets the tag attribute for SipUri - * - * @param string $tag A custom string to be included in callbacks - */ - public function tag(string $tag): SipUri { - $this->tag = $tag; - return $this; - } - - /** - * Sets the uui attribute for SipUri - * - * @param string $uui The value of the `User-To-User` header to send within the initial `INVITE` - */ - public function uui(string $uui): SipUri { - $this->uui = $uui; - return $this; - } - - /** - * Sets the transferAnswerFallbackUrl attribute for SipUri - * - * @param string $transferAnswerFallbackUrl Fallback URL for transfer answer events - */ - public function transferAnswerFallbackUrl(string $transferAnswerFallbackUrl): SipUri { - $this->transferAnswerFallbackUrl = $transferAnswerFallbackUrl; - return $this; - } - - /** - * Sets the transferAnswerFallbackMethod attribute for SipUri - * - * @param string $transferAnswerFallbackMethod HTTP method for fallback events - */ - public function transferAnswerFallbackMethod(string $transferAnswerFallbackMethod): SipUri { - $this->transferAnswerFallbackMethod = $transferAnswerFallbackMethod; - return $this; - } - - /** - * Sets the fallbackUsername attribute for SipUri - * - * @param string $fallbackUsername HTTP basic auth username for fallback events - */ - public function fallbackUsername(string $fallbackUsername): SipUri { - $this->fallbackUsername = $fallbackUsername; - return $this; - } - - /** - * Sets the fallbackPassword attribute for SipUri - * - * @param string $fallbackPassword HTTP basic auth password for fallback events - */ - public function fallbackPassword(string $fallbackPassword): SipUri { - $this->fallbackPassword = $fallbackPassword; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("SipUri"); - - $element->appendChild($doc->createTextNode($this->sip)); - - if(isset($this->username)) { - $element->setAttribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setAttribute("password", $this->password); - } - - if(isset($this->tag)) { - $element->setAttribute("tag", $this->tag); - } - - if(isset($this->uui)) { - $element->setAttribute("uui", $this->uui); - } - - if(isset($this->transferAnswerUrl)) { - $element->setAttribute("transferAnswerUrl", $this->transferAnswerUrl); - } - - if(isset($this->transferAnswerMethod)) { - $element->setAttribute("transferAnswerMethod", $this->transferAnswerMethod); - } - - if(isset($this->transferDisconnectUrl)) { - $element->setAttribute("transferDisconnectUrl", $this->transferDisconnectUrl); - } - - if(isset($this->transferDisconnectMethod)) { - $element->setAttribute("transferDisconnectMethod", $this->transferDisconnectMethod); - } - - if(isset($this->transferAnswerFallbackUrl)) { - $element->setAttribute("transferAnswerFallbackUrl", $this->transferAnswerFallbackUrl); - } - - if(isset($this->transferAnswerFallbackMethod)) { - $element->setAttribute("transferAnswerFallbackMethod", $this->transferAnswerFallbackMethod); - } - - if(isset($this->fallbackUsername)) { - $element->setAttribute("fallbackUsername", $this->fallbackUsername); - } - - if(isset($this->fallbackPassword)) { - $element->setAttribute("fallbackPassword", $this->fallbackPassword); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/SpeakSentence.php b/src/Voice/Bxml/SpeakSentence.php deleted file mode 100644 index e6f3d68..0000000 --- a/src/Voice/Bxml/SpeakSentence.php +++ /dev/null @@ -1,93 +0,0 @@ -sentence = $sentence; - } - - /** - * Sets the voice attribute for SpeakSentence - * - * @param string $voice The voice to speak in the call - */ - public function voice(string $voice): SpeakSentence { - $this->voice = $voice; - return $this; - } - - /** - * Sets the locale attribute for SpeakSentence - * - * @param string $locale The locale of the voice in the call - */ - public function locale(string $locale): SpeakSentence { - $this->locale = $locale; - return $this; - } - - /** - * Sets the gender attribute for SpeakSentence - * - * @param string $gender The gender of the voice in the call - */ - public function gender(string $gender): SpeakSentence { - $this->gender = $gender; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("SpeakSentence"); - - $element->appendChild($doc->createTextNode($this->sentence)); - - if(isset($this->locale)) { - $element->setAttribute("locale", $this->locale); - } - - if(isset($this->gender)) { - $element->setAttribute("gender", $this->gender); - } - - if(isset($this->voice)) { - $element->setAttribute("voice", $this->voice); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/StartGather.php b/src/Voice/Bxml/StartGather.php deleted file mode 100644 index 3c684d3..0000000 --- a/src/Voice/Bxml/StartGather.php +++ /dev/null @@ -1,116 +0,0 @@ -username = $username; - return $this; - } - - /** - * Sets the password attribute for StartGather - * - * @param string $password The password for http authentication for the gather callback - */ - public function password(string $password): StartGather { - $this->password = $password; - return $this; - } - - /** - * Sets the dtmfUrl attribute for StartGather - * - * @param string $dtmfUrl The url to receive the dtmf callback - */ - public function dtmfUrl(string $dtmfUrl): StartGather { - $this->dtmfUrl = $dtmfUrl; - return $this; - } - - /** - * Sets the dtmfMethod attribute for StartGather - * - * @param string $dtmfMethod The http method to send the dtmf callback - */ - public function dtmfMethod(string $dtmfMethod): StartGather { - $this->dtmfMethod = $dtmfMethod; - return $this; - } - - /** - * Sets the tag attribute for StartGather - * - * @param string $tag A custom string to be included in callbacks - */ - public function tag(string $tag): StartGather { - $this->tag = $tag; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("StartGather"); - - if(isset($this->username)) { - $element->setAttribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setAttribute("password", $this->password); - } - - if(isset($this->tag)) { - $element->setAttribute("tag", $this->tag); - } - - if(isset($this->dtmfUrl)) { - $element->setAttribute("dtmfUrl", $this->dtmfUrl); - } - - if(isset($this->dtmfMethod)) { - $element->setAttribute("dtmfMethod", $this->dtmfMethod); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/StartRecording.php b/src/Voice/Bxml/StartRecording.php deleted file mode 100644 index 627689d..0000000 --- a/src/Voice/Bxml/StartRecording.php +++ /dev/null @@ -1,236 +0,0 @@ -tag = $tag; - return $this; - } - - /** - * Sets the recordingAvailableUrl attribute for StartRecording - * - * @param string $recordingAvailableUrl URL to send the record available callback to - */ - public function recordingAvailableUrl(string $recordingAvailableUrl): StartRecording { - $this->recordingAvailableUrl = $recordingAvailableUrl; - return $this; - } - - /** - * Sets the recordingAvailableMethod attribute for StartRecording - * - * @param string $recordingAvailableMethod HTTP method to send record available - * as ("GET" or "POST") - */ - public function recordingAvailableMethod(string $recordingAvailableMethod): StartRecording { - $this->recordingAvailableMethod = $recordingAvailableMethod; - return $this; - } - - /** - * Sets the username attribute for StartRecording - * - * @param string $username Username for basic auth for callbacks - */ - public function username(string $username): StartRecording { - $this->username = $username; - return $this; - } - - /** - * Sets the password attribute for StartRecording - * - * @param string $password Password for basic auth for callbacks - */ - public function password(string $password): StartRecording { - $this->password = $password; - return $this; - } - - /** - * Sets the fileFormat attribute for StartRecording - * - * @param string $fileFormat Audio format of the recording ("mp3" or "wav") - */ - public function fileFormat(string $fileFormat): StartRecording { - $this->fileFormat = $fileFormat; - return $this; - } - - /** - * Sets the detectLanguage attribute for Record - * - * @param boolean $detectLanguage Indicates 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. - */ - public function detectLanguage($detectLanguage): StartRecording { - $this->detectLanguage = $detectLanguage; - return $this; - } - - - /** - * Sets the multiChannel attribute for StartRecording - * - * @param bool $multiChannel True to record the audio as 2 channels, false otherwise - */ - public function multiChannel(bool $multiChannel): StartRecording { - $this->multiChannel = $multiChannel; - return $this; - } - - /** - * Sets the transcribe attribute for StartRecording - * - * @param boolean $transcribe True to submit the recording for transcription, false otherwise - */ - public function transcribe(bool $transcribe): StartRecording { - $this->transcribe = $transcribe; - return $this; - } - - /** - * Sets the transcriptionAvailableUrl for StartRecording - * - * @param string $transcriptionAvailableUrl URL to send transcription available events to - */ - public function transcriptionAvailableUrl(string $transcriptionAvailableUrl): StartRecording { - $this->transcriptionAvailableUrl = $transcriptionAvailableUrl; - return $this; - } - - /** - * Sets the transcriptionAvailableMethod for StartRecording - * - * @param string $transcriptionAvailableMethod HTTP method (GET or POST) to send the transcription available event as - */ - public function transcriptionAvailableMethod(string $transcriptionAvailableMethod): StartRecording { - $this->transcriptionAvailableMethod = $transcriptionAvailableMethod; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("StartRecording"); - - if(isset($this->tag)) { - $element->setattribute("tag", $this->tag); - } - - if(isset($this->recordingAvailableUrl)) { - $element->setattribute("recordingAvailableUrl", $this->recordingAvailableUrl); - } - - if(isset($this->recordingAvailableMethod)) { - $element->setattribute("recordingAvailableMethod", $this->recordingAvailableMethod); - } - - if(isset($this->username)) { - $element->setattribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setattribute("password", $this->password); - } - - if(isset($this->fileFormat)) { - $element->setattribute("fileFormat", $this->fileFormat); - } - - if(isset($this->detectLanguage)) { - if ($this->detectLanguage) { - $element->setattribute("detectLanguage", "true"); - } else { - $element->setattribute("detectLanguage", "false"); - } - } - - if(isset($this->multiChannel)) { - if ($this->multiChannel) { - $element->setattribute("multiChannel", "true"); - } else { - $element->setattribute("multiChannel", "false"); - } - } - - if(isset($this->transcribe)) { - if ($this->transcribe) { - $element->setattribute("transcribe", "true"); - } else { - $element->setattribute("transcribe", "false"); - } - } - - if(isset($this->transcriptionAvailableUrl)) { - $element->setattribute("transcriptionAvailableUrl", $this->transcriptionAvailableUrl); - } - - if(isset($this->transcriptionAvailableMethod)) { - $element->setattribute("transcriptionAvailableMethod", $this->transcriptionAvailableMethod); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/StartStream.php b/src/Voice/Bxml/StartStream.php deleted file mode 100644 index 0d7b1b4..0000000 --- a/src/Voice/Bxml/StartStream.php +++ /dev/null @@ -1,168 +0,0 @@ -destination = $destination; - return $this; - } - - /** - * Sets the name attribute for StartStream - * - * @param string $name 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 - */ - public function name(string $name): StartStream { - $this->name = $name; - return $this; - } - - /** - * Sets the tracks attribute for StartStream - * - * @param string $tracks The part of the call to send a stream from. `inbound`, `outbound` or `both`. Default is `inbound`. - * - */ - public function tracks(string $tracks): StartStream { - $this->tracks = $tracks; - return $this; - } - - /** - * Sets the username attribute for StartStream - * - * @param string $username The username to send in the HTTP request to `streamEventUrl`. If specified, the URLs must be TLS-encrypted (i.e., `https`). - */ - public function username(string $username): StartStream { - $this->username = $username; - return $this; - } - - /** - * Sets the password attribute for StartStream - * - * @param string $password The password to send in the HTTP request to `streamEventUrl`. If specified, the URLs must be TLS-encrypted (i.e., `https`). - */ - public function password(string $password): StartStream { - $this->password = $password; - return $this; - } - - /** - * Sets the streamEventUrl attribute for StartStream - * - * @param string $streamEventUrl URL to send the associated Webhook events to during this stream's lifetime. Does not accept BXML. May be a relative URL. - */ - public function streamEventUrl(string $streamEventUrl): StartStream { - $this->streamEventUrl = $streamEventUrl; - return $this; - } - - /** - * Sets the streamEventMethod attribute for StartStream - * - * @param bool $streamEventMethod The HTTP method to use for the request to `streamEventUrl`. GET or POST. Default value is POST. - */ - public function streamEventMethod(string $streamEventMethod): StartStream { - $this->streamEventMethod = $streamEventMethod; - return $this; - } - - /** - * Sets the tag. 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. - * - * @param list $streamParams The list of StreamParam tags - */ - public function streamParams($streamParams): StartStream { - $this->streamParams = $streamParams; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("StartStream"); - - if(isset($this->destination)) { - $element->setattribute("destination", $this->destination); - } - - if(isset($this->name)) { - $element->setattribute("name", $this->name); - } - - if(isset($this->tracks)) { - $element->setattribute("tracks", $this->tracks); - } - - if(isset($this->username)) { - $element->setattribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setattribute("password", $this->password); - } - - if(isset($this->streamEventUrl)) { - $element->setattribute("streamEventUrl", $this->streamEventUrl); - } - - if(isset($this->streamEventMethod)) { - $element->setattribute("streamEventMethod", $this->streamEventMethod); - } - - if(isset($this->streamParams)) { - foreach ($this->streamParams as $streamParam) { - $element->appendChild($streamParam->toBxml($doc)); - } - } - - return $element; - } -} diff --git a/src/Voice/Bxml/StartTranscription.php b/src/Voice/Bxml/StartTranscription.php deleted file mode 100644 index 6820ce2..0000000 --- a/src/Voice/Bxml/StartTranscription.php +++ /dev/null @@ -1,206 +0,0 @@ -destination = $destination; - return $this; - } - - /** - * Sets the name attribute for StartTranscription - * - * @param string $name 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. - */ - public function name(string $name): StartTranscription { - $this->name = $name; - return $this; - } - - /** - * Sets the tracks attribute for StartTranscription - * - * @param string $tracks The part of the call to send a real-time transcription from. `inbound`, `outbound` or `both`. Default is `inbound`. - * - */ - public function tracks(string $tracks): StartTranscription { - $this->tracks = $tracks; - return $this; - } - - /** - * Sets the username attribute for StartTranscription - * - * @param string $username The username to send in the HTTP request to `transcriptionEventUrl`. If specified, the URLs must be TLS-encrypted (i.e., `https`). - */ - public function username(string $username): StartTranscription { - $this->username = $username; - return $this; - } - - /** - * Sets the password attribute for StartTranscription - * - * @param string $password The password to send in the HTTP request to `transcriptionEventUrl`. If specified, the URLs must be TLS-encrypted (i.e., `https`). - */ - public function password(string $password): StartTranscription { - $this->password = $password; - return $this; - } - - /** - * Sets the transcriptionEventUrl attribute for StartTranscription - * - * @param string $transcriptionEventUrl URL to send the associated Webhook events to during this stream's lifetime. Does not accept BXML. May be a relative URL. - */ - public function transcriptionEventUrl(string $transcriptionEventUrl): StartTranscription { - $this->transcriptionEventUrl = $transcriptionEventUrl; - return $this; - } - - /** - * Sets the transcriptionEventMethod attribute for StartTranscription - * - * @param bool $transcriptionEventMethod The HTTP method to use for the request to `transcriptionEventUrl`. GET or POST. Default value is POST. - */ - public function transcriptionEventMethod(string $transcriptionEventMethod): StartTranscription { - $this->transcriptionEventMethod = $transcriptionEventMethod; - return $this; - } - - /** - * Sets the stability attribute for StartTranscription - * - * @param bool Whether to send transcription update events to the specified destination only after they have become stable. Requires destination. Defaults to true. - * - */ - public function stability( bool $stability): StartTranscription { - $this->stability = $stability; - return $this; - } - - /** - * Sets the stabilized attribute for StartTranscription - * - * @param bool Whether to send transcription update events to the specified destination only after they have become stable. Requires destination. Defaults to true. - * - */ - public function stabilized( bool $stabilized): StartTranscription { - $this->stabilized = $stabilized; - return $this; - } - - /** - * Sets the tag. 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. - * - * @param list $customParams The list of CustomParam tags - */ - public function customParams($customParams): StartTranscription { - $this->customParams = $customParams; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("StartTranscription"); - - if(isset($this->destination)) { - $element->setattribute("destination", $this->destination); - } - - if(isset($this->name)) { - $element->setattribute("name", $this->name); - } - - if(isset($this->tracks)) { - $element->setattribute("tracks", $this->tracks); - } - - if(isset($this->username)) { - $element->setattribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setattribute("password", $this->password); - } - - if(isset($this->transcriptionEventUrl)) { - $element->setattribute("transcriptionEventUrl", $this->transcriptionEventUrl); - } - - if(isset($this->transcriptionEventMethod)) { - $element->setattribute("transcriptionEventMethod", $this->transcriptionEventMethod); - } - - if(isset($this->stability)) { - $element->setattribute("stablilty", $this->stability); - } - - if(isset($this->stabilized)) { - $element->setattribute("stabilized", $this->stabilized); - } - - if(isset($this->customParams)) { - foreach ($this->customParams as $customParam) { - $element->appendChild($customParam->toBxml($doc)); - } - } - - return $element; - } -} diff --git a/src/Voice/Bxml/StopGather.php b/src/Voice/Bxml/StopGather.php deleted file mode 100644 index bada923..0000000 --- a/src/Voice/Bxml/StopGather.php +++ /dev/null @@ -1,23 +0,0 @@ -createElement("StopGather"); - return $element; - } -} diff --git a/src/Voice/Bxml/StopRecording.php b/src/Voice/Bxml/StopRecording.php deleted file mode 100644 index 511190f..0000000 --- a/src/Voice/Bxml/StopRecording.php +++ /dev/null @@ -1,23 +0,0 @@ -createElement("StopRecording"); - return $element; - } -} diff --git a/src/Voice/Bxml/StopStream.php b/src/Voice/Bxml/StopStream.php deleted file mode 100644 index 3e195f5..0000000 --- a/src/Voice/Bxml/StopStream.php +++ /dev/null @@ -1,42 +0,0 @@ -`][1] verb, or the system generated name returned in the [Media Stream Started][2] webhook if `` was sent with no `name` attribute. - */ - public function name(string $name): StopStream { - $this->name = $name; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("StopStream"); - - if(isset($this->name)) { - $element->setAttribute("name", $this->name); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/StopTranscription.php b/src/Voice/Bxml/StopTranscription.php deleted file mode 100644 index 5392c8b..0000000 --- a/src/Voice/Bxml/StopTranscription.php +++ /dev/null @@ -1,42 +0,0 @@ -`][1] verb, or the system generated name returned in the [Media Transcription Started][2] webhook if `` was sent with no `name` attribute. - */ - public function name(string $name): StopTranscription { - $this->name = $name; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("StopTranscription"); - - if(isset($this->name)) { - $element->setAttribute("name", $this->name); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/StreamParam.php b/src/Voice/Bxml/StreamParam.php deleted file mode 100644 index 41d6814..0000000 --- a/src/Voice/Bxml/StreamParam.php +++ /dev/null @@ -1,60 +0,0 @@ - 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. - * - * * @copyright Bandwidth INC - */ - -namespace BandwidthLib\Voice\Bxml; - -use DOMDocument; -use DOMElement; - -require_once "Verb.php"; - -class StreamParam extends Verb { - /** - * @var string - */ - private $value; - /** - * @var string - */ - private $name; - - /** - * Sets the name attribute for StreamParam - * - * @param string $name (required) The name of this parameter, up to 256 characters. - */ - public function name(string $name): StreamParam { - $this->name = $name; - return $this; - } - - /** - * Sets the value attribute for StreamParam - * - * @param string $value (required) The value of this parameter, up to 2048 characters. - */ - public function value(string $value): StreamParam { - $this->value = $value; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("StreamParam"); - - if(isset($this->name)) { - $element->setAttribute("name", $this->name); - } - - if(isset($this->value)) { - $element->setAttribute("value", $this->value); - } - - return $element; - } -} diff --git a/src/Voice/Bxml/Tag.php b/src/Voice/Bxml/Tag.php deleted file mode 100644 index 88ddfa3..0000000 --- a/src/Voice/Bxml/Tag.php +++ /dev/null @@ -1,39 +0,0 @@ -tag = $tag; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("Tag"); - - $element->appendChild($doc->createTextNode($this->tag)); - - return $element; - } -} diff --git a/src/Voice/Bxml/Transfer.php b/src/Voice/Bxml/Transfer.php deleted file mode 100644 index 45cdaad..0000000 --- a/src/Voice/Bxml/Transfer.php +++ /dev/null @@ -1,308 +0,0 @@ -username = $username; - return $this; - } - - /** - * Sets the password attribute for Transfer - * - * @param string $password The password for http authentication on the transfer answered callback url - */ - public function password(string $password): Transfer { - $this->password = $password; - return $this; - } - - /** - * Sets the transferCompleteUrl attribute for Transfer - * - * @param string $transferCompleteUrl The url to receive the transfer answered callback - */ - public function transferCompleteUrl(string $transferCompleteUrl): Transfer { - $this->transferCompleteUrl = $transferCompleteUrl; - return $this; - } - - /** - * Sets the transferCompleteMethod attribute for Transfer - * - * @param string $transferCompleteMethod The http method to send the transfer answered callback - */ - public function transferCompleteMethod(string $transferCompleteMethod): Transfer { - $this->transferCompleteMethod = $transferCompleteMethod; - return $this; - } - - /** - * Sets the transferCallerId attribute for Transfer - * - * @param string $transferCallerId The caller id to use when the call is transferred - */ - public function transferCallerId(string $transferCallerId): Transfer { - $this->transferCallerId = $transferCallerId; - return $this; - } - - /** - * Sets the transferCallerDisplayName attribute for Transfer - */ - public function transferCallerDisplayName(string $transferCallerDisplayName): Transfer { - $this->transferCallerDisplayName = $transferCallerDisplayName; - return $this; - } - - /** - * Sets the callTimeout attribute for Transfer - * - * @param int $callTimeout The number of seconds to wait before timing out the call - */ - public function callTimeout(int $callTimeout): Transfer { - $this->callTimeout = $callTimeout; - return $this; - } - - /** - * Sets the tag attribute for Transfer - * - * @param string $tag A custom string to be included in callbacks - */ - public function tag(string $tag): Transfer { - $this->tag = $tag; - return $this; - } - - /** - * Sets the diversionTreatment attribute for Transfer - * - * @param string $diversionTreatment The diversion treatment for the phone call - */ - public function diversionTreatment(string $diversionTreatment): Transfer { - $this->diversionTreatment = $diversionTreatment; - return $this; - } - - /** - * Sets the diversionReason attribute for Transfer - * - * @param string $diversionReason The diversion treatment for the phone call - */ - public function diversionReason(string $diversionReason): Transfer { - $this->diversionReason = $diversionReason; - return $this; - } - - /** - * Sets the PhoneNumber tags to be included in the Transfer - * - * @param list $phoneNumbers The list of PhoneNumber tags - */ - public function phoneNumbers($phoneNumbers): Transfer { - $this->phoneNumbers = $phoneNumbers; - return $this; - } - - /** - * Sets the SipUri tags to be included in the Transfer - * - * @param list $sipUris The list of SipUri tags - */ - public function sipUris($sipUris): Transfer { - $this->sipUris = $sipUris; - return $this; - } - - /** - * Sets the transferCompleteFallbackUrl attribute for Transfer - * - * @param string $transferCompleteFallbackUrl Fallback url for transfer complete events - */ - public function transferCompleteFallbackUrl(string $transferCompleteFallbackUrl): Transfer { - $this->transferCompleteFallbackUrl = $transferCompleteFallbackUrl; - return $this; - } - - /** - * Sets the transferCompleteFallbackMethod attribute for Transfer - * - * @param string $transferCompleteFallbackMethod HTTP method for fallback events - */ - public function transferCompleteFallbackMethod(string $transferCompleteFallbackMethod): Transfer { - $this->transferCompleteFallbackMethod = $transferCompleteFallbackMethod; - return $this; - } - - /** - * Sets the fallbackUsername attribute for Transfer - * - * @param string $fallbackUsername HTTP basic auth username for fallback events - */ - public function fallbackUsername(string $fallbackUsername): Transfer { - $this->fallbackUsername = $fallbackUsername; - return $this; - } - - /** - * Sets the fallbackPassword attribute for Transfer - * - * @param string $fallbackPassword HTTP basic auth password for fallback events - */ - public function fallbackPassword(string $fallbackPassword): Transfer { - $this->fallbackPassword = $fallbackPassword; - return $this; - } - - public function toBxml(DOMDocument $doc): DOMElement { - $element = $doc->createElement("Transfer"); - - if(isset($this->username)) { - $element->setAttribute("username", $this->username); - } - - if(isset($this->password)) { - $element->setAttribute("password", $this->password); - } - - if(isset($this->tag)) { - $element->setAttribute("tag", $this->tag); - } - - if(isset($this->transferCompleteUrl)) { - $element->setAttribute("transferCompleteUrl", $this->transferCompleteUrl); - } - - if(isset($this->transferCompleteMethod)) { - $element->setAttribute("transferCompleteMethod", $this->transferCompleteMethod); - } - - if(isset($this->transferCallerId)) { - $element->setAttribute("transferCallerId", $this->transferCallerId); - } - - if(isset($this->transferCallerDisplayName)) { - $element->setAttribute("transferCallerDisplayName", $this->transferCallerDisplayName); - } - - if(isset($this->callTimeout)) { - $element->setAttribute("callTimeout", $this->callTimeout); - } - - if(isset($this->diversionTreatment)) { - $element->setAttribute("diversionTreatment", $this->diversionTreatment); - } - - if(isset($this->diversionReason)) { - $element->setAttribute("diversionReason", $this->diversionReason); - } - - if(isset($this->transferCompleteFallbackUrl)) { - $element->setAttribute("transferCompleteFallbackUrl", $this->transferCompleteFallbackUrl); - } - - if(isset($this->transferCompleteFallbackMethod)) { - $element->setAttribute("transferCompleteFallbackMethod", $this->transferCompleteFallbackMethod); - } - - if(isset($this->fallbackUsername)) { - $element->setAttribute("fallbackUsername", $this->fallbackUsername); - } - - if(isset($this->fallbackPassword)) { - $element->setAttribute("fallbackPassword", $this->fallbackPassword); - } - - if(isset($this->phoneNumbers)) { - foreach ($this->phoneNumbers as $phoneNumber) { - $element->appendChild($phoneNumber->toBxml($doc)); - } - } - - if(isset($this->sipUris)) { - foreach ($this->sipUris as $sipUri) { - $element->appendChild($sipUri->toBxml($doc)); - } - } - - return $element; - } -} diff --git a/src/Voice/Bxml/Verb.php b/src/Voice/Bxml/Verb.php deleted file mode 100644 index 2d058b2..0000000 --- a/src/Voice/Bxml/Verb.php +++ /dev/null @@ -1,28 +0,0 @@ - $accountId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass($response->body, 'BandwidthLib\\Voice\\Models\\CreateCallResponse'); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Returns near-realtime metadata about the specified call. - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getCall( - string $accountId, - string $callId - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/calls/{callId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass($response->body, 'BandwidthLib\\Voice\\Models\\CallState'); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - -/** - * Replaces the bxml for an active call - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param string $body Valid BXML string - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function modifyCallBxml( - string $accountId, - string $callId, - string $body - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/calls/{callId}/bxml'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'content-type' => 'application/xml; charset=utf-8' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $body); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type for this endpoint. If a request body is required, please send it to us as ' . - '`application/xml`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Interrupts and replaces an active call's BXML document. - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param Models\ModifyCallRequest $body TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function modifyCall( - string $accountId, - string $callId, - Models\ModifyCallRequest $body - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/calls/{callId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Pauses or resumes a recording. - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param Models\ModifyCallRecordingRequest $body TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function modifyCallRecordingState( - string $accountId, - string $callId, - Models\ModifyCallRecordingRequest $body - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/calls/{callId}/recording'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Returns a (potentially empty) list of metadata for the recordings that took place during the - * specified call. - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getCallRecordings( - string $accountId, - string $callId - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/calls/{callId}/recordings'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClassArray( - $response->body, - 'BandwidthLib\\Voice\\Models\\CallRecordingMetadata' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Returns metadata for the specified recording. - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param string $recordingId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getCallRecording( - string $accountId, - string $callId, - string $recordingId - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - 'recordingId' => $recordingId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\Voice\\Models\\CallRecordingMetadata' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Deletes the specified recording. - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param string $recordingId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function deleteRecording( - string $accountId, - string $callId, - string $recordingId - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - 'recordingId' => $recordingId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Downloads the specified recording. - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param string $recordingId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getDownloadCallRecording( - string $accountId, - string $callId, - string $recordingId - ) { - - //prepare query string for API call - $_queryBuilder = - '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - 'recordingId' => $recordingId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $deserializedResponse = $response->body; - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Deletes the specified recording's media. - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param string $recordingId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function deleteRecordingMedia( - string $accountId, - string $callId, - string $recordingId - ) { - - //prepare query string for API call - $_queryBuilder = - '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - 'recordingId' => $recordingId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Downloads the specified transcription. - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param string $recordingId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getCallTranscription( - string $accountId, - string $callId, - string $recordingId - ) { - - //prepare query string for API call - $_queryBuilder = - '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - 'recordingId' => $recordingId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\Voice\\Models\\TranscriptionResponse' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Requests that the specified recording be transcribed. - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param string $recordingId TODO: type description here - * @param Models\TranscribeRecordingRequest $body TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function createTranscribeCallRecording( - string $accountId, - string $callId, - string $recordingId, - Models\TranscribeRecordingRequest $body - ) { - - //prepare query string for API call - $_queryBuilder = - '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - 'recordingId' => $recordingId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 410) { - throw new Exceptions\ApiErrorException( - 'The media for this recording has been deleted, so we can\'t transcribe it', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Deletes the specified recording's transcription. - * - * @param string $accountId TODO: type description here - * @param string $callId TODO: type description here - * @param string $recordingId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function deleteCallTranscription( - string $accountId, - string $callId, - string $recordingId - ) { - - //prepare query string for API call - $_queryBuilder = - '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'callId' => $callId, - 'recordingId' => $recordingId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Returns information about the conferences in the account. - * - * @param string $accountId TODO: type description here - * @param string|null $name (optional) TODO: type description here - * @param string|null $minCreatedTime (optional) TODO: type description here - * @param string|null $maxCreatedTime (optional) TODO: type description here - * @param integer $pageSize (optional) Example: 1000 - * @param string|null $pageToken (optional) TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getConferences( - string $accountId, - ?string $name = null, - ?string $minCreatedTime = null, - ?string $maxCreatedTime = null, - int $pageSize = 1000, - ?string $pageToken = null - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/conferences'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - )); - - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'name' => $name, - 'minCreatedTime' => $minCreatedTime, - 'maxCreatedTime' => $maxCreatedTime, - 'pageSize' => (null != $pageSize) ? $pageSize : 1000, - 'pageToken' => $pageToken, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClassArray($response->body, 'BandwidthLib\\Voice\\Models\\ConferenceState'); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Returns information about the specified conference. - * - * @param string $accountId TODO: type description here - * @param string $conferenceId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getConference( - string $accountId, - string $conferenceId - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/conferences/{conferenceId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'conferenceId' => $conferenceId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass($response->body, 'BandwidthLib\\Voice\\Models\\ConferenceState'); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Modify the conference state. - * - * @param string $accountId TODO: type description here - * @param string $conferenceId TODO: type description here - * @param Models\ModifyConferenceRequest $body TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function modifyConference( - string $accountId, - string $conferenceId, - Models\ModifyConferenceRequest $body - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/conferences/{conferenceId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'conferenceId' => $conferenceId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Updates settings for a particular conference member. - * - * @param string $accountId TODO: type description here - * @param string $conferenceId TODO: type description here - * @param string $callId TODO: type description here - * @param Models\ConferenceMemberState $body TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function modifyConferenceMember( - string $accountId, - string $conferenceId, - string $callId, - Models\ConferenceMemberState $body - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{callId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'conferenceId' => $conferenceId, - 'callId' => $callId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Returns information about the specified conference member. - * - * @param string $accountId TODO: type description here - * @param string $conferenceId TODO: type description here - * @param string $memberId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getConferenceMember( - string $accountId, - string $conferenceId, - string $memberId - ) { - - //prepare query string for API call - $_queryBuilder = - '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'conferenceId' => $conferenceId, - 'memberId' => $memberId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\Voice\\Models\\ConferenceMemberState' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Returns a (potentially empty) list of metadata for the recordings that took place during the - * specified conference - * - * @param string $accountId TODO: type description here - * @param string $conferenceId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getConferenceRecordings( - string $accountId, - string $conferenceId - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'conferenceId' => $conferenceId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClassArray( - $response->body, - 'BandwidthLib\\Voice\\Models\\ConferenceRecordingMetadata' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Returns metadata for the specified recording. - * - * @param string $accountId TODO: type description here - * @param string $conferenceId TODO: type description here - * @param string $recordingId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getConferenceRecording( - string $accountId, - string $conferenceId, - string $recordingId - ) { - - //prepare query string for API call - $_queryBuilder = - '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'conferenceId' => $conferenceId, - 'recordingId' => $recordingId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\Voice\\Models\\CallRecordingMetadata' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Downloads the specified recording. - * - * @param string $accountId TODO: type description here - * @param string $conferenceId TODO: type description here - * @param string $recordingId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getDownloadConferenceRecording( - string $accountId, - string $conferenceId, - string $recordingId - ) { - - //prepare query string for API call - $_queryBuilder = - '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'conferenceId' => $conferenceId, - 'recordingId' => $recordingId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $deserializedResponse = $response->body; - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * 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 string $accountId TODO: type description here - * @param string|null $from (optional) TODO: type description here - * @param string|null $to (optional) TODO: type description here - * @param string|null $minStartTime (optional) TODO: type description here - * @param string|null $maxStartTime (optional) TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getQueryCallRecordings( - string $accountId, - ?string $from = null, - ?string $to = null, - ?string $minStartTime = null, - ?string $maxStartTime = null - ) { - - //prepare query string for API call - $_queryBuilder = '/api/v2/accounts/{accountId}/recordings'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - )); - - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'from' => $from, - 'to' => $to, - 'minStartTime' => $minStartTime, - 'maxStartTime' => $maxStartTime, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::VOICEDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'voice'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new Exceptions\ApiErrorException( - 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', - $_httpContext - ); - } - - if ($response->code == 401) { - throw new APIException( - 'Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to ' . - 'the API.', - $_httpContext - ); - } - - if ($response->code == 403) { - throw new Exceptions\ApiErrorException('User unauthorized to perform this action.', $_httpContext); - } - - if ($response->code == 404) { - throw new Exceptions\ApiErrorException( - 'The resource specified cannot be found or does not belong to you.', - $_httpContext - ); - } - - if ($response->code == 415) { - throw new Exceptions\ApiErrorException( - 'We don\'t support that media type. If a request body is required, please send it to us as ' . - '`application/json`.', - $_httpContext - ); - } - - if ($response->code == 429) { - throw new Exceptions\ApiErrorException( - 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . - 'try again.', - $_httpContext - ); - } - - if ($response->code == 500) { - throw new Exceptions\ApiErrorException('Something unexpected happened. Please try again.', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClassArray( - $response->body, - 'BandwidthLib\\Voice\\Models\\CallRecordingMetadata' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } -} diff --git a/src/Voice/Exceptions/ApiErrorException.php b/src/Voice/Exceptions/ApiErrorException.php deleted file mode 100644 index a7b0b82..0000000 --- a/src/Voice/Exceptions/ApiErrorException.php +++ /dev/null @@ -1,50 +0,0 @@ -eventType = func_get_arg(0); - $this->eventTime = func_get_arg(1); - $this->accountId = func_get_arg(2); - $this->applicationId = func_get_arg(3); - $this->from = func_get_arg(4); - $this->to = func_get_arg(5); - $this->direction = func_get_arg(6); - $this->callId = func_get_arg(7); - $this->callUrl = func_get_arg(8); - $this->startTime = func_get_arg(9); - $this->answerTime = func_get_arg(10); - $this->transferCallerId = func_get_arg(11); - $this->transferTo = func_get_arg(12); - $this->cause = func_get_arg(13); - $this->errorMessage = func_get_arg(14); - $this->errorId = func_get_arg(15); - $this->endTime = func_get_arg(16); - $this->digit = func_get_arg(17); - $this->parentCallId = func_get_arg(18); - $this->recordingId = func_get_arg(19); - $this->duration = func_get_arg(20); - $this->fileFormat = func_get_arg(21); - $this->mediaUrl = func_get_arg(22); - $this->tag = func_get_arg(23); - $this->channels = func_get_arg(24); - $this->status = func_get_arg(25); - $this->digits = func_get_arg(26); - $this->terminatingDigit = func_get_arg(27); - $this->transcription = func_get_arg(28); - $this->diversion = func_get_arg(29); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['eventType'] = $this->eventType; - $json['eventTime'] = $this->eventTime; - $json['accountId'] = $this->accountId; - $json['applicationId'] = $this->applicationId; - $json['from'] = $this->from; - $json['to'] = $this->to; - $json['direction'] = $this->direction; - $json['callId'] = $this->callId; - $json['callUrl'] = $this->callUrl; - $json['startTime'] = $this->startTime; - $json['answerTime'] = $this->answerTime; - $json['transferCallerId'] = $this->transferCallerId; - $json['transferTo'] = $this->transferTo; - $json['cause'] = $this->cause; - $json['errorMessage'] = $this->errorMessage; - $json['errorId'] = $this->errorId; - $json['endTime'] = $this->endTime; - $json['digit'] = $this->digit; - $json['parentCallId'] = $this->parentCallId; - $json['recordingId'] = $this->recordingId; - $json['duration'] = $this->duration; - $json['fileFormat'] = $this->fileFormat; - $json['mediaUrl'] = $this->mediaUrl; - $json['tag'] = $this->tag; - $json['channels'] = $this->channels; - $json['status'] = $this->status; - $json['digits'] = $this->digits; - $json['terminatingDigit'] = $this->terminatingDigit; - $json['transcription'] = $this->transcription; - $json['diversion'] = $this->diversion; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/CallRecordingMetadata.php b/src/Voice/Models/CallRecordingMetadata.php deleted file mode 100644 index cd65992..0000000 --- a/src/Voice/Models/CallRecordingMetadata.php +++ /dev/null @@ -1,187 +0,0 @@ -applicationId = func_get_arg(0); - $this->accountId = func_get_arg(1); - $this->callId = func_get_arg(2); - $this->parentCallId = func_get_arg(3); - $this->recordingId = func_get_arg(4); - $this->to = func_get_arg(5); - $this->from = func_get_arg(6); - $this->transferCallerId = func_get_arg(7); - $this->transferTo = func_get_arg(8); - $this->duration = func_get_arg(9); - $this->direction = func_get_arg(10); - $this->channels = func_get_arg(11); - $this->startTime = func_get_arg(12); - $this->endTime = func_get_arg(13); - $this->fileFormat = func_get_arg(14); - $this->status = func_get_arg(15); - $this->mediaUrl = func_get_arg(16); - $this->transcription = func_get_arg(17); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['applicationId'] = $this->applicationId; - $json['accountId'] = $this->accountId; - $json['callId'] = $this->callId; - $json['parentCallId'] = $this->parentCallId; - $json['recordingId'] = $this->recordingId; - $json['to'] = $this->to; - $json['from'] = $this->from; - $json['transferCallerId'] = $this->transferCallerId; - $json['transferTo'] = $this->transferTo; - $json['duration'] = $this->duration; - $json['direction'] = $this->direction; - $json['channels'] = $this->channels; - $json['startTime'] = - isset($this->startTime) ? - DateTimeHelper::toRfc3339DateTime($this->startTime) : null; - $json['endTime'] = - isset($this->endTime) ? - DateTimeHelper::toRfc3339DateTime($this->endTime) : null; - $json['fileFormat'] = $this->fileFormat; - $json['status'] = $this->status; - $json['mediaUrl'] = $this->mediaUrl; - $json['transcription'] = $this->transcription; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/CallState.php b/src/Voice/Models/CallState.php deleted file mode 100644 index 6a6540e..0000000 --- a/src/Voice/Models/CallState.php +++ /dev/null @@ -1,199 +0,0 @@ -callId = func_get_arg(0); - $this->parentCallId = func_get_arg(1); - $this->applicationId = func_get_arg(2); - $this->accountId = func_get_arg(3); - $this->to = func_get_arg(4); - $this->from = func_get_arg(5); - $this->direction = func_get_arg(6); - $this->state = func_get_arg(7); - $this->identity = func_get_arg(8); - $this->stirShaken = func_get_arg(9); - $this->startTime = func_get_arg(10); - $this->enqueuedTime = func_get_arg(11); - $this->answerTime = func_get_arg(12); - $this->endTime = func_get_arg(13); - $this->disconnectCause = func_get_arg(14); - $this->errorMessage = func_get_arg(15); - $this->errorId = func_get_arg(16); - $this->lastUpdate = func_get_arg(17); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['callId'] = $this->callId; - $json['parentCallId'] = $this->parentCallId; - $json['applicationId'] = $this->applicationId; - $json['accountId'] = $this->accountId; - $json['to'] = $this->to; - $json['from'] = $this->from; - $json['direction'] = $this->direction; - $json['state'] = $this->state; - $json['identity'] = $this->identity; - $json['stirShaken'] = $this->stirShaken; - $json['startTime'] = - isset($this->startTime) ? - DateTimeHelper::toRfc3339DateTime($this->startTime) : null; - $json['enqueuedTime'] = - isset($this->enqueuedTime) ? - DateTimeHelper::toRfc3339DateTime($this->enqueuedTime) : null; - $json['answerTime'] = - isset($this->answerTime) ? - DateTimeHelper::toRfc3339DateTime($this->answerTime) : null; - $json['endTime'] = - isset($this->endTime) ? - DateTimeHelper::toRfc3339DateTime($this->endTime) : null; - $json['disconnectCause'] = $this->disconnectCause; - $json['errorMessage'] = $this->errorMessage; - $json['errorId'] = $this->errorId; - $json['lastUpdate'] = - isset($this->lastUpdate) ? - DateTimeHelper::toRfc3339DateTime($this->lastUpdate) : null; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/CallbackMethodEnum.php b/src/Voice/Models/CallbackMethodEnum.php deleted file mode 100644 index add9061..0000000 --- a/src/Voice/Models/CallbackMethodEnum.php +++ /dev/null @@ -1,24 +0,0 @@ -conferenceId = func_get_arg(0); - $this->name = func_get_arg(1); - $this->eventType = func_get_arg(2); - $this->eventTime = func_get_arg(3); - $this->tag = func_get_arg(4); - $this->callId = func_get_arg(5); - $this->to = func_get_arg(6); - $this->from = func_get_arg(7); - $this->accountId = func_get_arg(8); - $this->recordingId = func_get_arg(9); - $this->channels = func_get_arg(10); - $this->startTime = func_get_arg(11); - $this->endTime = func_get_arg(12); - $this->duration = func_get_arg(13); - $this->fileFormat = func_get_arg(14); - $this->mediaUrl = func_get_arg(15); - $this->status = func_get_arg(16); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['conferenceId'] = $this->conferenceId; - $json['name'] = $this->name; - $json['eventType'] = $this->eventType; - $json['eventTime'] = $this->eventTime; - $json['tag'] = $this->tag; - $json['callId'] = $this->callId; - $json['to'] = $this->to; - $json['from'] = $this->from; - $json['accountId'] = $this->accountId; - $json['recordingId'] = $this->recordingId; - $json['channels'] = $this->channels; - $json['startTime'] = $this->startTime; - $json['endTime'] = $this->endTime; - $json['duration'] = $this->duration; - $json['fileFormat'] = $this->fileFormat; - $json['mediaUrl'] = $this->mediaUrl; - $json['status'] = $this->status; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/ConferenceEventMethodEnum.php b/src/Voice/Models/ConferenceEventMethodEnum.php deleted file mode 100644 index 9ebfa9e..0000000 --- a/src/Voice/Models/ConferenceEventMethodEnum.php +++ /dev/null @@ -1,24 +0,0 @@ -callId = func_get_arg(0); - $this->conferenceId = func_get_arg(1); - $this->memberUrl = func_get_arg(2); - $this->mute = func_get_arg(3); - $this->hold = func_get_arg(4); - $this->callIdsToCoach = func_get_arg(5); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['callId'] = $this->callId; - $json['conferenceId'] = $this->conferenceId; - $json['memberUrl'] = $this->memberUrl; - $json['mute'] = $this->mute; - $json['hold'] = $this->hold; - $json['callIdsToCoach'] = - isset($this->callIdsToCoach) ? - array_values($this->callIdsToCoach) : null; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/ConferenceRecordingMetadata.php b/src/Voice/Models/ConferenceRecordingMetadata.php deleted file mode 100644 index 7277ab5..0000000 --- a/src/Voice/Models/ConferenceRecordingMetadata.php +++ /dev/null @@ -1,131 +0,0 @@ -accountId = func_get_arg(0); - $this->conferenceId = func_get_arg(1); - $this->name = func_get_arg(2); - $this->recordingId = func_get_arg(3); - $this->duration = func_get_arg(4); - $this->channels = func_get_arg(5); - $this->startTime = func_get_arg(6); - $this->endTime = func_get_arg(7); - $this->fileFormat = func_get_arg(8); - $this->status = func_get_arg(9); - $this->mediaUrl = func_get_arg(10); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['accountId'] = $this->accountId; - $json['conferenceId'] = $this->conferenceId; - $json['name'] = $this->name; - $json['recordingId'] = $this->recordingId; - $json['duration'] = $this->duration; - $json['channels'] = $this->channels; - $json['startTime'] = - isset($this->startTime) ? - DateTimeHelper::toRfc3339DateTime($this->startTime) : null; - $json['endTime'] = - isset($this->endTime) ? - DateTimeHelper::toRfc3339DateTime($this->endTime) : null; - $json['fileFormat'] = $this->fileFormat; - $json['status'] = $this->status; - $json['mediaUrl'] = $this->mediaUrl; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/ConferenceState.php b/src/Voice/Models/ConferenceState.php deleted file mode 100644 index 8ef6499..0000000 --- a/src/Voice/Models/ConferenceState.php +++ /dev/null @@ -1,107 +0,0 @@ -id = func_get_arg(0); - $this->name = func_get_arg(1); - $this->createdTime = func_get_arg(2); - $this->completedTime = func_get_arg(3); - $this->conferenceEventUrl = func_get_arg(4); - $this->conferenceEventMethod = func_get_arg(5); - $this->tag = func_get_arg(6); - $this->activeMembers = func_get_arg(7); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['id'] = $this->id; - $json['name'] = $this->name; - $json['createdTime'] = - isset($this->createdTime) ? - DateTimeHelper::toRfc3339DateTime($this->createdTime) : null; - $json['completedTime'] = - isset($this->completedTime) ? - DateTimeHelper::toRfc3339DateTime($this->completedTime) : null; - $json['conferenceEventUrl'] = $this->conferenceEventUrl; - $json['conferenceEventMethod'] = $this->conferenceEventMethod; - $json['tag'] = $this->tag; - $json['activeMembers'] = - isset($this->activeMembers) ? - array_values($this->activeMembers) : null; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/CreateCallRequest.php b/src/Voice/Models/CreateCallRequest.php deleted file mode 100644 index 2474794..0000000 --- a/src/Voice/Models/CreateCallRequest.php +++ /dev/null @@ -1,192 +0,0 @@ -from = func_get_arg(0); - $this->to = func_get_arg(1); - $this->uui = func_get_arg(2); - $this->callTimeout = func_get_arg(3); - $this->callbackTimeout = func_get_arg(4); - $this->answerUrl = func_get_arg(5); - $this->answerFallbackUrl = func_get_arg(6); - $this->username = func_get_arg(7); - $this->password = func_get_arg(8); - $this->fallbackUsername = func_get_arg(9); - $this->fallbackPassword = func_get_arg(10); - $this->answerMethod = func_get_arg(11); - $this->answerFallbackMethod = func_get_arg(12); - $this->disconnectUrl = func_get_arg(13); - $this->disconnectMethod = func_get_arg(14); - $this->tag = func_get_arg(15); - $this->applicationId = func_get_arg(16); - $this->machineDetection = func_get_arg(17); - $this->priority = func_get_arg(18); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['from'] = $this->from; - $json['to'] = $this->to; - $json['uui'] = $this->uui; - $json['callTimeout'] = $this->callTimeout; - $json['callbackTimeout'] = $this->callbackTimeout; - $json['answerUrl'] = $this->answerUrl; - $json['answerFallbackUrl'] = $this->answerFallbackUrl; - $json['username'] = $this->username; - $json['password'] = $this->password; - $json['fallbackUsername'] = $this->fallbackUsername; - $json['fallbackPassword'] = $this->fallbackPassword; - $json['answerMethod'] = $this->answerMethod; - $json['answerFallbackMethod'] = $this->answerFallbackMethod; - $json['disconnectUrl'] = $this->disconnectUrl; - $json['disconnectMethod'] = $this->disconnectMethod; - $json['tag'] = $this->tag; - $json['applicationId'] = $this->applicationId; - $json['machineDetection'] = $this->machineDetection; - $json['priority'] = $this->priority; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/CreateCallResponse.php b/src/Voice/Models/CreateCallResponse.php deleted file mode 100644 index 428e6ad..0000000 --- a/src/Voice/Models/CreateCallResponse.php +++ /dev/null @@ -1,215 +0,0 @@ -accountId = func_get_arg(0); - $this->callId = func_get_arg(1); - $this->applicationId = func_get_arg(2); - $this->to = func_get_arg(3); - $this->from = func_get_arg(4); - $this->enqueuedTime = func_get_arg(5); - $this->callUrl = func_get_arg(6); - $this->callTimeout = func_get_arg(7); - $this->callbackTimeout = func_get_arg(8); - $this->answerUrl = func_get_arg(9); - $this->answerMethod = func_get_arg(10); - $this->answerFallbackUrl = func_get_arg(11); - $this->answerFallbackMethod = func_get_arg(12); - $this->disconnectUrl = func_get_arg(13); - $this->disconnectMethod = func_get_arg(14); - $this->username = func_get_arg(15); - $this->password = func_get_arg(16); - $this->fallbackUsername = func_get_arg(17); - $this->fallbackPassword = func_get_arg(18); - $this->tag = func_get_arg(19); - $this->priority = func_get_arg(20); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['accountId'] = $this->accountId; - $json['callId'] = $this->callId; - $json['applicationId'] = $this->applicationId; - $json['to'] = $this->to; - $json['from'] = $this->from; - $json['enqueuedTime'] = - isset($this->enqueuedTime) ? - DateTimeHelper::toRfc3339DateTime($this->enqueuedTime) : null; - $json['callUrl'] = $this->callUrl; - $json['callTimeout'] = $this->callTimeout; - $json['callbackTimeout'] = $this->callbackTimeout; - $json['answerUrl'] = $this->answerUrl; - $json['answerMethod'] = $this->answerMethod; - $json['answerFallbackUrl'] = $this->answerFallbackUrl; - $json['answerFallbackMethod'] = $this->answerFallbackMethod; - $json['disconnectUrl'] = $this->disconnectUrl; - $json['disconnectMethod'] = $this->disconnectMethod; - $json['username'] = $this->username; - $json['password'] = $this->password; - $json['fallbackUsername'] = $this->fallbackUsername; - $json['fallbackPassword'] = $this->fallbackPassword; - $json['tag'] = $this->tag; - $json['priority'] = $this->priority; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/DirectionEnum.php b/src/Voice/Models/DirectionEnum.php deleted file mode 100644 index 8cc04a2..0000000 --- a/src/Voice/Models/DirectionEnum.php +++ /dev/null @@ -1,24 +0,0 @@ -reason = func_get_arg(0); - $this->privacy = func_get_arg(1); - $this->unknown = func_get_arg(2); - $this->origTo = func_get_arg(3); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['reason'] = $this->reason; - $json['privacy'] = $this->privacy; - $json['unknown'] = $this->unknown; - $json['origTo'] = $this->origTo; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/FallbackMethodEnum.php b/src/Voice/Models/FallbackMethodEnum.php deleted file mode 100644 index 7da2280..0000000 --- a/src/Voice/Models/FallbackMethodEnum.php +++ /dev/null @@ -1,24 +0,0 @@ -mode = func_get_arg(0); - $this->detectionTimeout = func_get_arg(1); - $this->silenceTimeout = func_get_arg(2); - $this->speechThreshold = func_get_arg(3); - $this->speechEndThreshold = func_get_arg(4); - $this->delayResult = func_get_arg(5); - $this->callbackUrl = func_get_arg(6); - $this->callbackMethod = func_get_arg(7); - $this->fallbackUrl = func_get_arg(8); - $this->fallbackMethod = func_get_arg(9); - $this->username = func_get_arg(10); - $this->password = func_get_arg(11); - $this->fallbackUsername = func_get_arg(12); - $this->fallbackPassword = func_get_arg(13); - $this->machineSpeechEndThreshold = func_get_arg(14); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['mode'] = $this->mode; - $json['detectionTimeout'] = $this->detectionTimeout; - $json['silenceTimeout'] = $this->silenceTimeout; - $json['speechThreshold'] = $this->speechThreshold; - $json['speechEndThreshold'] = $this->speechEndThreshold; - $json['delayResult'] = $this->delayResult; - $json['callbackUrl'] = $this->callbackUrl; - $json['callbackMethod'] = $this->callbackMethod; - $json['fallbackUrl'] = $this->fallbackUrl; - $json['fallbackMethod'] = $this->fallbackMethod; - $json['username'] = $this->username; - $json['password'] = $this->password; - $json['fallbackUsername'] = $this->fallbackUsername; - $json['fallbackPassword'] = $this->fallbackPassword; - $json['machineSpeechEndThreshold'] = $this->machineSpeechEndThreshold; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/ModeEnum.php b/src/Voice/Models/ModeEnum.php deleted file mode 100644 index e5790fd..0000000 --- a/src/Voice/Models/ModeEnum.php +++ /dev/null @@ -1,26 +0,0 @@ -state = func_get_arg(0); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['state'] = $this->state; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/ModifyCallRequest.php b/src/Voice/Models/ModifyCallRequest.php deleted file mode 100644 index 9807096..0000000 --- a/src/Voice/Models/ModifyCallRequest.php +++ /dev/null @@ -1,119 +0,0 @@ -state = func_get_arg(0); - $this->redirectUrl = func_get_arg(1); - $this->redirectFallbackUrl = func_get_arg(2); - $this->redirectMethod = func_get_arg(3); - $this->redirectFallbackMethod = func_get_arg(4); - $this->username = func_get_arg(5); - $this->password = func_get_arg(6); - $this->fallbackUsername = func_get_arg(7); - $this->fallbackPassword = func_get_arg(8); - $this->tag = func_get_arg(9); - break; - - default: - $this->state = StateEnum::ACTIVE; - break; - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['state'] = $this->state; - $json['redirectUrl'] = $this->redirectUrl; - $json['redirectFallbackUrl'] = $this->redirectFallbackUrl; - $json['redirectMethod'] = $this->redirectMethod; - $json['redirectFallbackMethod'] = $this->redirectFallbackMethod; - $json['username'] = $this->username; - $json['password'] = $this->password; - $json['fallbackUsername'] = $this->fallbackUsername; - $json['fallbackPassword'] = $this->fallbackPassword; - $json['tag'] = $this->tag; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/ModifyConferenceRequest.php b/src/Voice/Models/ModifyConferenceRequest.php deleted file mode 100644 index 7d9496b..0000000 --- a/src/Voice/Models/ModifyConferenceRequest.php +++ /dev/null @@ -1,105 +0,0 @@ -status = func_get_arg(0); - $this->redirectUrl = func_get_arg(1); - $this->redirectFallbackUrl = func_get_arg(2); - $this->redirectMethod = func_get_arg(3); - $this->redirectFallbackMethod = func_get_arg(4); - $this->username = func_get_arg(5); - $this->password = func_get_arg(6); - $this->fallbackUsername = func_get_arg(7); - $this->fallbackPassword = func_get_arg(8); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['status'] = $this->status; - $json['redirectUrl'] = $this->redirectUrl; - $json['redirectFallbackUrl'] = $this->redirectFallbackUrl; - $json['redirectMethod'] = $this->redirectMethod; - $json['redirectFallbackMethod'] = $this->redirectFallbackMethod; - $json['username'] = $this->username; - $json['password'] = $this->password; - $json['fallbackUsername'] = $this->fallbackUsername; - $json['fallbackPassword'] = $this->fallbackPassword; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/RedirectFallbackMethodEnum.php b/src/Voice/Models/RedirectFallbackMethodEnum.php deleted file mode 100644 index 6be172f..0000000 --- a/src/Voice/Models/RedirectFallbackMethodEnum.php +++ /dev/null @@ -1,24 +0,0 @@ -callbackUrl = func_get_arg(0); - $this->callbackMethod = func_get_arg(1); - $this->username = func_get_arg(2); - $this->password = func_get_arg(3); - $this->tag = func_get_arg(4); - $this->callbackTimeout = func_get_arg(5); - $this->detectLanguage = func_get_arg(6); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['callbackUrl'] = $this->callbackUrl; - $json['callbackMethod'] = $this->callbackMethod; - $json['username'] = $this->username; - $json['password'] = $this->password; - $json['tag'] = $this->tag; - $json['callbackTimeout'] = $this->callbackTimeout; - $json['detectLanguage'] = $this->detectlanguage; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/Transcript.php b/src/Voice/Models/Transcript.php deleted file mode 100644 index cea62f6..0000000 --- a/src/Voice/Models/Transcript.php +++ /dev/null @@ -1,49 +0,0 @@ -text = func_get_arg(0); - $this->confidence = func_get_arg(1); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['text'] = $this->text; - $json['confidence'] = $this->confidence; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/Transcription.php b/src/Voice/Models/Transcription.php deleted file mode 100644 index 84057a9..0000000 --- a/src/Voice/Models/Transcription.php +++ /dev/null @@ -1,65 +0,0 @@ -id = func_get_arg(0); - $this->url = func_get_arg(1); - $this->status = func_get_arg(2); - $this->completedTime = func_get_arg(3); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['id'] = $this->id; - $json['url'] = $this->url; - $json['status'] = $this->status; - $json['completedTime'] = $this->completedTime; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/TranscriptionMetadata.php b/src/Voice/Models/TranscriptionMetadata.php deleted file mode 100644 index 2026499..0000000 --- a/src/Voice/Models/TranscriptionMetadata.php +++ /dev/null @@ -1,67 +0,0 @@ -id = func_get_arg(0); - $this->status = func_get_arg(1); - $this->completedTime = func_get_arg(2); - $this->url = func_get_arg(3); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['id'] = $this->id; - $json['status'] = $this->status; - $json['completedTime'] = $this->completedTime; - $json['url'] = $this->url; - - return array_filter($json); - } -} diff --git a/src/Voice/Models/TranscriptionResponse.php b/src/Voice/Models/TranscriptionResponse.php deleted file mode 100644 index 4c9334a..0000000 --- a/src/Voice/Models/TranscriptionResponse.php +++ /dev/null @@ -1,42 +0,0 @@ -transcripts = func_get_arg(0); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['transcripts'] = isset($this->transcripts) ? - array_values($this->transcripts) : null; - - return array_filter($json); - } -} diff --git a/src/Voice/VoiceClient.php b/src/Voice/VoiceClient.php deleted file mode 100644 index 089b842..0000000 --- a/src/Voice/VoiceClient.php +++ /dev/null @@ -1,37 +0,0 @@ -config = $config; - } - - - private $client; - - /** - * Provides access to API controller - * @return Controllers\APIController - */ - public function getClient() - { - if ($this->client == null) { - $this->client = new Controllers\APIController($this->config); - } - return $this->client; - } -} diff --git a/src/WebRtc/Controllers/APIController.php b/src/WebRtc/Controllers/APIController.php deleted file mode 100644 index 7deab15..0000000 --- a/src/WebRtc/Controllers/APIController.php +++ /dev/null @@ -1,931 +0,0 @@ - $accountId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::WEBRTCDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'webrtc'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new APIException('Bad Request', $_httpContext); - } - - if ($response->code == 401) { - throw new APIException('Unauthorized', $_httpContext); - } - - if ($response->code == 403) { - throw new APIException('Access Denied', $_httpContext); - } - - if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass( - $response->body, - 'BandwidthLib\\WebRtc\\Models\\AccountsParticipantsResponse' - ); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Get participant by ID. - * - * @param string $accountId Account ID - * @param string $participantId Participant ID - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getParticipant( - string $accountId, - string $participantId - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/participants/{participantId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'participantId' => $participantId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::WEBRTCDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'webrtc'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 401) { - throw new APIException('Unauthorized', $_httpContext); - } - - if ($response->code == 403) { - throw new APIException('Access Denied', $_httpContext); - } - - if ($response->code == 404) { - throw new APIException('Not Found', $_httpContext); - } - - if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass($response->body, 'BandwidthLib\\WebRtc\\Models\\Participant'); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Delete participant by ID. - * - * @param string $accountId Account ID - * @param string $participantId TODO: type description here - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function deleteParticipant( - string $accountId, - string $participantId - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/participants/{participantId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'participantId' => $participantId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::WEBRTCDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT - ); - - //set authentication - $this->configureAuth($_headers, 'webrtc'); - - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 401) { - throw new APIException('Unauthorized', $_httpContext); - } - - if ($response->code == 403) { - throw new APIException('Access Denied', $_httpContext); - } - - if ($response->code == 404) { - throw new APIException('Not Found', $_httpContext); - } - - if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Create a new session. - * - * Sessions are idempotent, so relevant parameters must be set in this function if desired. - * - * - * @param string $accountId Account ID - * @param Models\Session|null $body (optional) Session parameters - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function createSession( - string $accountId, - ?Models\Session $body = null - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/sessions'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::WEBRTCDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'webrtc'); - - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new APIException('Bad Request', $_httpContext); - } - - if ($response->code == 401) { - throw new APIException('Unauthorized', $_httpContext); - } - - if ($response->code == 403) { - throw new APIException('Access Denied', $_httpContext); - } - - if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass($response->body, 'BandwidthLib\\WebRtc\\Models\\Session'); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Get session by ID. - * - * @param string $accountId Account ID - * @param string $sessionId Session ID - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getSession( - string $accountId, - string $sessionId - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/sessions/{sessionId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'sessionId' => $sessionId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::WEBRTCDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'webrtc'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 401) { - throw new APIException('Unauthorized', $_httpContext); - } - - if ($response->code == 403) { - throw new APIException('Access Denied', $_httpContext); - } - - if ($response->code == 404) { - throw new APIException('Not Found', $_httpContext); - } - - if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass($response->body, 'BandwidthLib\\WebRtc\\Models\\Session'); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Delete session by ID. - * - * @param string $accountId Account ID - * @param string $sessionId Session ID - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function deleteSession( - string $accountId, - string $sessionId - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/sessions/{sessionId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'sessionId' => $sessionId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::WEBRTCDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT - ); - - //set authentication - $this->configureAuth($_headers, 'webrtc'); - - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 401) { - throw new APIException('Unauthorized', $_httpContext); - } - - if ($response->code == 403) { - throw new APIException('Access Denied', $_httpContext); - } - - if ($response->code == 404) { - throw new APIException('Not Found', $_httpContext); - } - - if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * List participants in a session. - * - * @param string $accountId Account ID - * @param string $sessionId Session ID - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function listSessionParticipants( - string $accountId, - string $sessionId - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/sessions/{sessionId}/participants'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'sessionId' => $sessionId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::WEBRTCDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'webrtc'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 401) { - throw new APIException('Unauthorized', $_httpContext); - } - - if ($response->code == 403) { - throw new APIException('Access Denied', $_httpContext); - } - - if ($response->code == 404) { - throw new APIException('Not Found', $_httpContext); - } - - if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClassArray($response->body, 'BandwidthLib\\WebRtc\\Models\\Participant'); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * Add a participant to a session. - * - * Subscriptions can optionally be provided as part of this call. - * - * - * @param string $accountId Account ID - * @param string $sessionId Session ID - * @param string $participantId Participant ID - * @param Models\Subscriptions|null $body (optional) Subscriptions the participant should be created with - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function addParticipantToSession( - string $accountId, - string $sessionId, - string $participantId, - ?Models\Subscriptions $body = null - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'sessionId' => $sessionId, - 'participantId' => $participantId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::WEBRTCDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'webrtc'); - - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 401) { - throw new APIException('Unauthorized', $_httpContext); - } - - if ($response->code == 403) { - throw new APIException('Access Denied', $_httpContext); - } - - if ($response->code == 404) { - throw new APIException('Not Found', $_httpContext); - } - - if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Remove a participant from a session. - * - * This will automatically remove any subscriptions the participant has associated with this session. - * - * - * @param string $accountId Account ID - * @param string $sessionId Session ID - * @param string $participantId Participant ID - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function removeParticipantFromSession( - string $accountId, - string $sessionId, - string $participantId - ) { - - //prepare query string for API call - $_queryBuilder = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'sessionId' => $sessionId, - 'participantId' => $participantId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::WEBRTCDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT - ); - - //set authentication - $this->configureAuth($_headers, 'webrtc'); - - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 401) { - throw new APIException('Unauthorized', $_httpContext); - } - - if ($response->code == 403) { - throw new APIException('Access Denied', $_httpContext); - } - - if ($response->code == 404) { - throw new APIException('Not Found', $_httpContext); - } - - if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } - - /** - * Get a participant's subscriptions. - * - * @param string $accountId Account ID - * @param string $sessionId Session ID - * @param string $participantId Participant ID - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function getParticipantSubscriptions( - string $accountId, - string $sessionId, - string $participantId - ) { - - //prepare query string for API call - $_queryBuilder = - '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'sessionId' => $sessionId, - 'participantId' => $participantId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::WEBRTCDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set authentication - $this->configureAuth($_headers, 'webrtc'); - - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 401) { - throw new APIException('Unauthorized', $_httpContext); - } - - if ($response->code == 403) { - throw new APIException('Access Denied', $_httpContext); - } - - if ($response->code == 404) { - throw new APIException('Not Found', $_httpContext); - } - - if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - $mapper = $this->getJsonMapper(); - $deserializedResponse = $mapper->mapClass($response->body, 'BandwidthLib\\WebRtc\\Models\\Subscriptions'); - return new ApiResponse($response->code, $response->headers, $deserializedResponse); - } - - /** - * 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 string $accountId Account ID - * @param string $sessionId Session ID - * @param string $participantId Participant ID - * @param Models\Subscriptions|null $body (optional) Initial state - * @return ApiResponse response from the API call - * @throws APIException Thrown if API call fails - */ - public function updateParticipantSubscriptions( - string $accountId, - string $sessionId, - string $participantId, - ?Models\Subscriptions $body = null - ) { - - //prepare query string for API call - $_queryBuilder = - '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'sessionId' => $sessionId, - 'participantId' => $participantId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::WEBRTCDEFAULT) . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'content-type' => 'application/json; charset=utf-8' - ); - - //json encode body - $_bodyJson = Request\Body::Json($body); - - //set authentication - $this->configureAuth($_headers, 'webrtc'); - - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); - - //call on-before Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - // Set request timeout - Request::timeout($this->config->getTimeout()); - - // and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //Error handling using HTTP status codes - if ($response->code == 400) { - throw new APIException('Bad Request', $_httpContext); - } - - if ($response->code == 401) { - throw new APIException('Unauthorized', $_httpContext); - } - - if ($response->code == 403) { - throw new APIException('Access Denied', $_httpContext); - } - - if ($response->code == 404) { - throw new APIException('Not Found', $_httpContext); - } - - if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - return new ApiResponse($response->code, $response->headers, null); - } -} diff --git a/src/WebRtc/Exceptions/ErrorException.php b/src/WebRtc/Exceptions/ErrorException.php deleted file mode 100644 index 35a961f..0000000 --- a/src/WebRtc/Exceptions/ErrorException.php +++ /dev/null @@ -1,46 +0,0 @@ -participant = func_get_arg(0); - $this->token = func_get_arg(1); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['participant'] = $this->participant; - $json['token'] = $this->token; - - return array_filter($json); - } -} diff --git a/src/WebRtc/Models/DeviceApiVersionEnum.php b/src/WebRtc/Models/DeviceApiVersionEnum.php deleted file mode 100644 index 725e537..0000000 --- a/src/WebRtc/Models/DeviceApiVersionEnum.php +++ /dev/null @@ -1,24 +0,0 @@ -id = func_get_arg(0); - $this->callbackUrl = func_get_arg(1); - $this->publishPermissions = func_get_arg(2); - $this->sessions = func_get_arg(3); - $this->subscriptions = func_get_arg(4); - $this->tag = func_get_arg(5); - $this->deviceApiVersion = func_get_arg(6); - break; - - default: - $this->deviceApiVersion = DeviceApiVersionEnum::V2; - break; - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['id'] = $this->id; - $json['callbackUrl'] = $this->callbackUrl; - $json['publishPermissions'] = - isset($this->publishPermissions) ? - array_values($this->publishPermissions) : null; - $json['sessions'] = isset($this->sessions) ? - array_values($this->sessions) : null; - $json['subscriptions'] = $this->subscriptions; - $json['tag'] = $this->tag; - $json['deviceApiVersion'] = $this->deviceApiVersion; - - return array_filter($json); - } -} diff --git a/src/WebRtc/Models/ParticipantSubscription.php b/src/WebRtc/Models/ParticipantSubscription.php deleted file mode 100644 index 8d484f8..0000000 --- a/src/WebRtc/Models/ParticipantSubscription.php +++ /dev/null @@ -1,42 +0,0 @@ -participantId = func_get_arg(0); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['participantId'] = $this->participantId; - - return array_filter($json); - } -} diff --git a/src/WebRtc/Models/PublishPermissionEnum.php b/src/WebRtc/Models/PublishPermissionEnum.php deleted file mode 100644 index f8f1473..0000000 --- a/src/WebRtc/Models/PublishPermissionEnum.php +++ /dev/null @@ -1,24 +0,0 @@ -id = func_get_arg(0); - $this->tag = func_get_arg(1); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['id'] = $this->id; - $json['tag'] = $this->tag; - - return array_filter($json); - } -} diff --git a/src/WebRtc/Models/Subscriptions.php b/src/WebRtc/Models/Subscriptions.php deleted file mode 100644 index 499aba4..0000000 --- a/src/WebRtc/Models/Subscriptions.php +++ /dev/null @@ -1,54 +0,0 @@ -sessionId = func_get_arg(0); - $this->participants = func_get_arg(1); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize(): array - { - $json = array(); - $json['sessionId'] = $this->sessionId; - $json['participants'] = isset($this->participants) ? - array_values($this->participants) : null; - - return array_filter($json); - } -} diff --git a/src/WebRtc/Utils/WebRtcTransfer.php b/src/WebRtc/Utils/WebRtcTransfer.php deleted file mode 100644 index 80537b9..0000000 --- a/src/WebRtc/Utils/WebRtcTransfer.php +++ /dev/null @@ -1,33 +0,0 @@ -' . WebRtcTransfer::generateTransferBxmlVerb($deviceToken, $voiceCallId, $sipUri) . ''; - } - - public static function generateTransferBxmlVerb($deviceToken, $voiceCallId, $sipUri = "sip:sipx.webrtc.bandwidth.com:5060") { - /** - * Returns the Transfer verb to perform the SIP transfer - * @param string $deviceToken The device token - * @param array $voiceCallId The Bandwidth Voice Call Id - * @return string $sipUri The SIP URI to transfer the call to - */ - $formattedCallId = substr(str_replace("-", "", $voiceCallId), 1); - return '' . $sipUri . ''; - } -} diff --git a/src/WebRtc/WebRtcClient.php b/src/WebRtc/WebRtcClient.php deleted file mode 100644 index fd40808..0000000 --- a/src/WebRtc/WebRtcClient.php +++ /dev/null @@ -1,37 +0,0 @@ -config = $config; - } - - - private $client; - - /** - * Provides access to API controller - * @return Controllers\APIController - */ - public function getClient() - { - if ($this->client == null) { - $this->client = new Controllers\APIController($this->config); - } - return $this->client; - } -} diff --git a/tests/ApiTest.php b/tests/ApiTest.php deleted file mode 100644 index 44c9bc9..0000000 --- a/tests/ApiTest.php +++ /dev/null @@ -1,254 +0,0 @@ - getenv("BW_USERNAME"), - 'voiceBasicAuthPassword' => getenv("BW_PASSWORD"), - 'phoneNumberLookupBasicAuthUserName' => getenv("BW_USERNAME"), - 'phoneNumberLookupBasicAuthPassword' => getenv("BW_PASSWORD"), - 'clientId' => getenv("BW_CLIENT_ID"), - 'clientSecret' => getenv("BW_CLIENT_SECRET"), - ) - ); - self::$bandwidthClient = new BandwidthLib\BandwidthClient($config); - - $messagingMFAConfig = new BandwidthLib\Configuration( - array( - 'messagingBasicAuthUserName' => getenv("BW_USERNAME"), - 'messagingBasicAuthPassword' => getenv("BW_PASSWORD"), - 'multiFactorAuthBasicAuthUserName' => getenv("BW_USERNAME"), - 'multiFactorAuthBasicAuthPassword' => getenv("BW_PASSWORD"), - ) - ); - self::$messagingMFAClient = new BandwidthLib\BandwidthClient($messagingMFAConfig); - } - - public function testCreateMessage() { - $body = new BandwidthLib\Messaging\Models\MessageRequest(); - $body->from = getenv("BW_NUMBER"); - $body->to = [getenv("USER_NUMBER")]; - $body->applicationId = getenv("BW_MESSAGING_APPLICATION_ID"); - $body->text = "PHP Monitoring"; - - $response = self::$messagingMFAClient->getMessaging()->getClient()->createMessage(getenv("BW_ACCOUNT_ID"), $body); - - $this->assertTrue(strlen($response->getResult()->id) > 0); //validate that _some_ id was returned - } - - public function testCreateMessageInvalidPhoneNumber() { - $body = new BandwidthLib\Messaging\Models\MessageRequest(); - $body->from = getenv("BW_NUMBER"); - $body->to = ["+1invalid"]; - $body->applicationId = getenv("BW_MESSAGING_APPLICATION_ID"); - $body->text = "PHP Monitoring"; - - try { - self::$messagingMFAClient->getMessaging()->getClient()->createMessage(getenv("BW_ACCOUNT_ID"), $body); - //workaround to make sure that if the above error is not raised, the build will fail - $this->assertTrue(false); - } catch (BandwidthLib\Messaging\Exceptions\MessagingException $e) { - $this->assertTrue(strlen($e->description) > 0); - } - } - - public function testUploadDownloadMedia() { - //constants - $mediaId = "text-media-id-" . uniqid() . ".txt"; - $content = "Hello world"; - $contentType = 'text/plain'; - - //media upload - self::$messagingMFAClient->getMessaging()->getClient()->uploadMedia(getenv("BW_ACCOUNT_ID"), $mediaId, $content, $contentType); - - //media download - $downloadedContent = self::$messagingMFAClient->getMessaging()->getClient()->getMedia(getenv("BW_ACCOUNT_ID"), $mediaId)->getResult(); - - //media delete - self::$messagingMFAClient->getMessaging()->getClient()->deleteMedia(getenv("BW_ACCOUNT_ID"), $mediaId); - - //validate that response is the same - $this->assertEquals($downloadedContent, $content); - } - - public function testCreateCallAndGetCallState() { - $body = new BandwidthLib\Voice\Models\CreateCallRequest(); - $body->from = getenv("BW_NUMBER"); - $body->to = getenv("USER_NUMBER"); - $body->applicationId = getenv("BW_VOICE_APPLICATION_ID"); - $body->answerUrl = getenv("BASE_CALLBACK_URL"); - $response = self::$bandwidthClient->getVoice()->getClient()->createCall(getenv("BW_ACCOUNT_ID"), $body); - $callId = $response->getResult()->callId; - $this->assertTrue(strlen($callId) > 0); - $this->assertTrue(is_a($response->getResult()->enqueuedTime, 'DateTime')); - - //get phone call information (This is commented out until voice fixes their latency issues - // $response = self::$bandwidthClient->getVoice()->getClient()->getCall(getenv("BW_ACCOUNT_ID"), $callId); - // $this->assertTrue(is_a($response->getResult()->enqueuedTime, 'DateTime')); - - } - - public function testCreateCallWithAmdAndGetCallState() { - $body = new BandwidthLib\Voice\Models\CreateCallRequest(); - $machineDetection = new BandwidthLib\Voice\Models\MachineDetectionConfiguration(); - - $machineDetection->mode = BandwidthLib\Voice\Models\ModeEnum::ASYNC; - $machineDetection->detectionTimeout = 5.0; - $machineDetection->silenceTimeout = 5.0; - $machineDetection->speechThreshold = 5.0; - $machineDetection->speechEndThreshold = 5.0; - $machineDetection->delayResult = true; - $machineDetection->callbackUrl = getenv("BASE_CALLBACK_URL") . "/callbacks/machine-detection"; - $machineDetection->callbackMethod = "POST"; - $machineDetection->machineSpeechEndThreshold = 3.2; - - $body->from = getenv("BW_NUMBER"); - $body->to = getenv("USER_NUMBER"); - $body->applicationId = getenv("BW_VOICE_APPLICATION_ID"); - $body->answerUrl = getenv("BASE_CALLBACK_URL"); - $body->machineDetection = $machineDetection; - $response = self::$bandwidthClient->getVoice()->getClient()->createCall(getenv("BW_ACCOUNT_ID"), $body); - $callId = $response->getResult()->callId; - $this->assertTrue(strlen($callId) > 0); - - sleep(25); - - //get phone call information - // $response = self::$bandwidthClient->getVoice()->getClient()->getCall(getenv("BW_ACCOUNT_ID"), $callId); - // if (($response->getStatus() == 404) ) { - // $this->assertTrue(is_a($response->getResult()->enqueuedTime, 'DateTime')); - // } - } - public function testCreateCallWithPriority() { - $body = new BandwidthLib\Voice\Models\CreateCallRequest(); - $body->from = getenv("BW_NUMBER"); - $body->to = getenv("USER_NUMBER"); - $body->applicationId = getenv("BW_VOICE_APPLICATION_ID"); - $body->answerUrl = getenv("BASE_CALLBACK_URL"); - $body->priority = 1; - $response = self::$bandwidthClient->getVoice()->getClient()->createCall(getenv("BW_ACCOUNT_ID"), $body); - $callId = $response->getResult()->callId; - $this->assertTrue(strlen($callId) > 0); - $this->assertTrue($response->getResult()->priority == $body->priority); - } - - public function testCreateCallInvalidPhoneNumber() { - $body = new BandwidthLib\Voice\Models\CreateCallRequest(); - $body->from = getenv("BW_NUMBER"); - $body->to = "+1invalid"; - $body->applicationId = getenv("BW_VOICE_APPLICATION_ID"); - $body->answerUrl = getenv("BASE_CALLBACK_URL"); - - try { - self::$bandwidthClient->getVoice()->getClient()->createCall(getenv("BW_ACCOUNT_ID"), $body); - //workaround to make sure that if the above error is not raised, the build will fail - $this->assertTrue(false); - } catch (BandwidthLib\Voice\Exceptions\ApiErrorException $e) { - $this->assertTrue(strlen($e->description) > 0); - } - } - - public function testMfaMessaging() { - $body = new BandwidthLib\MultiFactorAuth\Models\TwoFactorCodeRequestSchema(); - $body->from = getenv("BW_NUMBER"); - $body->to = getenv("USER_NUMBER"); - $body->applicationId = getenv("BW_MESSAGING_APPLICATION_ID"); - $body->scope = "scope"; - $body->digits = 6; - $body->message = "Your temporary {NAME} {SCOPE} code is {CODE}"; - - $response = self::$messagingMFAClient->getMultiFactorAuth()->getMFA()->createMessagingTwoFactor(getenv("BW_ACCOUNT_ID"), $body); - $this->assertTrue(strlen($response->getResult()->messageId) > 0); //validate that _some_ id was returned - } - - public function testMfaVoice() { - $body = new BandwidthLib\MultiFactorAuth\Models\TwoFactorCodeRequestSchema(); - $body->from = getenv("BW_NUMBER"); - $body->to = getenv("USER_NUMBER"); - $body->applicationId = getenv("BW_VOICE_APPLICATION_ID"); - $body->scope = "scope"; - $body->digits = 6; - $body->message = "Your temporary {NAME} {SCOPE} code is {CODE}"; - - $response = self::$messagingMFAClient->getMultiFactorAuth()->getMFA()->createVoiceTwoFactor(getenv("BW_ACCOUNT_ID"), $body); - $this->assertTrue(strlen($response->getResult()->callId) > 0); //validate that _some_ id was returned - } - - public function testMfaVerify() { - $body = new BandwidthLib\MultiFactorAuth\Models\TwoFactorVerifyRequestSchema(); - $body->to = "+".rand(10000000000, 19999999999); - $body->applicationId = getenv("BW_VOICE_APPLICATION_ID"); - $body->scope = "scope"; - $body->code = "123456"; - $body->digits = 6; - $body->expirationTimeInMinutes = 3; - - $response = self::$messagingMFAClient->getMultiFactorAuth()->getMFA()->createVerifyTwoFactor(getenv("BW_ACCOUNT_ID"), $body); - $this->assertTrue(is_bool($response->getResult()->valid)); - } - - public function testAsyncTnLookup() { - $body = new BandwidthLib\PhoneNumberLookup\Models\CreateLookupRequest(); - $body->phoneNumbers = [getenv("USER_NUMBER")]; - $createResponse = self::$bandwidthClient->getPhoneNumberLookup()->getClient()->createAsyncBulkLookupRequest(getenv("BW_ACCOUNT_ID"), $body); - $this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\CreateAsyncBulkResponse::class, $createResponse->getResult()); - $this->assertIsArray($createResponse->getResult()->links); - $this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\CreateAsyncBulkResponseData::class, $createResponse->getResult()->data); - $this->assertIsString($createResponse->getResult()->data->requestId); - $this->assertIsString($createResponse->getResult()->data->status); - $this->assertIsArray($createResponse->getResult()->errors); - - sleep(30); - - $statusResponse = self::$bandwidthClient->getPhoneNumberLookup()->getClient()->getAsyncLookupRequestStatus(getenv("BW_ACCOUNT_ID"), $createResponse->getResult()->data->requestId); - $this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\LookupResponse::class, $statusResponse->getResult()); - $this->assertIsArray($statusResponse->getResult()->links); - $this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\LookupResponseData::class, $statusResponse->getResult()->data); - $this->assertIsString($statusResponse->getResult()->data->requestId); - $this->assertIsString($statusResponse->getResult()->data->status); - $this->assertIsArray($statusResponse->getResult()->data->results); - $this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\LookupResult::class, $statusResponse->getResult()->data->results[0]); - $this->assertIsString($statusResponse->getResult()->data->results[0]->phoneNumber); - $this->assertIsString($statusResponse->getResult()->data->results[0]->lineType); - $this->assertIsString($statusResponse->getResult()->data->results[0]->messagingProvider); - $this->assertIsString($statusResponse->getResult()->data->results[0]->voiceProvider); - $this->assertIsString($statusResponse->getResult()->data->results[0]->countryCodeA3); - $this->assertIsArray($statusResponse->getResult()->errors); - } - - public function testSyncTnLookup() { - $body = new BandwidthLib\PhoneNumberLookup\Models\CreateLookupRequest(); - $body->phoneNumbers = [getenv("USER_NUMBER")]; - $response = self::$bandwidthClient->getPhoneNumberLookup()->getClient()->createSyncLookupRequest(getenv("BW_ACCOUNT_ID"), $body); - $this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\LookupResponse::class, $response->getResult()); - $this->assertIsArray($response->getResult()->links); - $this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\Link::class, $response->getResult()->links[0]); - $this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\LookupResponseData::class, $response->getResult()->data); - $this->assertIsString($response->getResult()->data->requestId); - $this->assertIsString($response->getResult()->data->status); - $this->assertEquals("COMPLETE", $response->getResult()->data->status); - $this->assertIsArray($response->getResult()->data->results); - $this->assertInstanceOf(BandwidthLib\PhoneNumberLookup\Models\LookupResult::class, $response->getResult()->data->results[0]); - $this->assertIsString($response->getResult()->data->results[0]->phoneNumber); - $this->assertIsString($response->getResult()->data->results[0]->lineType); - // $this->assertIsString($response->getResult()->data->results[0]->messagingProvider); - $this->assertIsString($response->getResult()->data->results[0]->voiceProvider); - $this->assertIsString($response->getResult()->data->results[0]->countryCodeA3); - $this->assertIsArray($response->getResult()->errors); - } -} diff --git a/tests/BxmlTest.php b/tests/BxmlTest.php deleted file mode 100644 index 44bdb2f..0000000 --- a/tests/BxmlTest.php +++ /dev/null @@ -1,543 +0,0 @@ -duration("3"); - $speakSentence->voice("susan"); - $speakSentence->locale("en_US"); - $speakSentence->gender("female"); - $bxml = new BandwidthLib\Voice\Bxml\Bxml(); - $bxml->addVerb($speakSentence, $pause); - $bxml->addVerb($pause); - $expectedXml = 'Test'; - $responseXml = $bxml->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testForward() { - $forward = new BandwidthLib\Voice\Bxml\Forward(); - $forward->to("+18888888888"); - $forward->from("+18889999999"); - $forward->callTimeout(3); - $forward->diversionTreatment("none"); - $forward->diversionReason("away"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($forward); - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testGatherNoNestedTag() { - $gather = new BandwidthLib\Voice\Bxml\Gather(); - $gather->gatherUrl("https://test.com"); - $gather->gatherMethod("GET"); - $gather->username("user"); - $gather->password("pass"); - $gather->tag("tag"); - $gather->terminatingDigits("123"); - $gather->maxDigits(3); - $gather->interDigitTimeout(4); - $gather->firstDigitTimeout(5); - $gather->repeatCount(3); - $gather->gatherFallbackUrl("https://test.com"); - $gather->gatherFallbackMethod("GET"); - $gather->fallbackUsername("fuser"); - $gather->fallbackPassword("fpass"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($gather); - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testGatherEncodedURL() { - $gather = new BandwidthLib\Voice\Bxml\Gather(); - $gather->gatherUrl("https://test.com?param1=test1¶m2=test2"); - $gather->gatherMethod("GET"); - $gather->username("user"); - $gather->password("pass"); - $gather->tag("tag"); - $gather->terminatingDigits("123"); - $gather->maxDigits(3); - $gather->interDigitTimeout(4); - $gather->firstDigitTimeout(5); - $gather->repeatCount(3); - $gather->gatherFallbackUrl("https://test.com"); - $gather->gatherFallbackMethod("GET"); - $gather->fallbackUsername("fuser"); - $gather->fallbackPassword("fpass"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($gather); - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testGatherNestedSpeakSentence() { - $gather = new BandwidthLib\Voice\Bxml\Gather(); - $speakSentence = new BandwidthLib\Voice\Bxml\SpeakSentence("Test"); - $speakSentence->voice("susan"); - $speakSentence->locale("en_US"); - $speakSentence->gender("female"); - $gather = new BandwidthLib\Voice\Bxml\Gather(); - $gather->gatherUrl("https://test.com"); - $gather->gatherMethod("GET"); - $gather->username("user"); - $gather->password("pass"); - $gather->tag("tag"); - $gather->terminatingDigits("123"); - $gather->maxDigits(3); - $gather->interDigitTimeout(4); - $gather->firstDigitTimeout(5); - $gather->speakSentence($speakSentence); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($gather); - $expectedXml = 'Test'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testGatherNestedPlayAudio() { - $gather = new BandwidthLib\Voice\Bxml\Gather(); - $playAudio = new BandwidthLib\Voice\Bxml\PlayAudio("https://test.com"); - $playAudio->username("user"); - $playAudio->password("pass"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $gather = new BandwidthLib\Voice\Bxml\Gather(); - $gather->gatherUrl("https://test.com"); - $gather->gatherMethod("GET"); - $gather->username("user"); - $gather->password("pass"); - $gather->tag("tag"); - $gather->terminatingDigits("123"); - $gather->maxDigits(3); - $gather->interDigitTimeout(4); - $gather->firstDigitTimeout(5); - $gather->playAudio($playAudio); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($gather); - $expectedXml = 'https://test.com'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testGatherNestedVerbs() { - $speakSentence1 = new BandwidthLib\Voice\Bxml\SpeakSentence("First Sentence"); - $playAudio1 = new BandwidthLib\Voice\Bxml\PlayAudio("https://audio1.com"); - $playAudio2 = new BandwidthLib\Voice\Bxml\PlayAudio("https://audio2.com"); - $speakSentence2 = new BandwidthLib\Voice\Bxml\SpeakSentence("Second Sentence"); - - $gather = new BandwidthLib\Voice\Bxml\Gather(); - $gather->gatherUrl("https://gather.url/nextBXML"); - $gather->speakSentence($speakSentence1); - $gather->playAudio($playAudio1); - $gather->playAudio($playAudio2); - $gather->speakSentence($speakSentence2); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($gather); - - $expectedXml = 'First Sentencehttps://audio1.comhttps://audio2.comSecond Sentence'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testHangup() { - $hangup = new BandwidthLib\Voice\Bxml\Hangup(); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($hangup); - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testRedirect() { - $redirect = new BandwidthLib\Voice\Bxml\Redirect(); - $redirect->username("user"); - $redirect->password("pass"); - $redirect->redirectUrl("https://test.com"); - $redirect->redirectMethod("GET"); - $redirect->tag("tag"); - $redirect->redirectFallbackUrl("https://test2.com"); - $redirect->redirectFallbackMethod("POST"); - $redirect->fallbackUsername("fuser"); - $redirect->fallbackPassword("fpass"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($redirect); - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testPause() { - $pause = new BandwidthLib\Voice\Bxml\Pause(); - $pause->duration("3"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($pause); - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testSendDtmf() { - $sendDtmf = new BandwidthLib\Voice\Bxml\SendDtmf("123"); - $sendDtmf->toneDuration("65"); - $sendDtmf->toneInterval(75); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($sendDtmf); - $expectedXml = '123'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testSpeakSentence() { - $speakSentence = new BandwidthLib\Voice\Bxml\SpeakSentence("Test"); - $speakSentence->voice("susan"); - $speakSentence->locale("en_US"); - $speakSentence->gender("female"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($speakSentence); - $expectedXml = 'Test'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testSpeakSentenceEncode() { - $speakSentence = new BandwidthLib\Voice\Bxml\SpeakSentence("These characters cause problems < > &"); - $speakSentence->voice("susan"); - $speakSentence->locale("en_US"); - $speakSentence->gender("female"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($speakSentence); - $expectedXml = 'These characters cause problems < > &'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testSpeakSentenceSSML() { - $speakSentence = new BandwidthLib\Voice\Bxml\SpeakSentence('Hello, you have reached the home of Antonio Mendoza.Please leave a message.'); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($speakSentence); - $expectedXml = 'Hello, you have reached the home of Antonio Mendoza.Please leave a message.'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testPlayAudio() { - $playAudio = new BandwidthLib\Voice\Bxml\PlayAudio("https://test.com"); - $playAudio->username("user"); - $playAudio->password("pass"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($playAudio); - $expectedXml = 'https://test.com'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testPlayAudioEncodedURL() { - $playAudio = new BandwidthLib\Voice\Bxml\PlayAudio("https://test.com?param1=test1¶m2=test2"); - $playAudio->username("user"); - $playAudio->password("pass"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($playAudio); - $expectedXml = 'https://test.com?param1=test1&param2=test2'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testTransfer() { - $number1 = new BandwidthLib\Voice\Bxml\PhoneNumber("+17777777777"); - $number1->transferAnswerUrl("https://test.com"); - $number1->transferAnswerMethod("GET"); - $number1->username("user"); - $number1->password("pass"); - $number1->tag("tag"); - $number2 = new BandwidthLib\Voice\Bxml\PhoneNumber("+17777777779"); - $number2->transferAnswerUrl("https://test2.com"); - $number2->transferAnswerMethod("GET"); - $number2->username("user2"); - $number2->password("pass2"); - $number2->tag("tag2"); - $number2->transferAnswerFallbackUrl("https://test3.com"); - $number2->transferAnswerFallbackMethod("POST"); - $number2->fallbackUsername("fuser"); - $number2->fallbackPassword("fpass"); - $transfer = new BandwidthLib\Voice\Bxml\Transfer(); - $transfer->transferCallerId("+18999999999"); - $transfer->transferCallerDisplayName("test"); - $transfer->transferCompleteUrl("https://test.com"); - $transfer->transferCompleteMethod("GET"); - $transfer->username("user"); - $transfer->password("pass"); - $transfer->tag("tag"); - $transfer->callTimeout(3); - $transfer->diversionTreatment("none"); - $transfer->diversionReason("away"); - $transfer->phoneNumbers(array($number1, $number2)); - $transfer->transferCompleteFallbackUrl("https://test3.com"); - $transfer->transferCompleteFallbackMethod("POST"); - $transfer->fallbackUsername("fusern"); - $transfer->fallbackPassword("fpassw"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($transfer); - $expectedXml = '+17777777777+17777777779'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testPauseRecording() { - $pauseRecording = new BandwidthLib\Voice\Bxml\PauseRecording(); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($pauseRecording); - - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testResumeRecording() { - $resumeRecording = new BandwidthLib\Voice\Bxml\ResumeRecording(); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($resumeRecording); - - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testStartRecording() { - $startRecording = new BandwidthLib\Voice\Bxml\StartRecording(); - $startRecording->tag("tag"); - $startRecording->recordingAvailableUrl("https://myapp.com/noBXML"); - $startRecording->recordingAvailableMethod("POST"); - $startRecording->username("user"); - $startRecording->password("pass"); - $startRecording->fileFormat("wav"); - $startRecording->multiChannel(true); - $startRecording->transcribe(false); - $startRecording->transcriptionAvailableUrl("https://available.com"); - $startRecording->transcriptionAvailableMethod("GET"); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($startRecording); - - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testStopRecording() { - $stopRecording = new BandwidthLib\Voice\Bxml\StopRecording(); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($stopRecording); - - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - public function testStartStream() { - $streamParam1 = new BandwidthLib\Voice\Bxml\StreamParam(); - $streamParam1->name("name1"); - $streamParam1->value("value1"); - $streamParam2 = new BandwidthLib\Voice\Bxml\StreamParam(); - $streamParam2->name("name2"); - $streamParam2->value("value2"); - $startStream = new BandwidthLib\Voice\Bxml\StartStream(); - $startStream->name("test"); - $startStream->tracks("inbound"); - $startStream->destination("https://url.com"); - $startStream->streamEventMethod("POST"); - $startStream->username("user"); - $startStream->password("pass"); - $startStream->streamEventUrl("https://url.com"); - $startStream->streamParams(array($streamParam1, $streamParam2)); - - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($startStream); - - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testStopStream() { - $stopStream = new BandwidthLib\Voice\Bxml\StopStream(); - $stopStream->name("test"); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($stopStream); - - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testRecord() { - $record = new BandwidthLib\Voice\Bxml\Record(); - $record->recordCompleteUrl("https://myapp.com/nextBXML"); - $record->maxDuration(10); - $record->recordCompleteFallbackUrl("https://test.com"); - $record->recordCompleteFallbackMethod("GET"); - $record->fallbackUsername("fuser"); - $record->fallbackPassword("fpass"); - $record->detectlanguage("true"); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($record); - - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testConference() { - $conference = new BandwidthLib\Voice\Bxml\Conference("conference-name"); - $conference->mute(true); - $conference->hold(false); - $conference->callIdsToCoach("c-abc,c-def"); - $conference->conferenceEventUrl("https://test.com"); - $conference->conferenceEventMethod("GET"); - $conference->username("user"); - $conference->password("pass"); - $conference->tag("tag"); - $conference->conferenceEventFallbackUrl("https://test2.com"); - $conference->conferenceEventFallbackMethod("POST"); - $conference->fallbackUsername("fuser"); - $conference->fallbackPassword("fpass"); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($conference); - - $expectedXml = 'conference-name'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testConferenceCallIdsToCoachArray() { - $conference = new BandwidthLib\Voice\Bxml\Conference("conference-name"); - $conference->callIdsToCoachArray(["c-abc", "c-def"]); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($conference); - - $expectedXml = 'conference-name'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testBridge() { - $bridge = new BandwidthLib\Voice\Bxml\Bridge("c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"); - $bridge->bridgeCompleteUrl("https://test.com"); - $bridge->bridgeCompleteMethod("GET"); - $bridge->bridgeTargetCompleteUrl("https://test2.com"); - $bridge->bridgeTargetCompleteMethod("POST"); - $bridge->username("user"); - $bridge->password("pass"); - $bridge->tag("custom tag"); - $bridge->bridgeCompleteFallbackUrl("https://test3.com"); - $bridge->bridgeCompleteFallbackMethod("GET"); - $bridge->bridgeTargetCompleteFallbackUrl("https://test4.com"); - $bridge->bridgeTargetCompleteFallbackMethod("POST"); - $bridge->fallbackUsername("fuser"); - $bridge->fallbackPassword("fpass"); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($bridge); - - $expectedXml = 'c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d'; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testRing() { - $ring = new BandwidthLib\Voice\Bxml\Ring(); - $ring->duration(5); - $ring->answerCall(false); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($ring); - - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testStartGather() { - $startGather = new BandwidthLib\Voice\Bxml\StartGather(); - $startGather->username("user"); - $startGather->password("pass"); - $startGather->dtmfUrl("https://test.com"); - $startGather->dtmfMethod("GET"); - $startGather->tag("custom tag"); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($startGather); - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testStopGather() { - $stopGather = new BandwidthLib\Voice\Bxml\StopGather(); - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($stopGather); - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - public function testStartTranscription() { - $customParam1 = new BandwidthLib\Voice\Bxml\CustomParam(); - $customParam1->name("name1"); - $customParam1->value("value1"); - $customParam2 = new BandwidthLib\Voice\Bxml\CustomParam(); - $customParam2->name("name2"); - $customParam2->value("value2"); - $startTranscription = new BandwidthLib\Voice\Bxml\StartTranscription(); - $startTranscription->name("test"); - $startTranscription->tracks("inbound"); - $startTranscription->destination("https://url.com"); - $startTranscription->transcriptionEventMethod("POST"); - $startTranscription->username("user"); - $startTranscription->password("pass"); - $startTranscription->transcriptionEventUrl("https://url.com"); - $startTranscription->customParams - (array($customParam1, $customParam2)); - - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($startTranscription); - - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } - - public function testStopTranscription() { - $stopTranscription = new BandwidthLib\Voice\Bxml\StopTranscription(); - $stopTranscription->name("test"); - - $response = new BandwidthLib\Voice\Bxml\Response(); - $response->addVerb($stopTranscription); - - $expectedXml = ''; - $responseXml = $response->toBxml(); - $this->assertEquals($expectedXml, $responseXml); - } -} diff --git a/tests/Smoke/CallsApiTest.php b/tests/Smoke/CallsApiTest.php new file mode 100644 index 0000000..44056c2 --- /dev/null +++ b/tests/Smoke/CallsApiTest.php @@ -0,0 +1,307 @@ +This is a test bxml response'; + + /** + * Setup before running any test cases + */ + public static function setUpBeforeClass(): void + { + $config = Configuration::getDefaultConfiguration() + ->setClientId(getenv("BW_CLIENT_ID")) + ->setClientSecret(getenv("BW_CLIENT_SECRET")); + + self::$apiInstance = new CallsApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$bw_number = getenv("BW_NUMBER"); + self::$user_number = getenv("USER_NUMBER"); + self::$voice_application_id = getenv("BW_VOICE_APPLICATION_ID"); + + $answer_url = getenv("BASE_CALLBACK_URL"); + $manteca_base_url = getenv("MANTECA_BASE_URL"); + $manteca_answer_url = "{$manteca_base_url}/bxml/pause"; + $fallback_url = "https://www.myFallbackServer.com/webhooks/answer"; + $disconnect_url = "https://myServer.com/bandwidth/webhooks/disconnectUrl"; + $machine_detection_url = "https://myServer.com/bandwidth/webhooks/machineDetectionComplete"; + $machine_detection_complete_url = "https://myFallbackServer.com/bandwidth/webhooks/machineDetectionComplete"; + + $machine_detection = new MachineDetectionConfiguration([ + 'mode' => MachineDetectionModeEnum::ASYNC, + 'detection_timeout' => 15.0, + 'silence_timeout' => 10.0, + 'speech_threshold' => 10.0, + 'speech_end_threshold' => 5.0, + 'machine_speech_end_threshold' => 5.0, + 'delay_result' => false, + 'callback_url' => $machine_detection_url, + 'callback_method' => CallbackMethodEnum::POST, + 'username' => 'mySecretUsername', + 'password' => 'mySecretPassword1!', + 'fallback_url' => $machine_detection_complete_url, + 'fallback_method' => CallbackMethodEnum::POST, + 'fallback_username' => 'mySecretUsername', + 'fallback_password' => 'mySecretPassword1!' + ]); + + self::$create_call_body = new CreateCall([ + 'to' => self::$user_number, + 'from' => self::$bw_number, + 'application_id' => self::$voice_application_id, + 'answer_url' => $answer_url, + 'answer_method' => CallbackMethodEnum::POST, + 'username' => 'mySecretUsername', + 'password' => 'mySecretPassword1!', + 'answer_fallback_url' => $fallback_url, + 'answer_fallback_method' => CallbackMethodEnum::POST, + 'fallback_username' => 'mySecretUsername', + 'fallback_password' => 'mySecretPassword1!', + 'disconnect_url' => $disconnect_url, + 'disconnect_method' => CallbackMethodEnum::POST, + 'call_timeout' => 30.0, + 'callback_timeout' => 15.0, + 'machine_detection' => $machine_detection, + 'priority' => 5, + 'privacy' => false, + 'tag' => 'tag_example' + ]); + + self::$create_manteca_call_body = new CreateCall([ + 'from' => getenv("MANTECA_ACTIVE_NUMBER"), + 'to' => getenv("MANTECA_IDLE_NUMBER"), + 'application_id' => getenv("MANTECA_APPLICATION_ID"), + 'answer_url' => $manteca_answer_url + ]); + + self::$update_manteca_call_body = new UpdateCall([ + 'state' => CallStateEnum::ACTIVE, + 'redirect_url' => $manteca_answer_url + ]); + + self::$complete_manteca_call_body = new UpdateCall([ + 'state' => CallStateEnum::COMPLETED + ]); + } + + /** + * Ensure that all calls collected during the suite have been hung up + */ + public static function tearDownAfterClass(): void + { + CallCleanup::cleanup(self::$apiInstance, self::$account_id, self::$call_id_list); + } + + /** + * Test case for createCall + * + * Create Call. + * + */ + public function testCreateCall() + { + [$data, $status_code] = self::$apiInstance->createCallWithHttpInfo( + self::$account_id, + self::$create_call_body + ); + self::$call_id_list[] = $data->getCallId(); + + $this->assertEquals(201, $status_code); + $this->assertInstanceOf(CreateCallResponse::class, $data); + $this->assertIsString($data->getCallId()); + $this->assertEquals(self::$account_id, $data->getAccountId()); + $this->assertEquals(self::$voice_application_id, $data->getApplicationId()); + $this->assertEquals(self::$user_number, $data->getTo()); + $this->assertEquals(self::$bw_number, $data->getFrom()); + } + + /** + * Test case for listCalls + * + * Get Calls. + * + */ + public function testListCalls() + { + [$data, $status_code] = self::$apiInstance->listCallsWithHttpInfo( + self::$account_id, + to: self::$user_number, + from: self::$bw_number + ); + + $this->assertEquals(200, $status_code); + $this->assertIsArray($data); + $this->assertInstanceOf(CallState::class, $data[0]); + $this->assertIsString($data[0]->getAccountId()); + $this->assertIsString($data[0]->getApplicationId()); + $this->assertIsString($data[0]->getCallId()); + $this->assertIsString($data[0]->getState()); + $this->assertInstanceOf(CallDirectionEnum::class, $data[0]->getDirection()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getStartTime()); + } + + /** + * Test case for getCallState + * + * Get Call State Information. + * + */ + public function testGetCallState() + { + sleep(40); + [$data, $status_code] = self::$apiInstance->getCallStateWithHttpInfo( + self::$account_id, + self::$call_id_list[0] + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(CallState::class, $data); + $this->assertIsString($data->getCallId()); + $this->assertIsString($data->getState()); + $this->assertEquals(CallDirectionEnum::OUTBOUND, $data->getDirection()); + } + + /** + * Test case for updateCall + * + * Update Call. + * + */ + public function testUpdateCall() + { + // Create call + sleep(self::TEST_SLEEP); + [$create_data, $create_status_code] = self::$apiInstance->createCallWithHttpInfo( + self::$account_id, + self::$create_manteca_call_body + ); + self::$call_id_list[] = $create_data->getCallId(); + + $this->assertEquals(201, $create_status_code); + + // Redirect call to a different url + sleep(self::TEST_SLEEP); + [, $update_status_code] = self::$apiInstance->updateCallWithHttpInfo( + self::$account_id, + $create_data->getCallId(), + self::$update_manteca_call_body + ); + + $this->assertEquals(200, $update_status_code); + + // Complete call + sleep(self::TEST_SLEEP); + [, $complete_status_code] = self::$apiInstance->updateCallWithHttpInfo( + self::$account_id, + $create_data->getCallId(), + self::$complete_manteca_call_body + ); + + $this->assertEquals(200, $complete_status_code); + } + + /** + * Test case for updateCallBxml + * + * Update Call BXML. + * + */ + public function testUpdateCallBxml() + { + // Create call + sleep(self::TEST_SLEEP); + [$create_data, $create_status_code] = self::$apiInstance->createCallWithHttpInfo( + self::$account_id, + self::$create_manteca_call_body + ); + self::$call_id_list[] = $create_data->getCallId(); + + $this->assertEquals(201, $create_status_code); + + // Update call with BXML + sleep(self::TEST_SLEEP); + [, $update_status_code] = self::$apiInstance->updateCallBxmlWithHttpInfo( + self::$account_id, + $create_data->getCallId(), + self::$test_xml_body + ); + + $this->assertEquals(204, $update_status_code); + + // Complete call + sleep(self::TEST_SLEEP); + [, $complete_status_code] = self::$apiInstance->updateCallWithHttpInfo( + self::$account_id, + $create_data->getCallId(), + self::$complete_manteca_call_body + ); + + $this->assertEquals(200, $complete_status_code); + } +} diff --git a/tests/Smoke/ConferencesApiTest.php b/tests/Smoke/ConferencesApiTest.php new file mode 100644 index 0000000..3d8d7a2 --- /dev/null +++ b/tests/Smoke/ConferencesApiTest.php @@ -0,0 +1,237 @@ +This should be a conference recording.'; + + /** + * Setup before running any test cases + */ + public static function setUpBeforeClass(): void + { + $config = Configuration::getDefaultConfiguration() + ->setClientId(getenv("BW_CLIENT_ID")) + ->setClientSecret(getenv("BW_CLIENT_SECRET")); + + self::$callsApi = new CallsApi(config: $config); + self::$conferencesApi = new ConferencesApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + + $manteca_base_url = getenv("MANTECA_BASE_URL"); + self::$answer_url = "{$manteca_base_url}/bxml/joinConferencePause"; + self::$conference_redirect_url = "{$manteca_base_url}/bxml/pause"; + } + + /** + * Ensure the conference call is hung up after the suite + */ + public static function tearDownAfterClass(): void + { + CallCleanup::cleanup(self::$callsApi, self::$account_id, [self::$call_id]); + } + + /** + * Test case for createCall, listConferences, getConference + * + * Create a conference call and fetch the resulting conference. + * + */ + public function testCreateAndFetchConference() + { + $os = getenv("OPERATING_SYSTEM"); + $language = "PHP" . phpversion(); + self::$test_id = Manteca::createTest($os, $language, "conference"); + + $conference_call_body = new CreateCall([ + 'to' => getenv("MANTECA_IDLE_NUMBER"), + 'from' => getenv("MANTECA_ACTIVE_NUMBER"), + 'application_id' => getenv("MANTECA_APPLICATION_ID"), + 'answer_url' => self::$answer_url, + 'tag' => self::$test_id + ]); + + [$create_data, $create_status_code] = self::$callsApi->createCallWithHttpInfo( + self::$account_id, + $conference_call_body + ); + + $this->assertEquals(201, $create_status_code); + self::$call_id = $create_data->getCallId(); + + sleep(self::TEST_SLEEP); + + [$list_data, $list_status_code] = self::$conferencesApi->listConferencesWithHttpInfo( + self::$account_id, + name: self::$test_id + ); + $this->assertEquals(200, $list_status_code); + + self::$conference_id = $list_data[0]->getId(); + + [$get_data, $get_status_code] = self::$conferencesApi->getConferenceWithHttpInfo( + self::$account_id, + self::$conference_id + ); + $this->assertEquals(200, $get_status_code); + $this->assertInstanceOf(Conference::class, $get_data); + } + + /** + * Test case for getConferenceMember, updateConferenceMember, updateConference, updateConferenceBxml + * + * Fetch and update a conference member and the conference. + * + */ + public function testConferenceAndMembers() + { + [$member_data, $member_status_code] = self::$conferencesApi->getConferenceMemberWithHttpInfo( + self::$account_id, + self::$conference_id, + self::$call_id + ); + $this->assertEquals(200, $member_status_code); + $this->assertInstanceOf(ConferenceMember::class, $member_data); + + $update_member = new UpdateConferenceMember(['mute' => false]); + [, $update_member_status_code] = self::$conferencesApi->updateConferenceMemberWithHttpInfo( + self::$account_id, + self::$conference_id, + self::$call_id, + $update_member + ); + $this->assertEquals(204, $update_member_status_code); + + $update_conference = new UpdateConference([ + 'status' => ConferenceStateEnum::ACTIVE, + 'redirect_url' => self::$conference_redirect_url, + 'redirect_method' => RedirectMethodEnum::POST, + 'username' => 'myUsername', + 'password' => 'myPassword1!', + 'redirect_fallback_url' => self::$conference_redirect_url, + 'redirect_fallback_method' => RedirectMethodEnum::POST, + 'fallback_username' => 'myUsername', + 'fallback_password' => 'myPassword1!' + ]); + [, $update_conference_status_code] = self::$conferencesApi->updateConferenceWithHttpInfo( + self::$account_id, + self::$conference_id, + $update_conference + ); + $this->assertEquals(204, $update_conference_status_code); + + [, $update_bxml_status_code] = self::$conferencesApi->updateConferenceBxmlWithHttpInfo( + self::$account_id, + self::$conference_id, + self::$update_recording_bxml + ); + $this->assertEquals(204, $update_bxml_status_code); + } + + /** + * Test case for listConferenceRecordings, getConferenceRecording, downloadConferenceRecording + * + * Validate conference recordings. + * + */ + public function testConferenceRecordings() + { + self::markTestSkipped('issues with PV API, can re-enable after fixed'); + + // Poll Manteca until the conference call has been recorded + $recording_status = false; + for ($i = 0; $i < self::MAX_RETRIES && !$recording_status; $i++) { + sleep(self::TEST_SLEEP); + $recording_status = Manteca::getStatus(self::$test_id)['callRecorded'] ?? false; + } + $this->assertTrue($recording_status); + + [$list_data, $list_status_code] = self::$conferencesApi->listConferenceRecordingsWithHttpInfo( + self::$account_id, + self::$conference_id + ); + $this->assertEquals(200, $list_status_code); + + $conference_recording = $list_data[0]; + $this->assertInstanceOf(ConferenceRecordingMetadata::class, $conference_recording); + + [$recording_data, $recording_status_code] = self::$conferencesApi->getConferenceRecordingWithHttpInfo( + self::$account_id, + self::$conference_id, + $conference_recording->getRecordingId() + ); + $this->assertEquals(200, $recording_status_code); + $this->assertEquals('complete', $recording_data->getStatus()); + $this->assertEquals(FileFormatEnum::WAV, $recording_data->getFileFormat()); + + [, $download_status_code] = self::$conferencesApi->downloadConferenceRecordingWithHttpInfo( + self::$account_id, + self::$conference_id, + $conference_recording->getRecordingId() + ); + $this->assertEquals(200, $download_status_code); + } +} diff --git a/tests/Smoke/EndpointsApiTest.php b/tests/Smoke/EndpointsApiTest.php new file mode 100644 index 0000000..8177800 --- /dev/null +++ b/tests/Smoke/EndpointsApiTest.php @@ -0,0 +1,179 @@ +setClientId(getenv("BW_CLIENT_ID")) + ->setClientSecret(getenv("BW_CLIENT_SECRET")); + + self::$apiInstance = new EndpointsApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + + self::$endpoint_tag = 'php-smoke-' . uniqid(); + } + + /** + * Test case for createEndpoint + * + * Create Endpoint. + * + */ + public function testCreateEndpoint() + { + $body = new CreateWebRtcConnectionRequest([ + 'type' => EndpointTypeEnum::WEBRTC, + 'direction' => EndpointDirectionEnum::BIDIRECTIONAL, + 'tag' => self::$endpoint_tag + ]); + + [$data, $status_code] = self::$apiInstance->createEndpointWithHttpInfo(self::$account_id, $body); + + $this->assertEquals(201, $status_code); + $this->assertInstanceOf(CreateEndpointResponse::class, $data); + $this->assertInstanceOf(CreateEndpointResponseData::class, $data->getData()); + $this->assertIsString($data->getData()->getEndpointId()); + $this->assertIsString($data->getData()->getToken()); + $this->assertEquals(EndpointTypeEnum::WEBRTC, $data->getData()->getType()); + $this->assertInstanceOf(EndpointStatusEnum::class, $data->getData()->getStatus()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getCreationTimestamp()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getExpirationTimestamp()); + $this->assertEquals(self::$endpoint_tag, $data->getData()->getTag()); + $this->assertIsArray($data->getErrors()); + + self::$endpoint_id = $data->getData()->getEndpointId(); + } + + /** + * Test case for listEndpoints + * + * List Endpoints. + * + */ + public function testListEndpoints() + { + [$data, $status_code] = self::$apiInstance->listEndpointsWithHttpInfo(self::$account_id); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(ListEndpointsResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertInstanceOf(Page::class, $data->getPage()); + $this->assertIsArray($data->getData()); + $this->assertIsArray($data->getErrors()); + + $first_endpoint = $data->getData()[0]; + $this->assertInstanceOf(Endpoints::class, $first_endpoint); + $this->assertIsString($first_endpoint->getEndpointId()); + $this->assertInstanceOf(EndpointTypeEnum::class, $first_endpoint->getType()); + $this->assertInstanceOf(EndpointStatusEnum::class, $first_endpoint->getStatus()); + $this->assertInstanceOf(\DateTime::class, $first_endpoint->getCreationTimestamp()); + $this->assertInstanceOf(\DateTime::class, $first_endpoint->getExpirationTimestamp()); + } + + /** + * Test case for getEndpoint + * + * Get Endpoint. + * + */ + public function testGetEndpoint() + { + [$data, $status_code] = self::$apiInstance->getEndpointWithHttpInfo(self::$account_id, self::$endpoint_id); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(EndpointResponse::class, $data); + $this->assertIsArray($data->getErrors()); + $this->assertInstanceOf(Endpoint::class, $data->getData()); + $this->assertEquals(self::$endpoint_id, $data->getData()->getEndpointId()); + $this->assertEquals(EndpointTypeEnum::WEBRTC, $data->getData()->getType()); + $this->assertInstanceOf(EndpointStatusEnum::class, $data->getData()->getStatus()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getCreationTimestamp()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getExpirationTimestamp()); + $this->assertEquals(self::$endpoint_tag, $data->getData()->getTag()); + } + + /** + * Test case for deleteEndpoint + * + * Delete Endpoint. + * + */ + public function testDeleteEndpoint() + { + [, $status_code] = self::$apiInstance->deleteEndpointWithHttpInfo(self::$account_id, self::$endpoint_id); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for updateEndpointBxml + * + * Update Endpoint BXML. + * + */ + public function testUpdateEndpointBxml() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } +} diff --git a/tests/Smoke/MFAApiTest.php b/tests/Smoke/MFAApiTest.php new file mode 100644 index 0000000..d5db315 --- /dev/null +++ b/tests/Smoke/MFAApiTest.php @@ -0,0 +1,155 @@ +setUsername(getenv("BW_USERNAME")) + ->setPassword(getenv("BW_PASSWORD")); + + self::$apiInstance = new MFAApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$bw_number = getenv("BW_NUMBER"); + self::$user_number = getenv("USER_NUMBER"); + self::$bw_messaging_application_id = getenv("BW_MESSAGING_APPLICATION_ID"); + self::$bw_voice_application_id = getenv("BW_VOICE_APPLICATION_ID"); + } + + /** + * Test case for generateMessagingCode + * + * Messaging Authentication Code. + * + */ + public function testGenerateMessagingCode() + { + $request = new CodeRequest([ + 'to' => self::$user_number, + 'from' => self::$bw_number, + 'application_id' => self::$bw_messaging_application_id, + 'scope' => 'scope', + 'message' => 'Your temporary {NAME} {SCOPE} code is {CODE}', + 'digits' => 6 + ]); + + [$data, $status_code] = self::$apiInstance->generateMessagingCodeWithHttpInfo( + self::$account_id, + $request + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(MessagingCodeResponse::class, $data); + $this->assertIsString($data->getMessageId()); + } + + /** + * Test case for generateVoiceCode + * + * Voice Authentication Code. + * + */ + public function testGenerateVoiceCode() + { + $request = new CodeRequest([ + 'to' => self::$user_number, + 'from' => self::$bw_number, + 'application_id' => self::$bw_voice_application_id, + 'scope' => 'scope', + 'message' => 'Your temporary {NAME} {SCOPE} code is {CODE}', + 'digits' => 6 + ]); + + [$data, $status_code] = self::$apiInstance->generateVoiceCodeWithHttpInfo( + self::$account_id, + $request + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(VoiceCodeResponse::class, $data); + $this->assertIsString($data->getCallId()); + } + + /** + * Test case for verifyCode + * + * Verify Authentication Code. + * + */ + public function testVerifyCode() + { + // Use a random TN to avoid rate limiting + $random_tn = '+1' . (string) rand(1111111111, 9999999999); + + $request = new VerifyCodeRequest([ + 'to' => $random_tn, + 'scope' => '2FA', + 'expiration_time_in_minutes' => 3, + 'code' => '123456' + ]); + + [$data, $status_code] = self::$apiInstance->verifyCodeWithHttpInfo( + self::$account_id, + $request + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(VerifyCodeResponse::class, $data); + $this->assertFalse($data->getValid()); + } +} diff --git a/tests/Smoke/MediaApiTest.php b/tests/Smoke/MediaApiTest.php new file mode 100644 index 0000000..a0eb817 --- /dev/null +++ b/tests/Smoke/MediaApiTest.php @@ -0,0 +1,160 @@ +setUsername(getenv("BW_USERNAME")) + ->setPassword(getenv("BW_PASSWORD")); + + self::$apiInstance = new MediaApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$media_name = "php_binary_media" . uniqid() . ".txt"; + self::$media_data = "123456"; + + $path = tempnam(sys_get_temp_dir(), 'bw_media_'); + file_put_contents($path, self::$media_data); + self::$media_file = new SplFileObject($path, 'rb'); + } + + /** + * Test case for uploadMedia + * + * Upload Media. + * + */ + public function testUploadMedia() + { + [, $status_code] = self::$apiInstance->uploadMediaWithHttpInfo( + self::$account_id, + self::$media_name, + self::$media_file, + contentType: 'text/plain' + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for listMedia + * + * List Media. + * + */ + public function testListMedia() + { + [$data, $status_code] = self::$apiInstance->listMediaWithHttpInfo( + self::$account_id + ); + + $this->assertEquals(200, $status_code); + $this->assertIsArray($data); + $this->assertInstanceOf(Media::class, $data[0]); + $this->assertIsString($data[0]->getContent()); + $this->assertGreaterThan(0, $data[0]->getContentLength()); + } + + /** + * Test case for getMedia + * + * Get Media. + * + */ + public function testGetMedia() + { + [$data, $status_code] = self::$apiInstance->getMediaWithHttpInfo( + self::$account_id, + self::$media_name + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(SplFileObject::class, $data); + $this->assertEquals(self::$media_data, file_get_contents($data->getRealPath())); + } + + /** + * Test case for deleteMedia + * + * Delete Media. + * + */ + public function testDeleteMedia() + { + [, $status_code] = self::$apiInstance->deleteMediaWithHttpInfo( + account_id: self::$account_id, + media_id: self::$media_name + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case HTTP 404 + * + * Get Media 404 + * + */ + public function testGetMedia404() + { + $this->expectException(ApiException::class); + $this->expectExceptionCode(404); + + self::$apiInstance->getMediaWithHttpInfo( + account_id: self::$account_id, + media_id: 'non_existent_media' + ); + } +} diff --git a/tests/Smoke/MessagesApiTest.php b/tests/Smoke/MessagesApiTest.php new file mode 100644 index 0000000..48fef68 --- /dev/null +++ b/tests/Smoke/MessagesApiTest.php @@ -0,0 +1,133 @@ +setUsername(getenv("BW_USERNAME")) + ->setPassword(getenv("BW_PASSWORD")); + + self::$apiInstance = new MessagesApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$bw_number = getenv("BW_NUMBER"); + } + + /** + * Test case for createMessage + * + * Create Message. + * + */ + public function testCreateMessage() + { + $application_id = getenv("BW_MESSAGING_APPLICATION_ID"); + $to_number = getenv("USER_NUMBER"); + $from_number = self::$bw_number; + $text = 'python integration'; + $media = ['https://cdn2.thecatapi.com/images/MTY3ODIyMQ.jpg']; + $tag = 'python integration tag'; + $priority = PriorityEnum::_DEFAULT; + + # Message Request + $messageRequest = new MessageRequest([ + 'application_id' => $application_id, + 'to' => [$to_number], + 'from' => $from_number, + 'text' => $text, + 'media' => $media, + 'tag' => $tag, + 'priority' => $priority, + ]); + + [$data, $status_code] = self::$apiInstance->createMessageWithHttpInfo(self::$account_id, $messageRequest); + $this->assertEquals(202, $status_code); + $this->assertInstanceOf(Message::class, $data); + $this->assertEquals(29, \strlen($data->getId())); + $this->assertEquals($from_number, $data->getOwner()); + $this->assertEquals([$to_number], $data->getTo()); + $this->assertEquals($from_number, $data->getFrom()); + $this->assertEquals($text, $data->getText()); + $this->assertEquals($tag, $data->getTag()); + $this->assertEquals($priority, $data->getPriority()); + } + + /** + * Test case for listMessages + * + * List Messages. + * + */ + public function testListMessages() + { + $list_message_direction = ListMessageDirectionEnum::OUTBOUND; + $calling_number_country_a3 = 'USA'; + + [$data, $status_code] = self::$apiInstance->listMessagesWithHttpInfo( + account_id: self::$account_id, + message_direction: $list_message_direction, + calling_number_country_a3: $calling_number_country_a3 + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(MessagesList::class, $data); + $this->assertInstanceOf(ListMessageItem::class, $data->getMessages()[0]); + $this->assertEquals(self::$account_id, $data->getMessages()[0]->getAccountId()); + $this->assertEquals(29, \strlen($data->getMessages()[0]->getMessageId())); + $this->assertEquals($list_message_direction, $data->getMessages()[0]->getMessageDirection()); + $this->assertEquals($calling_number_country_a3, $data->getMessages()[0]->getCallingNumberCountryA3()); + } +} diff --git a/tests/Smoke/MultiChannelApiTest.php b/tests/Smoke/MultiChannelApiTest.php new file mode 100644 index 0000000..cd6798b --- /dev/null +++ b/tests/Smoke/MultiChannelApiTest.php @@ -0,0 +1,509 @@ +setUsername(getenv("BW_USERNAME")) + ->setPassword(getenv("BW_PASSWORD")); + + self::$apiInstance = new MultiChannelApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$expiration = (new \DateTime('@' . strtotime('+1 minute'))) + ->setTimezone(new \DateTimeZone('UTC')); + self::$bw_number = getenv("BW_NUMBER"); + self::$user_number = getenv("USER_NUMBER"); + self::$bw_messaging_application_id = getenv("BW_MESSAGING_APPLICATION_ID"); + } + + /** + * Test case for createMultiChannelMessage + * + * Create Multi-Channel SMS Message. + * + */ + public function testCreateMultiChannelSMSMessage() + { + $content = new SmsMessageContent(['text' => 'Hello World']); + + $channel_list_object = new MultiChannelChannelListSMSObject([ + 'from' => self::$bw_number, + 'application_id' => self::$bw_messaging_application_id, + 'channel' => MultiChannelMessageChannelEnum::SMS, + 'content' => $content + ]); + + $multi_channel_message_request = new MultiChannelMessageRequest([ + 'to' => self::$user_number, + 'tag' => "tag", + 'priority' => PriorityEnum::HIGH, + 'expiration' => self::$expiration, + 'channel_list' => [$channel_list_object] + ]); + + [$data, $status_code] = self::$apiInstance->createMultiChannelMessageWithHttpInfo( + self::$account_id, + $multi_channel_message_request + ); + + $this->assertEquals(202, $status_code); + $this->assertInstanceOf(CreateMultiChannelMessageResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertIsArray($data->getErrors()); + $this->assertIsString($data->getData()->getId()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getTime()); + $this->assertEquals(MessageDirectionEnum::OUT, $data->getData()->getDirection()); + $this->assertEquals([self::$user_number], $data->getData()->getTo()); + $this->assertEquals("tag", $data->getData()->getTag()); + $this->assertEquals(PriorityEnum::HIGH, $data->getData()->getPriority()); + $this->assertEquals(self::$expiration, $data->getData()->getExpiration()); + $this->assertIsArray($data->getData()->getChannelList()); + $this->assertInstanceOf(MultiChannelChannelListSMSResponseObject::class, $data->getData()->getChannelList()[0]); + $this->assertEquals(MultiChannelMessageChannelEnum::SMS, $data->getData()->getChannelList()[0]->getChannel()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getFrom()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getOwner()); + $this->assertEquals(self::$bw_messaging_application_id, $data->getData()->getChannelList()[0]->getApplicationId()); + $this->assertInstanceOf(SmsMessageContent::class, $data->getData()->getChannelList()[0]->getContent()); + $this->assertIsString($data->getData()->getChannelList()[0]->getContent()->getText()); + } + + /** + * Test case for createMultiChannelMessage + * + * Create Multi-Channel MMS Message. + * + */ + public function testCreateMultiChannelMMSMessage() + { + $content = new MmsMessageContent([ + 'text' => 'Hello World!', + 'media' => [ + new MmsMessageContentFile(['file_url' => 'https://www.example.com/image.png']) + ] + ]); + + $channel_list_object = new MultiChannelChannelListMMSObject([ + 'from' => self::$bw_number, + 'application_id' => self::$bw_messaging_application_id, + 'channel' => MultiChannelMessageChannelEnum::MMS, + 'content' => $content + ]); + + $multi_channel_message_request = new MultiChannelMessageRequest([ + 'to' => self::$user_number, + 'tag' => "tag", + 'priority' => PriorityEnum::HIGH, + 'expiration' => self::$expiration, + 'channel_list' => [$channel_list_object] + ]); + + [$data, $status_code] = self::$apiInstance->createMultiChannelMessageWithHttpInfo( + self::$account_id, + $multi_channel_message_request + ); + + $this->assertEquals(202, $status_code); + $this->assertInstanceOf(CreateMultiChannelMessageResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertIsArray($data->getErrors()); + $this->assertIsString($data->getData()->getId()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getTime()); + $this->assertEquals(MessageDirectionEnum::OUT, $data->getData()->getDirection()); + $this->assertEquals([self::$user_number], $data->getData()->getTo()); + $this->assertEquals("tag", $data->getData()->getTag()); + $this->assertEquals(PriorityEnum::HIGH, $data->getData()->getPriority()); + $this->assertEquals(self::$expiration, $data->getData()->getExpiration()); + $this->assertIsArray($data->getData()->getChannelList()); + $this->assertInstanceOf(MultiChannelChannelListMMSResponseObject::class, $data->getData()->getChannelList()[0]); + $this->assertEquals(MultiChannelMessageChannelEnum::MMS, $data->getData()->getChannelList()[0]->getChannel()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getFrom()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getOwner()); + $this->assertEquals(self::$bw_messaging_application_id, $data->getData()->getChannelList()[0]->getApplicationId()); + $this->assertInstanceOf(MmsMessageContent::class, $data->getData()->getChannelList()[0]->getContent()); + $this->assertIsString($data->getData()->getChannelList()[0]->getContent()->getText()); + $this->assertIsArray($data->getData()->getChannelList()[0]->getContent()->getMedia()); + $this->assertInstanceOf(MmsMessageContentFile::class, $data->getData()->getChannelList()[0]->getContent()->getMedia()[0]); + $this->assertIsString($data->getData()->getChannelList()[0]->getContent()->getMedia()[0]->getFileUrl()); + } + + /** + * Test case for createMultiChannelMessage + * + * Create Multi-Channel RMB Text Message. + * + */ + public function testCreateMultiChannelRMBTextMessage() + { + $content = new RbmMessageContentText([ + 'text' => 'Hello World!', + 'suggestions' => [ + new RbmActionDial([ + 'type' => RbmActionTypeEnum::DIAL_PHONE, + 'text' => 'Call Us', + 'postback_data' => base64_encode('postback data'), + 'phone_number' => self::$bw_number + ]) + ] + ]); + + $channel_list_object = new MultiChannelChannelListRBMObject([ + 'from' => self::$bw_number, + 'application_id' => self::$bw_messaging_application_id, + 'channel' => MultiChannelMessageChannelEnum::RBM, + 'content' => $content + ]); + + $multi_channel_message_request = new MultiChannelMessageRequest([ + 'to' => self::$user_number, + 'tag' => "tag", + 'priority' => PriorityEnum::HIGH, + 'expiration' => self::$expiration, + 'channel_list' => [$channel_list_object] + ]); + + [$data, $status_code] = self::$apiInstance->createMultiChannelMessageWithHttpInfo( + self::$account_id, + $multi_channel_message_request + ); + + $this->assertEquals(202, $status_code); + $this->assertInstanceOf(CreateMultiChannelMessageResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertIsArray($data->getErrors()); + $this->assertIsString($data->getData()->getId()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getTime()); + $this->assertEquals(MessageDirectionEnum::OUT, $data->getData()->getDirection()); + $this->assertEquals([self::$user_number], $data->getData()->getTo()); + $this->assertEquals("tag", $data->getData()->getTag()); + $this->assertEquals(PriorityEnum::HIGH, $data->getData()->getPriority()); + $this->assertEquals(self::$expiration, $data->getData()->getExpiration()); + $this->assertIsArray($data->getData()->getChannelList()); + $this->assertInstanceOf(MultiChannelChannelListRBMResponseObject::class, $data->getData()->getChannelList()[0]); + $this->assertEquals(MultiChannelMessageChannelEnum::RBM, $data->getData()->getChannelList()[0]->getChannel()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getFrom()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getOwner()); + $this->assertEquals(self::$bw_messaging_application_id, $data->getData()->getChannelList()[0]->getApplicationId()); + $this->assertInstanceOf(RbmMessageContentText::class, $data->getData()->getChannelList()[0]->getContent()); + $rbm_content = $data->getData()->getChannelList()[0]->getContent(); + $this->assertIsString($rbm_content->getText()); + $this->assertIsArray($rbm_content->getSuggestions()); + $this->assertInstanceOf(RbmActionDial::class, $rbm_content->getSuggestions()[0]); + $rbm_action_dial = $rbm_content->getSuggestions()[0]; + $this->assertEquals(RbmActionTypeEnum::DIAL_PHONE, $rbm_action_dial->getType()); + $this->assertIsString($rbm_action_dial->getText()); + $this->assertIsString($rbm_action_dial->getPostbackData()); + $this->assertIsString($rbm_action_dial->getPhoneNumber()); + } + + /** + * Test case for createMultiChannelMessage + * + * Create Multi-Channel RBM Media Message. + * + */ + public function testCreateMultiChannelRBMMediaMessage() + { + $content = new RbmMessageMedia([ + 'media' => [ + new RbmMessageContentFile([ + 'file_url' => 'https://www.example.com/image1.png', + 'thumbnail_url' => 'https://www.example.com/thumbnail' + ]) + ], + 'suggestions' => [ + new RbmActionDial([ + 'type' => RbmActionTypeEnum::DIAL_PHONE, + 'text' => 'Call Us', + 'postback_data' => base64_encode('postback data'), + 'phone_number' => self::$bw_number + ]) + ] + ]); + + $channel_list_object = new MultiChannelChannelListRBMObject([ + 'from' => self::$bw_number, + 'application_id' => self::$bw_messaging_application_id, + 'channel' => MultiChannelMessageChannelEnum::RBM, + 'content' => $content + ]); + + $multi_channel_message_request = new MultiChannelMessageRequest([ + 'to' => self::$user_number, + 'tag' => "tag", + 'priority' => PriorityEnum::HIGH, + 'expiration' => self::$expiration, + 'channel_list' => [$channel_list_object] + ]); + + [$data, $status_code] = self::$apiInstance->createMultiChannelMessageWithHttpInfo( + self::$account_id, + $multi_channel_message_request + ); + + $this->assertEquals(202, $status_code); + $this->assertInstanceOf(CreateMultiChannelMessageResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertIsArray($data->getErrors()); + $this->assertIsString($data->getData()->getId()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getTime()); + $this->assertEquals(MessageDirectionEnum::OUT, $data->getData()->getDirection()); + $this->assertEquals([self::$user_number], $data->getData()->getTo()); + $this->assertEquals("tag", $data->getData()->getTag()); + $this->assertEquals(PriorityEnum::HIGH, $data->getData()->getPriority()); + $this->assertEquals(self::$expiration, $data->getData()->getExpiration()); + $this->assertIsArray($data->getData()->getChannelList()); + $this->assertInstanceOf(MultiChannelChannelListRBMResponseObject::class, $data->getData()->getChannelList()[0]); + $this->assertEquals(MultiChannelMessageChannelEnum::RBM, $data->getData()->getChannelList()[0]->getChannel()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getFrom()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getOwner()); + $this->assertEquals(self::$bw_messaging_application_id, $data->getData()->getChannelList()[0]->getApplicationId()); + $this->assertInstanceOf(RbmMessageMedia::class, $data->getData()->getChannelList()[0]->getContent()); + $rbm_content = $data->getData()->getChannelList()[0]->getContent(); + $this->assertIsArray($rbm_content->getMedia()); + $this->assertInstanceOf(RbmMessageContentFile::class, $rbm_content->getMedia()[0]); + $this->assertIsString($rbm_content->getMedia()[0]->getFileUrl()); + $this->assertIsString($rbm_content->getMedia()[0]->getThumbnailUrl()); + $this->assertIsArray($rbm_content->getSuggestions()); + $this->assertInstanceOf(RbmActionDial::class, $rbm_content->getSuggestions()[0]); + $rbm_action_dial = $rbm_content->getSuggestions()[0]; + $this->assertEquals(RbmActionTypeEnum::DIAL_PHONE, $rbm_action_dial->getType()); + $this->assertIsString($rbm_action_dial->getText()); + $this->assertIsString($rbm_action_dial->getPostbackData()); + $this->assertIsString($rbm_action_dial->getPhoneNumber()); + } + + /** + * Test case for createMultiChannelMessage + * + * Create Multi-Channel RBM Rich Standalone Message. + * + */ + public function testCreateMultiChannelRMBRichStandaloneMessage() + { + $content = new RbmStandaloneCard([ + 'orientation' => StandaloneCardOrientationEnum::HORIZONTAL, + 'thumbnail_image_alignment' => ThumbnailAlignmentEnum::LEFT, + 'card_content' => new RbmCardContent([ + 'title' => 'Test Title' + ]) + ]); + + $channel_list_object = new MultiChannelChannelListRBMObject([ + 'from' => self::$bw_number, + 'application_id' => self::$bw_messaging_application_id, + 'channel' => MultiChannelMessageChannelEnum::RBM, + 'content' => $content + ]); + + $multi_channel_message_request = new MultiChannelMessageRequest([ + 'to' => self::$user_number, + 'tag' => "tag", + 'priority' => PriorityEnum::HIGH, + 'expiration' => self::$expiration, + 'channel_list' => [$channel_list_object] + ]); + + [$data, $status_code] = self::$apiInstance->createMultiChannelMessageWithHttpInfo( + self::$account_id, + $multi_channel_message_request + ); + + $this->assertEquals(202, $status_code); + $this->assertInstanceOf(CreateMultiChannelMessageResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertIsArray($data->getErrors()); + $this->assertIsString($data->getData()->getId()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getTime()); + $this->assertEquals(MessageDirectionEnum::OUT, $data->getData()->getDirection()); + $this->assertEquals([self::$user_number], $data->getData()->getTo()); + $this->assertEquals("tag", $data->getData()->getTag()); + $this->assertEquals(PriorityEnum::HIGH, $data->getData()->getPriority()); + $this->assertEquals(self::$expiration, $data->getData()->getExpiration()); + $this->assertIsArray($data->getData()->getChannelList()); + $this->assertInstanceOf(MultiChannelChannelListRBMResponseObject::class, $data->getData()->getChannelList()[0]); + $this->assertEquals(MultiChannelMessageChannelEnum::RBM, $data->getData()->getChannelList()[0]->getChannel()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getFrom()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getOwner()); + $this->assertEquals(self::$bw_messaging_application_id, $data->getData()->getChannelList()[0]->getApplicationId()); + $this->assertInstanceOf(RbmStandaloneCard::class, $data->getData()->getChannelList()[0]->getContent()); + $rbm_card = $data->getData()->getChannelList()[0]->getContent(); + $this->assertEquals(StandaloneCardOrientationEnum::HORIZONTAL, $rbm_card->getOrientation()); + $this->assertEquals(ThumbnailAlignmentEnum::LEFT, $rbm_card->getThumbnailImageAlignment()); + $this->assertInstanceOf(RbmCardContent::class, $rbm_card->getCardContent()); + $this->assertIsString($rbm_card->getCardContent()->getTitle()); + } + + /** + * Test case for createMultiChannelMessage + * + * Create Multi-Channel RBM RichCarousel Message. + * + */ + public function testCreateMultiChannelRMBRichCarouselMessage() + { + $content = new RbmMessageCarouselCard([ + 'card_width' => CardWidthEnum::MEDIUM, + 'card_contents' => [ + new RbmCardContent([ + 'title' => 'Card 1 Title', + 'description' => 'Card 1 Description', + 'media' => new RbmCardContentMedia([ + 'file_url' => 'https://www.example.com/image1.png', + 'thumbnail_url' => 'https://www.example.com/thumbnail', + 'height' => RbmMediaHeightEnum::TALL + ]), + 'suggestions' => [ + new RbmActionDial([ + 'type' => RbmActionTypeEnum::DIAL_PHONE, + 'text' => 'Call Us', + 'postback_data' => base64_encode('postback data'), + 'phone_number' => self::$bw_number + ]) + ] + ]), + new RbmCardContent([ + 'title' => 'Card 2 Title' + ]) + ] + ]); + + $channel_list_object = new MultiChannelChannelListRBMObject([ + 'from' => self::$bw_number, + 'application_id' => self::$bw_messaging_application_id, + 'channel' => MultiChannelMessageChannelEnum::RBM, + 'content' => $content + ]); + + $multi_channel_message_request = new MultiChannelMessageRequest([ + 'to' => self::$user_number, + 'tag' => "tag", + 'priority' => PriorityEnum::HIGH, + 'expiration' => self::$expiration, + 'channel_list' => [$channel_list_object] + ]); + + [$data, $status_code] = self::$apiInstance->createMultiChannelMessageWithHttpInfo( + self::$account_id, + $multi_channel_message_request + ); + + $this->assertEquals(202, $status_code); + $this->assertInstanceOf(CreateMultiChannelMessageResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertIsArray($data->getErrors()); + $this->assertIsString($data->getData()->getId()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getTime()); + $this->assertEquals(MessageDirectionEnum::OUT, $data->getData()->getDirection()); + $this->assertEquals([self::$user_number], $data->getData()->getTo()); + $this->assertEquals("tag", $data->getData()->getTag()); + $this->assertEquals(PriorityEnum::HIGH, $data->getData()->getPriority()); + $this->assertEquals(self::$expiration, $data->getData()->getExpiration()); + $this->assertIsArray($data->getData()->getChannelList()); + $this->assertInstanceOf(MultiChannelChannelListRBMResponseObject::class, $data->getData()->getChannelList()[0]); + $this->assertEquals(MultiChannelMessageChannelEnum::RBM, $data->getData()->getChannelList()[0]->getChannel()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getFrom()); + $this->assertEquals(self::$bw_number, $data->getData()->getChannelList()[0]->getOwner()); + $this->assertEquals(self::$bw_messaging_application_id, $data->getData()->getChannelList()[0]->getApplicationId()); + $this->assertInstanceOf(RbmMessageCarouselCard::class, $data->getData()->getChannelList()[0]->getContent()); + $rbm_card = $data->getData()->getChannelList()[0]->getContent(); + $this->assertEquals(CardWidthEnum::MEDIUM, $rbm_card->getCardWidth()); + $this->assertIsArray($rbm_card->getCardContents()); + $this->assertInstanceOf(RbmCardContent::class, $rbm_card->getCardContents()[0]); + $card1 = $rbm_card->getCardContents()[0]; + $this->assertIsString($card1->getTitle()); + $this->assertIsString($card1->getDescription()); + $this->assertInstanceOf(RbmCardContentMedia::class, $card1->getMedia()); + $media = $card1->getMedia(); + $this->assertIsString($media->getFileUrl()); + $this->assertIsString($media->getThumbnailUrl()); + $this->assertEquals(RbmMediaHeightEnum::TALL, $media->getHeight()); + $this->assertIsArray($card1->getSuggestions()); + $this->assertInstanceOf(RbmActionDial::class, $card1->getSuggestions()[0]); + $rbm_action_dial = $card1->getSuggestions()[0]; + $this->assertEquals(RbmActionTypeEnum::DIAL_PHONE, $rbm_action_dial->getType()); + $this->assertIsString($rbm_action_dial->getText()); + $this->assertIsString($rbm_action_dial->getPostbackData()); + $this->assertIsString($rbm_action_dial->getPhoneNumber()); + $this->assertInstanceOf(RbmCardContent::class, $rbm_card->getCardContents()[1]); + $card2 = $rbm_card->getCardContents()[1]; + $this->assertIsString($card2->getTitle()); + } +} diff --git a/tests/Smoke/PhoneNumberLookupApiTest.php b/tests/Smoke/PhoneNumberLookupApiTest.php new file mode 100644 index 0000000..a2a3270 --- /dev/null +++ b/tests/Smoke/PhoneNumberLookupApiTest.php @@ -0,0 +1,155 @@ +setClientId(getenv("BW_CLIENT_ID")) + ->setClientSecret(getenv("BW_CLIENT_SECRET")); + + self::$apiInstance = new PhoneNumberLookupApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$phone_numbers = [ + getenv("BW_NUMBER"), + getenv("VZW_NUMBER"), + getenv("ATT_NUMBER"), + getenv("T_MOBILE_NUMBER") + ]; + } + + /** + * Test case for createSyncLookup + * + * Create Synchronous Number Lookup. + * + */ + public function testCreateSyncLookup() + { + $lookup_request = new SyncLookupRequest(['phone_numbers' => self::$phone_numbers]); + + [$data, $status_code] = self::$apiInstance->createSyncLookupWithHttpInfo( + self::$account_id, + $lookup_request + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(CreateSyncLookupResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertInstanceOf(CreateSyncLookupResponseData::class, $data->getData()); + $this->assertIsString($data->getData()->getRequestId()); + $this->assertInstanceOf(CompletedLookupStatusEnum::class, $data->getData()->getStatus()); + $this->assertIsArray($data->getData()->getResults()); + $first_result = $data->getData()->getResults()[0]; + $this->assertInstanceOf(LookupResult::class, $first_result); + $this->assertIsString($first_result->getPhoneNumber()); + $this->assertInstanceOf(LineTypeEnum::class, $first_result->getLineType()); + $this->assertIsString($first_result->getVoiceProvider()); + $this->assertIsString($first_result->getCountryCodeA3()); + } + + /** + * Test case for getAsyncBulkLookup + * + * Get Asynchronous Bulk Number Lookup. + * + */ + public function testCreateGetAsyncBulkLookup() + { + $lookup_request = new AsyncLookupRequest(['phone_numbers' => self::$phone_numbers]); + + [$create_data, $create_status_code] = self::$apiInstance->createAsyncBulkLookupWithHttpInfo( + self::$account_id, + $lookup_request + ); + + $this->assertEquals(202, $create_status_code); + $this->assertInstanceOf(CreateAsyncBulkLookupResponse::class, $create_data); + $this->assertInstanceOf(CreateAsyncBulkLookupResponseData::class, $create_data->getData()); + $this->assertIsString($create_data->getData()->getRequestId()); + $this->assertInstanceOf(InProgressLookupStatusEnum::class, $create_data->getData()->getStatus()); + + self::$request_id = $create_data->getData()->getRequestId(); + + sleep(60); + + [$get_data, $get_status_code] = self::$apiInstance->getAsyncBulkLookupWithHttpInfo( + self::$account_id, + self::$request_id + ); + + $this->assertEquals(200, $get_status_code); + $this->assertInstanceOf(GetAsyncBulkLookupResponse::class, $get_data); + $this->assertIsArray($get_data->getLinks()); + $this->assertInstanceOf(GetAsyncBulkLookupResponseData::class, $get_data->getData()); + $this->assertEquals(self::$request_id, $get_data->getData()->getRequestId()); + $this->assertInstanceOf(InProgressLookupStatusEnum::class, $get_data->getData()->getStatus()); + $this->assertIsArray($get_data->getData()->getResults()); + $first_result = $get_data->getData()->getResults()[0]; + $this->assertInstanceOf(LookupResult::class, $first_result); + $this->assertIsString($first_result->getPhoneNumber()); + $this->assertInstanceOf(LineTypeEnum::class, $first_result->getLineType()); + $this->assertIsString($first_result->getVoiceProvider()); + $this->assertIsString($first_result->getCountryCodeA3()); + } +} diff --git a/tests/Smoke/RecordingsApiTest.php b/tests/Smoke/RecordingsApiTest.php new file mode 100644 index 0000000..76b246c --- /dev/null +++ b/tests/Smoke/RecordingsApiTest.php @@ -0,0 +1,228 @@ +setClientId(getenv("BW_CLIENT_ID")) + ->setClientSecret(getenv("BW_CLIENT_SECRET")); + + self::$callsApi = new CallsApi(config: $config); + self::$recordingsApi = new RecordingsApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$answer_url = getenv("MANTECA_BASE_URL") . "/bxml/startLongRecording"; + } + + /** + * Ensure the call is hung up after the suite + */ + public static function tearDownAfterClass(): void + { + CallCleanup::cleanup(self::$callsApi, self::$account_id, [self::$call_id]); + } + + /** + * Test case for the full call recording and transcription lifecycle. + * + */ + public function testCallRecordingAndTranscription() + { + $os = getenv("OPERATING_SYSTEM"); + $language = "PHP" . phpversion() . "_" . getenv("DISTRIBUTION"); + self::$test_id = Manteca::createTest($os, $language, "CALL"); + + $create_call_body = new CreateCall([ + 'to' => getenv("MANTECA_IDLE_NUMBER"), + 'from' => getenv("MANTECA_ACTIVE_NUMBER"), + 'application_id' => getenv("MANTECA_APPLICATION_ID"), + 'answer_url' => self::$answer_url, + 'tag' => self::$test_id + ]); + + [$create_data] = self::$callsApi->createCallWithHttpInfo(self::$account_id, $create_call_body); + self::$call_id = $create_data->getCallId(); + + // Pause recording + sleep(self::TEST_SLEEP * 2); + [, $pause_status_code] = self::$recordingsApi->updateCallRecordingStateWithHttpInfo( + self::$account_id, + self::$call_id, + new UpdateCallRecording(['state' => RecordingStateEnum::PAUSED]) + ); + $this->assertEquals(200, $pause_status_code); + + // Resume recording + sleep(self::TEST_SLEEP); + [, $resume_status_code] = self::$recordingsApi->updateCallRecordingStateWithHttpInfo( + self::$account_id, + self::$call_id, + new UpdateCallRecording(['state' => RecordingStateEnum::RECORDING]) + ); + $this->assertEquals(200, $resume_status_code); + + // Terminate the call + [, $update_call_status_code] = self::$callsApi->updateCallWithHttpInfo( + self::$account_id, + self::$call_id, + new UpdateCall(['state' => CallStateEnum::COMPLETED]) + ); + $this->assertEquals(200, $update_call_status_code); + + // Poll Manteca until the call has been recorded + $recording_status = false; + for ($x = 0; $x < self::MAX_RETRIES && !$recording_status; $x++) { + sleep(self::TEST_SLEEP); + $recording_status = Manteca::getStatus(self::$test_id)['callRecorded'] ?? false; + } + $this->assertTrue($recording_status); + + // Validate the recording metadata endpoints + [$list_data, $list_status_code] = self::$recordingsApi->listCallRecordingsWithHttpInfo( + self::$account_id, + self::$call_id + ); + $this->assertEquals(200, $list_status_code); + self::$recording_id = $list_data[0]->getRecordingId(); + + [$get_data, $get_status_code] = self::$recordingsApi->getCallRecordingWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id + ); + $this->assertEquals(200, $get_status_code); + $this->assertInstanceOf(CallRecordingMetadata::class, $get_data); + + // Request a transcription; pass the tag to receive the Manteca callback + $transcribe_recording = new TranscribeRecording([ + 'callback_url' => getenv("MANTECA_BASE_URL") . "/transcriptions", + 'tag' => self::$test_id + ]); + [, $transcribe_status_code] = self::$recordingsApi->transcribeCallRecordingWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id, + $transcribe_recording + ); + $this->assertEquals(204, $transcribe_status_code); + + // Poll Manteca until the call has been transcribed + $transcription_status = false; + for ($i = 0; $i < self::MAX_RETRIES && !$transcription_status; $i++) { + sleep(self::TEST_SLEEP); + $transcription_status = Manteca::getStatus(self::$test_id)['callTranscribed'] ?? false; + } + $this->assertTrue($transcription_status); + + // Validate the transcription metadata endpoint + [$transcription_data, $transcription_get_status_code] = self::$recordingsApi->getRecordingTranscriptionWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id + ); + $this->assertEquals(200, $transcription_get_status_code); + $this->assertInstanceOf(RecordingTranscriptions::class, $transcription_data); + + // Delete transcription + [, $delete_transcription_status_code] = self::$recordingsApi->deleteRecordingTranscriptionWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id + ); + $this->assertEquals(204, $delete_transcription_status_code); + + // Delete recording media + [, $delete_media_status_code] = self::$recordingsApi->deleteRecordingMediaWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id + ); + $this->assertEquals(204, $delete_media_status_code); + + // Delete recording metadata + [, $delete_recording_status_code] = self::$recordingsApi->deleteRecordingWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id + ); + $this->assertEquals(204, $delete_recording_status_code); + } + + /** + * Test case for listAccountCallRecordings + * + * Get Call Recordings. + * + */ + public function testListAccountCallRecordings() + { + [, $status_code] = self::$recordingsApi->listAccountCallRecordingsWithHttpInfo(self::$account_id); + + $this->assertEquals(200, $status_code); + } +} diff --git a/tests/Smoke/StatisticsApiTest.php b/tests/Smoke/StatisticsApiTest.php new file mode 100644 index 0000000..1bae514 --- /dev/null +++ b/tests/Smoke/StatisticsApiTest.php @@ -0,0 +1,77 @@ +setClientId(getenv("BW_CLIENT_ID")) + ->setClientSecret(getenv("BW_CLIENT_SECRET")); + + self::$apiInstance = new StatisticsApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + } + + /** + * Test case for getStatistics + * + * Get Account Statistics. + * + */ + public function testGetStatistics() + { + [$data, $status_code] = self::$apiInstance->getStatisticsWithHttpInfo(self::$account_id); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(AccountStatistics::class, $data); + $this->assertIsInt($data->getCurrentCallQueueSize()); + $this->assertIsInt($data->getMaxCallQueueSize()); + } +} diff --git a/tests/Smoke/TollFreeVerificationApiTest.php b/tests/Smoke/TollFreeVerificationApiTest.php new file mode 100644 index 0000000..a798bd7 --- /dev/null +++ b/tests/Smoke/TollFreeVerificationApiTest.php @@ -0,0 +1,167 @@ +setClientId(getenv("BW_CLIENT_ID")) + ->setClientSecret(getenv("BW_CLIENT_SECRET")); + + self::$apiInstance = new TollFreeVerificationApi(config: $config); + } + + /** + * Test case for createWebhookSubscription + * + * Create Webhook Subscription. + * + */ + public function testCreateWebhookSubscription() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteVerificationRequest + * + * Delete a Toll-Free Verification Submission. + * + */ + public function testDeleteVerificationRequest() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteWebhookSubscription + * + * Delete Webhook Subscription. + * + */ + public function testDeleteWebhookSubscription() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } + + /** + * Test case for getTollFreeVerificationStatus + * + * Get Toll-Free Verification Status. + * + */ + public function testGetTollFreeVerificationStatus() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } + + /** + * Test case for listTollFreeUseCases + * + * List Toll-Free Use Cases. + * + */ + public function testListTollFreeUseCases() + { + [$data, $status_code] = self::$apiInstance->listTollFreeUseCasesWithHttpInfo(); + + $this->assertEquals(200, $status_code); + $this->assertIsArray($data); + } + + /** + * Test case for listWebhookSubscriptions + * + * List Webhook Subscriptions. + * + */ + public function testListWebhookSubscriptions() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } + + /** + * Test case for requestTollFreeVerification + * + * Request Toll-Free Verification. + * + */ + public function testRequestTollFreeVerification() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } + + /** + * Test case for updateTollFreeVerificationRequest + * + * Update Toll-Free Verification Request. + * + */ + public function testUpdateTollFreeVerificationRequest() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } + + /** + * Test case for updateWebhookSubscription + * + * Update Webhook Subscription. + * + */ + public function testUpdateWebhookSubscription() + { + // TODO: implement + self::markTestIncomplete('Not implemented'); + } +} diff --git a/tests/Smoke/TranscriptionsApiTest.php b/tests/Smoke/TranscriptionsApiTest.php new file mode 100644 index 0000000..eda18db --- /dev/null +++ b/tests/Smoke/TranscriptionsApiTest.php @@ -0,0 +1,158 @@ +This is a bxml start transcription test.Ideally this part is being transcribed.'; + + /** + * Setup before running any test cases + */ + public static function setUpBeforeClass(): void + { + $config = Configuration::getDefaultConfiguration() + ->setClientId(getenv("BW_CLIENT_ID")) + ->setClientSecret(getenv("BW_CLIENT_SECRET")); + + self::$callsApi = new CallsApi(config: $config); + self::$transcriptionsApi = new TranscriptionsApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$manteca_answer_url = getenv("MANTECA_BASE_URL") . "/bxml/pause"; + } + + /** + * Test case for listRealTimeTranscriptions, getRealTimeTranscription, deleteRealTimeTranscription + * + * Create a transcribed call, then list, get, and delete its real-time transcriptions. + * + */ + public function testGetAndDeleteRealTimeTranscriptions() + { + self::markTestSkipped('issue with PV API, can re-enable when fixed'); + + // Create a call, start transcription via BXML, and complete it so there is + // a transcription to exercise the endpoints below. + $create_call_body = new CreateCall([ + 'from' => getenv("MANTECA_ACTIVE_NUMBER"), + 'to' => getenv("MANTECA_IDLE_NUMBER"), + 'application_id' => getenv("MANTECA_APPLICATION_ID"), + 'answer_url' => self::$manteca_answer_url + ]); + + [$create_data, $create_status_code] = self::$callsApi->createCallWithHttpInfo( + self::$account_id, + $create_call_body + ); + $this->assertEquals(201, $create_status_code); + $call_id = $create_data->getCallId(); + + // Redirect the call to start transcription + sleep(self::TEST_SLEEP); + [, $update_status_code] = self::$callsApi->updateCallBxmlWithHttpInfo( + self::$account_id, + $call_id, + self::$bxml_body + ); + $this->assertEquals(204, $update_status_code); + + // Complete the call + sleep(self::TEST_SLEEP); + [, $complete_status_code] = self::$callsApi->updateCallWithHttpInfo( + self::$account_id, + $call_id, + new UpdateCall(['state' => CallStateEnum::COMPLETED]) + ); + $this->assertEquals(200, $complete_status_code); + + // List the real-time transcriptions + sleep(self::TEST_SLEEP_LONG); + [$list_data, $list_status_code] = self::$transcriptionsApi->listRealTimeTranscriptionsWithHttpInfo( + self::$account_id, + $call_id + ); + $this->assertEquals(200, $list_status_code); + $this->assertIsString($list_data[0]->getTranscriptionId()); + $this->assertIsString($list_data[0]->getTranscriptionName()); + $this->assertIsString($list_data[0]->getTranscriptionUrl()); + + $transcription_id = $list_data[0]->getTranscriptionId(); + + // Get the real-time transcription + sleep(self::TEST_SLEEP); + [$get_data, $get_status_code] = self::$transcriptionsApi->getRealTimeTranscriptionWithHttpInfo( + self::$account_id, + $call_id, + $transcription_id + ); + $this->assertEquals(200, $get_status_code); + $this->assertInstanceOf(CallTranscriptionResponse::class, $get_data); + $this->assertIsString($get_data->getTranscriptionId()); + $this->assertInstanceOf(CallTranscription::class, $get_data->getTracks()[0]); + $this->assertInstanceOf(CallTranscriptionTrackEnum::class, $get_data->getTracks()[0]->getTrack()); + $this->assertIsString($get_data->getTracks()[0]->getTranscript()); + $this->assertEquals(0.0, $get_data->getTracks()[0]->getConfidence()); + + // Delete the real-time transcription + // NOTE: this should be 204, but there is currently an API bug tracked in VAPI-1863 + [, $delete_status_code] = self::$transcriptionsApi->deleteRealTimeTranscriptionWithHttpInfo( + self::$account_id, + $call_id, + $transcription_id + ); + $this->assertEquals(200, $delete_status_code); + } +} diff --git a/tests/Unit/Api/CallsApiTest.php b/tests/Unit/Api/CallsApiTest.php new file mode 100644 index 0000000..fc233d0 --- /dev/null +++ b/tests/Unit/Api/CallsApiTest.php @@ -0,0 +1,263 @@ +setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new CallsApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$bw_number = getenv("BW_NUMBER"); + self::$user_number = getenv("USER_NUMBER"); + self::$voice_application_id = getenv("BW_VOICE_APPLICATION_ID"); + self::$answer_url = getenv("BASE_CALLBACK_URL"); + self::$disconnect_url = getenv("BASE_CALLBACK_URL"); + } + + /** + * Test case for createCall + * + * Create Call. + * + */ + public function testCreateCall() + { + $machine_detection = new MachineDetectionConfiguration([ + 'mode' => MachineDetectionModeEnum::ASYNC, + 'detection_timeout' => 5.0, + 'silence_timeout' => 5.0, + 'speech_threshold' => 5.0, + 'speech_end_threshold' => 5.0, + 'delay_result' => true, + 'callback_url' => self::$answer_url, + 'callback_method' => CallbackMethodEnum::POST + ]); + + $create_call = new CreateCall([ + 'application_id' => self::$voice_application_id, + 'to' => self::$user_number, + 'from' => self::$bw_number, + 'privacy' => false, + 'display_name' => self::$display_name, + 'answer_url' => self::$answer_url, + 'answer_method' => self::$answer_method, + 'disconnect_url' => self::$disconnect_url, + 'disconnect_method' => self::$disconnect_method, + 'machine_detection' => $machine_detection, + 'call_timeout' => self::$call_timeout, + 'callback_timeout' => self::$callback_timeout + ]); + + [$data, $status_code] = self::$apiInstance->createCallWithHttpInfo( + self::$account_id, + $create_call + ); + + $this->assertEquals(201, $status_code); + $this->assertInstanceOf(CreateCallResponse::class, $data); + $this->assertEquals(36, \strlen($data->getApplicationId())); + $this->assertEquals(7, \strlen($data->getAccountId())); + $this->assertEquals(47, \strlen($data->getCallId())); + $this->assertEquals(12, \strlen($data->getTo())); + $this->assertEquals(12, \strlen($data->getFrom())); + $this->assertInstanceOf(\DateTime::class, $data->getEnqueuedTime()); + $this->assertIsString($data->getCallUrl()); + $this->assertIsFloat($data->getCallTimeout()); + $this->assertIsFloat($data->getCallbackTimeout()); + $this->assertIsString($data->getTag()); + $this->assertInstanceOf(CallbackMethodEnum::class, $data->getAnswerMethod()); + $this->assertIsString($data->getAnswerUrl()); + $this->assertInstanceOf(CallbackMethodEnum::class, $data->getAnswerFallbackMethod()); + $this->assertIsString($data->getAnswerFallbackUrl()); + $this->assertInstanceOf(CallbackMethodEnum::class, $data->getDisconnectMethod()); + $this->assertIsString($data->getDisconnectUrl()); + $this->assertIsString($data->getUsername()); + $this->assertIsString($data->getPassword()); + $this->assertIsString($data->getFallbackUsername()); + $this->assertIsString($data->getFallbackPassword()); + $this->assertIsInt($data->getPriority()); + } + + /** + * Test case for getCallState + * + * Get Call State Information. + * + */ + public function testGetCallState() + { + [$data, $status_code] = self::$apiInstance->getCallStateWithHttpInfo( + self::$account_id, + self::$call_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(CallState::class, $data); + $this->assertEquals(36, \strlen($data->getApplicationId())); + $this->assertEquals(7, \strlen($data->getAccountId())); + $this->assertEquals(47, \strlen($data->getCallId())); + $this->assertEquals(47, \strlen($data->getParentCallId())); + $this->assertEquals(12, \strlen($data->getTo())); + $this->assertEquals(12, \strlen($data->getFrom())); + $this->assertInstanceOf(CallDirectionEnum::class, $data->getDirection()); + $this->assertIsString($data->getState()); + $this->assertIsArray($data->getStirShaken()); + $this->assertIsString($data->getIdentity()); + $this->assertInstanceOf(\DateTime::class, $data->getEnqueuedTime()); + $this->assertInstanceOf(\DateTime::class, $data->getStartTime()); + $this->assertInstanceOf(\DateTime::class, $data->getAnswerTime()); + $this->assertInstanceOf(\DateTime::class, $data->getEndTime()); + $this->assertIsString($data->getDisconnectCause()); + $this->assertArrayHasKey('error_message', CallState::attributeMap()); + $this->assertArrayHasKey('error_id', CallState::attributeMap()); + $this->assertInstanceOf(\DateTime::class, $data->getLastUpdate()); + } + + /** + * Test case for listCalls + * + * Get Calls. + * + */ + public function testListCalls() + { + [$data, $status_code] = self::$apiInstance->listCallsWithHttpInfo( + self::$account_id, + to: self::$user_number, + from: self::$bw_number + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(CallState::class, $data[0]); + $this->assertEquals(36, \strlen($data[0]->getApplicationId())); + $this->assertEquals(7, \strlen($data[0]->getAccountId())); + $this->assertEquals(47, \strlen($data[0]->getCallId())); + $this->assertEquals(47, \strlen($data[0]->getParentCallId())); + $this->assertEquals(12, \strlen($data[0]->getTo())); + $this->assertEquals(12, \strlen($data[0]->getFrom())); + $this->assertInstanceOf(CallDirectionEnum::class, $data[0]->getDirection()); + $this->assertIsString($data[0]->getState()); + $this->assertIsArray($data[0]->getStirShaken()); + $this->assertIsString($data[0]->getIdentity()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getEnqueuedTime()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getStartTime()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getAnswerTime()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getEndTime()); + $this->assertIsString($data[0]->getDisconnectCause()); + $this->assertArrayHasKey('error_message', CallState::attributeMap()); + $this->assertArrayHasKey('error_id', CallState::attributeMap()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getLastUpdate()); + } + + /** + * Test case for updateCall + * + * Update Call. + * + */ + public function testUpdateCall() + { + $update_call = new UpdateCall([ + 'state' => CallStateEnum::ACTIVE + ]); + + [, $status_code] = self::$apiInstance->updateCallWithHttpInfo( + self::$account_id, + self::$call_id, + $update_call + ); + + $this->assertEquals(200, $status_code); + } + + /** + * Test case for updateCallBxml + * + * Update Call BXML. + * + */ + public function testUpdateCallBxml() + { + $update_call_bxml = ''; + + [, $status_code] = self::$apiInstance->updateCallBxmlWithHttpInfo( + self::$account_id, + self::$call_id, + $update_call_bxml + ); + + $this->assertEquals(204, $status_code); + } +} diff --git a/tests/Unit/Api/ConferencesApiTest.php b/tests/Unit/Api/ConferencesApiTest.php new file mode 100644 index 0000000..09450ab --- /dev/null +++ b/tests/Unit/Api/ConferencesApiTest.php @@ -0,0 +1,298 @@ +setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new ConferencesApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$callback_url = getenv("BASE_CALLBACK_URL"); + } + + /** + * Test case for downloadConferenceRecording + * + * Download Conference Recording. + * + */ + public function testDownloadConferenceRecording() + { + self::markTestSkipped("Can't set the correct Accept header for Prism"); + + [$data, $status_code] = self::$apiInstance->downloadConferenceRecordingWithHttpInfo( + self::$account_id, + self::$conference_id, + self::$recording_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(\SplFileObject::class, $data); + } + + /** + * Test case for getConference + * + * Get Conference Information. + * + */ + public function testGetConference() + { + [$data, $status_code] = self::$apiInstance->getConferenceWithHttpInfo( + self::$account_id, + self::$conference_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(Conference::class, $data); + $this->assertEquals(50, \strlen($data->getId())); + $this->assertIsString($data->getName()); + $this->assertInstanceOf(\DateTime::class, $data->getCreatedTime()); + $this->assertInstanceOf(\DateTime::class, $data->getCompletedTime()); + $this->assertIsString($data->getConferenceEventUrl()); + $this->assertInstanceOf(CallbackMethodEnum::class, $data->getConferenceEventMethod()); + $this->assertIsString($data->getTag()); + } + + /** + * Test case for getConferenceMember + * + * Get Conference Member. + * + */ + public function testGetConferenceMember() + { + [$data, $status_code] = self::$apiInstance->getConferenceMemberWithHttpInfo( + self::$account_id, + self::$conference_id, + self::$call_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(ConferenceMember::class, $data); + $this->assertEquals(47, \strlen($data->getCallId())); + $this->assertEquals(50, \strlen($data->getConferenceId())); + $this->assertIsString($data->getMemberUrl()); + $this->assertIsBool($data->getMute()); + $this->assertIsBool($data->getHold()); + $this->assertIsArray($data->getCallIdsToCoach()); + } + + /** + * Test case for getConferenceRecording + * + * Get Conference Recording Information. + * + */ + public function testGetConferenceRecording() + { + [$data, $status_code] = self::$apiInstance->getConferenceRecordingWithHttpInfo( + self::$account_id, + self::$conference_id, + self::$recording_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(ConferenceRecordingMetadata::class, $data); + $this->assertEquals(7, \strlen($data->getAccountId())); + $this->assertEquals(50, \strlen($data->getConferenceId())); + $this->assertIsString($data->getName()); + $this->assertEquals(47, \strlen($data->getRecordingId())); + $this->assertIsString($data->getDuration()); + $this->assertIsInt($data->getChannels()); + $this->assertInstanceOf(\DateTime::class, $data->getStartTime()); + $this->assertInstanceOf(\DateTime::class, $data->getEndTime()); + $this->assertInstanceOf(FileFormatEnum::class, $data->getFileFormat()); + $this->assertIsString($data->getStatus()); + $this->assertIsString($data->getMediaUrl()); + } + + /** + * Test case for listConferenceRecordings + * + * Get Conference Recordings. + * + */ + public function testListConferenceRecordings() + { + [$data, $status_code] = self::$apiInstance->listConferenceRecordingsWithHttpInfo( + self::$account_id, + self::$conference_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(ConferenceRecordingMetadata::class, $data[0]); + $this->assertEquals(7, \strlen($data[0]->getAccountId())); + $this->assertEquals(50, \strlen($data[0]->getConferenceId())); + $this->assertIsString($data[0]->getName()); + $this->assertEquals(47, \strlen($data[0]->getRecordingId())); + $this->assertIsString($data[0]->getDuration()); + $this->assertIsInt($data[0]->getChannels()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getStartTime()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getEndTime()); + $this->assertInstanceOf(FileFormatEnum::class, $data[0]->getFileFormat()); + $this->assertIsString($data[0]->getStatus()); + $this->assertIsString($data[0]->getMediaUrl()); + } + + /** + * Test case for listConferences + * + * Get Conferences. + * + */ + public function testListConferences() + { + [$data, $status_code] = self::$apiInstance->listConferencesWithHttpInfo( + self::$account_id, + name: self::$conference_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(Conference::class, $data[0]); + $this->assertEquals(50, \strlen($data[0]->getId())); + $this->assertIsString($data[0]->getName()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getCreatedTime()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getCompletedTime()); + $this->assertIsString($data[0]->getConferenceEventUrl()); + $this->assertInstanceOf(CallbackMethodEnum::class, $data[0]->getConferenceEventMethod()); + $this->assertIsString($data[0]->getTag()); + } + + /** + * Test case for updateConference + * + * Update Conference. + * + */ + public function testUpdateConference() + { + $update_conference = new UpdateConference([ + 'status' => ConferenceStateEnum::ACTIVE, + 'redirect_url' => self::$callback_url, + 'redirect_method' => RedirectMethodEnum::POST, + 'username' => 'username', + 'password' => 'password', + 'redirect_fallback_url' => self::$callback_url, + 'redirect_fallback_method' => RedirectMethodEnum::POST, + 'fallback_username' => 'username', + 'fallback_password' => 'password' + ]); + + [, $status_code] = self::$apiInstance->updateConferenceWithHttpInfo( + self::$account_id, + self::$conference_id, + $update_conference + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for updateConferenceBxml + * + * Update Conference BXML. + * + */ + public function testUpdateConferenceBxml() + { + $update_conference_bxml = ''; + + [, $status_code] = self::$apiInstance->updateConferenceBxmlWithHttpInfo( + self::$account_id, + self::$conference_id, + $update_conference_bxml + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for updateConferenceMember + * + * Update Conference Member. + * + */ + public function testUpdateConferenceMember() + { + $update_conference_member = new UpdateConferenceMember([ + 'mute' => true, + 'hold' => true, + 'call_ids_to_coach' => [] + ]); + + [, $status_code] = self::$apiInstance->updateConferenceMemberWithHttpInfo( + self::$account_id, + self::$conference_id, + self::$call_id, + $update_conference_member + ); + + $this->assertEquals(204, $status_code); + } +} diff --git a/tests/Unit/Api/EndpointsApiTest.php b/tests/Unit/Api/EndpointsApiTest.php new file mode 100644 index 0000000..abb5fcd --- /dev/null +++ b/tests/Unit/Api/EndpointsApiTest.php @@ -0,0 +1,196 @@ +Hello'; + + /** + * Setup before running any test cases + */ + public static function setUpBeforeClass(): void + { + $config = Configuration::getDefaultConfiguration() + ->setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new EndpointsApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + } + + /** + * Test case for createEndpoint + * + * Create Endpoint. + * + */ + public function testCreateEndpoint() + { + $endpoint_body = new CreateWebRtcConnectionRequest([ + 'type' => EndpointTypeEnum::WEBRTC, + 'direction' => EndpointDirectionEnum::BIDIRECTIONAL + ]); + + [$data, $status_code] = self::$apiInstance->createEndpointWithHttpInfo( + self::$account_id, + $endpoint_body + ); + + $this->assertEquals(201, $status_code); + $this->assertInstanceOf(CreateEndpointResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertInstanceOf(CreateEndpointResponseData::class, $data->getData()); + $this->assertIsString($data->getData()->getEndpointId()); + $this->assertIsString($data->getData()->getToken()); + $this->assertInstanceOf(EndpointTypeEnum::class, $data->getData()->getType()); + $this->assertInstanceOf(EndpointStatusEnum::class, $data->getData()->getStatus()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getCreationTimestamp()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getExpirationTimestamp()); + $this->assertIsString($data->getData()->getTag()); + $this->assertIsArray($data->getData()->getDevices()); + $this->assertIsArray($data->getErrors()); + } + + /** + * Test case for deleteEndpoint + * + * Delete Endpoint. + * + */ + public function testDeleteEndpoint() + { + [, $status_code] = self::$apiInstance->deleteEndpointWithHttpInfo( + self::$account_id, + self::$endpoint_id + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for getEndpoint + * + * Get Endpoint. + * + */ + public function testGetEndpoint() + { + [$data, $status_code] = self::$apiInstance->getEndpointWithHttpInfo( + self::$account_id, + self::$endpoint_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(EndpointResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertInstanceOf(Endpoint::class, $data->getData()); + $this->assertIsString($data->getData()->getEndpointId()); + $this->assertInstanceOf(EndpointTypeEnum::class, $data->getData()->getType()); + $this->assertInstanceOf(EndpointStatusEnum::class, $data->getData()->getStatus()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getCreationTimestamp()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getExpirationTimestamp()); + $this->assertIsString($data->getData()->getTag()); + $this->assertIsArray($data->getData()->getDevices()); + $this->assertIsArray($data->getErrors()); + } + + /** + * Test case for listEndpoints + * + * List Endpoints. + * + */ + public function testListEndpoints() + { + [$data, $status_code] = self::$apiInstance->listEndpointsWithHttpInfo( + self::$account_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(ListEndpointsResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertIsArray($data->getData()); + $this->assertInstanceOf(Endpoints::class, $data->getData()[0]); + $this->assertIsString($data->getData()[0]->getEndpointId()); + $this->assertInstanceOf(EndpointTypeEnum::class, $data->getData()[0]->getType()); + $this->assertInstanceOf(EndpointStatusEnum::class, $data->getData()[0]->getStatus()); + $this->assertInstanceOf(\DateTime::class, $data->getData()[0]->getCreationTimestamp()); + $this->assertInstanceOf(\DateTime::class, $data->getData()[0]->getExpirationTimestamp()); + $this->assertIsString($data->getData()[0]->getTag()); + $this->assertInstanceOf(Page::class, $data->getPage()); + $this->assertIsArray($data->getErrors()); + } + + /** + * Test case for updateEndpointBxml + * + * Update Endpoint BXML. + * + */ + public function testUpdateEndpointBxml() + { + [, $status_code] = self::$apiInstance->updateEndpointBxmlWithHttpInfo( + self::$account_id, + self::$endpoint_id, + self::$bxml + ); + + $this->assertEquals(204, $status_code); + } +} diff --git a/tests/Unit/Api/MFAApiTest.php b/tests/Unit/Api/MFAApiTest.php new file mode 100644 index 0000000..60c41ca --- /dev/null +++ b/tests/Unit/Api/MFAApiTest.php @@ -0,0 +1,155 @@ +setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new MFAApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$bw_number = getenv("BW_NUMBER"); + self::$user_number = getenv("USER_NUMBER"); + self::$messaging_application_id = getenv("BW_MESSAGING_APPLICATION_ID"); + self::$voice_application_id = getenv("BW_VOICE_APPLICATION_ID"); + } + + /** + * Test case for generateMessagingCode + * + * Messaging Authentication Code. + * + */ + public function testGenerateMessagingCode() + { + $code_request = new CodeRequest([ + 'to' => self::$user_number, + 'from' => self::$bw_number, + 'application_id' => self::$messaging_application_id, + 'message' => self::$message, + 'digits' => self::$digits + ]); + + [$data, $status_code] = self::$apiInstance->generateMessagingCodeWithHttpInfo( + self::$account_id, + $code_request + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(MessagingCodeResponse::class, $data); + $this->assertEquals(29, \strlen($data->getMessageId())); + } + + /** + * Test case for generateVoiceCode + * + * Voice Authentication Code. + * + */ + public function testGenerateVoiceCode() + { + $code_request = new CodeRequest([ + 'to' => self::$user_number, + 'from' => self::$bw_number, + 'application_id' => self::$voice_application_id, + 'message' => self::$message, + 'digits' => self::$digits + ]); + + [$data, $status_code] = self::$apiInstance->generateVoiceCodeWithHttpInfo( + self::$account_id, + $code_request + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(VoiceCodeResponse::class, $data); + $this->assertEquals(47, \strlen($data->getCallId())); + } + + /** + * Test case for verifyCode + * + * Verify Authentication Code. + * + */ + public function testVerifyCode() + { + $verify_code_request = new VerifyCodeRequest([ + 'to' => self::$user_number, + 'scope' => 'login', + 'expiration_time_in_minutes' => 3.0, + 'code' => '12345' + ]); + + [$data, $status_code] = self::$apiInstance->verifyCodeWithHttpInfo( + self::$account_id, + $verify_code_request + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(VerifyCodeResponse::class, $data); + $this->assertIsBool($data->getValid()); + } +} diff --git a/tests/Unit/Api/MediaApiTest.php b/tests/Unit/Api/MediaApiTest.php new file mode 100644 index 0000000..0e9c1f9 --- /dev/null +++ b/tests/Unit/Api/MediaApiTest.php @@ -0,0 +1,146 @@ +setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new MediaApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + + $path = tempnam(sys_get_temp_dir(), 'bw_media_'); + file_put_contents($path, "123456"); + self::$media_file = new SplFileObject($path, 'rb'); + } + + /** + * Test case for deleteMedia + * + * Delete Media. + * + */ + public function testDeleteMedia() + { + [, $status_code] = self::$apiInstance->deleteMediaWithHttpInfo( + self::$account_id, + self::$media_name + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for getMedia + * + * Get Media. + * + */ + public function testGetMedia() + { + self::markTestSkipped("Can't set the correct Accept header for Prism"); + + [$data, $status_code] = self::$apiInstance->getMediaWithHttpInfo( + self::$account_id, + self::$media_name + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(SplFileObject::class, $data); + } + + /** + * Test case for listMedia + * + * List Media. + * + */ + public function testListMedia() + { + [$data, $status_code] = self::$apiInstance->listMediaWithHttpInfo( + self::$account_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(Media::class, $data[0]); + $this->assertIsString($data[0]->getContent()); + $this->assertIsInt($data[0]->getContentLength()); + $this->assertIsString($data[0]->getMediaName()); + } + + /** + * Test case for uploadMedia + * + * Upload Media. + * + */ + public function testUploadMedia() + { + self::markTestSkipped("Can't set the correct Content-Type and Accept headers for Prism"); + + [, $status_code] = self::$apiInstance->uploadMediaWithHttpInfo( + self::$account_id, + self::$media_name, + self::$media_file, + content_type: 'image/jpeg', + cache_control: 'no-cache' + ); + + $this->assertEquals(204, $status_code); + } +} diff --git a/tests/Unit/Api/MessagesApiTest.php b/tests/Unit/Api/MessagesApiTest.php new file mode 100644 index 0000000..693bee7 --- /dev/null +++ b/tests/Unit/Api/MessagesApiTest.php @@ -0,0 +1,171 @@ +setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new MessagesApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$bw_number = getenv("BW_NUMBER"); + self::$messaging_application_id = getenv("BW_MESSAGING_APPLICATION_ID"); + + self::$expiration = (new \DateTime('@' . strtotime('+1 day'))) + ->setTimezone(new \DateTimeZone('UTC')); + } + + /** + * Test case for createMessage + * + * Create Message. + * + */ + public function testCreateMessage() + { + $message_request = new MessageRequest([ + 'application_id' => self::$messaging_application_id, + 'from' => self::$bw_number, + 'to' => [self::$bw_number], + 'text' => self::$message_text, + 'priority' => self::$message_priority, + 'expiration' => self::$expiration + ]); + + [$data, $status_code] = self::$apiInstance->createMessageWithHttpInfo( + self::$account_id, + $message_request + ); + + $this->assertEquals(202, $status_code); + $this->assertInstanceOf(Message::class, $data); + $this->assertEquals(29, \strlen($data->getId())); + $this->assertEquals(12, \strlen($data->getOwner())); + $this->assertEquals(36, \strlen($data->getApplicationId())); + $this->assertInstanceOf(\DateTime::class, $data->getTime()); + $this->assertIsInt($data->getSegmentCount()); + $this->assertInstanceOf(MessageDirectionEnum::class, $data->getDirection()); + $this->assertIsArray($data->getTo()); + $this->assertEquals(12, \strlen($data->getTo()[0])); + $this->assertEquals(12, \strlen($data->getFrom())); + $this->assertIsArray($data->getMedia()); + $this->assertIsString($data->getMedia()[0]); + $this->assertIsString($data->getText()); + $this->assertIsString($data->getTag()); + $this->assertInstanceOf(PriorityEnum::class, $data->getPriority()); + $this->assertInstanceOf(\DateTime::class, $data->getExpiration()); + } + + /** + * Test case for listMessages + * + * List Messages. + * + */ + public function testListMessages() + { + [$data, $status_code] = self::$apiInstance->listMessagesWithHttpInfo( + self::$account_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(MessagesList::class, $data); + $this->assertIsInt($data->getTotalCount()); + $this->assertInstanceOf(PageInfo::class, $data->getPageInfo()); + $this->assertIsString($data->getPageInfo()->getPrevPage()); + $this->assertIsString($data->getPageInfo()->getNextPage()); + $this->assertIsString($data->getPageInfo()->getPrevPageToken()); + $this->assertIsString($data->getPageInfo()->getNextPageToken()); + $this->assertIsArray($data->getMessages()); + $this->assertInstanceOf(ListMessageItem::class, $data->getMessages()[0]); + $this->assertEquals(29, \strlen($data->getMessages()[0]->getMessageId())); + $this->assertEquals(7, \strlen($data->getMessages()[0]->getAccountId())); + $this->assertEquals(12, \strlen($data->getMessages()[0]->getSourceTn())); + $this->assertEquals(12, \strlen($data->getMessages()[0]->getDestinationTn())); + $this->assertInstanceOf(MessageStatusEnum::class, $data->getMessages()[0]->getMessageStatus()); + $this->assertInstanceOf(ListMessageDirectionEnum::class, $data->getMessages()[0]->getMessageDirection()); + $this->assertInstanceOf(MessageTypeEnum::class, $data->getMessages()[0]->getMessageType()); + $this->assertIsInt($data->getMessages()[0]->getSegmentCount()); + $this->assertIsInt($data->getMessages()[0]->getErrorCode()); + $this->assertInstanceOf(\DateTime::class, $data->getMessages()[0]->getReceiveTime()); + $this->assertIsString($data->getMessages()[0]->getCarrierName()); + $this->assertIsInt($data->getMessages()[0]->getMessageSize()); + $this->assertIsInt($data->getMessages()[0]->getMessageLength()); + $this->assertIsInt($data->getMessages()[0]->getAttachmentCount()); + $this->assertIsInt($data->getMessages()[0]->getRecipientCount()); + $this->assertIsString($data->getMessages()[0]->getCampaignClass()); + $this->assertIsString($data->getMessages()[0]->getCampaignId()); + $this->assertIsInt($data->getMessages()[0]->getBwLatency()); + $this->assertIsInt($data->getMessages()[0]->getCarrierLatency()); + $this->assertIsString($data->getMessages()[0]->getCallingNumberCountryA3()); + $this->assertIsString($data->getMessages()[0]->getCalledNumberCountryA3()); + $this->assertIsString($data->getMessages()[0]->getProduct()); + $this->assertIsString($data->getMessages()[0]->getLocation()); + } +} diff --git a/tests/Unit/Api/MultiChannelApiTest.php b/tests/Unit/Api/MultiChannelApiTest.php new file mode 100644 index 0000000..d475512 --- /dev/null +++ b/tests/Unit/Api/MultiChannelApiTest.php @@ -0,0 +1,122 @@ +setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new MultiChannelApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + self::$bw_number = getenv("BW_NUMBER"); + self::$user_number = getenv("USER_NUMBER"); + self::$messaging_application_id = getenv("BW_MESSAGING_APPLICATION_ID"); + + self::$expiration = (new \DateTime('@' . strtotime('+1 minute'))) + ->setTimezone(new \DateTimeZone('UTC')); + } + + /** + * Test case for createMultiChannelMessage + * + * Create Multi-Channel Message. + * + */ + public function testCreateMultiChannelMessage() + { + $channel_list_object = new MultiChannelChannelListSMSObject([ + 'from' => self::$bw_number, + 'application_id' => self::$messaging_application_id, + 'channel' => MultiChannelMessageChannelEnum::SMS, + 'content' => new SmsMessageContent(['text' => 'Hello World!']) + ]); + + $multi_channel_message_request = new MultiChannelMessageRequest([ + 'to' => self::$user_number, + 'tag' => 'tag', + 'priority' => PriorityEnum::HIGH, + 'expiration' => self::$expiration, + 'channel_list' => [$channel_list_object] + ]); + + [$data, $status_code] = self::$apiInstance->createMultiChannelMessageWithHttpInfo( + self::$account_id, + $multi_channel_message_request + ); + + $this->assertEquals(202, $status_code); + $this->assertInstanceOf(CreateMultiChannelMessageResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertInstanceOf(MultiChannelMessageResponseData::class, $data->getData()); + $this->assertIsString($data->getData()->getId()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getTime()); + $this->assertInstanceOf(MessageDirectionEnum::class, $data->getData()->getDirection()); + $this->assertIsArray($data->getData()->getTo()); + $this->assertIsString($data->getData()->getTag()); + $this->assertInstanceOf(PriorityEnum::class, $data->getData()->getPriority()); + $this->assertInstanceOf(\DateTime::class, $data->getData()->getExpiration()); + $this->assertIsArray($data->getData()->getChannelList()); + } +} diff --git a/tests/Unit/Api/PhoneNumberLookupApiTest.php b/tests/Unit/Api/PhoneNumberLookupApiTest.php new file mode 100644 index 0000000..329b38d --- /dev/null +++ b/tests/Unit/Api/PhoneNumberLookupApiTest.php @@ -0,0 +1,209 @@ +setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new PhoneNumberLookupApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + } + + /** + * Test case for createAsyncBulkLookup + * + * Create Asynchronous Bulk Number Lookup. + * + */ + public function testCreateAsyncBulkLookup() + { + $async_lookup_request = new AsyncLookupRequest([ + 'phone_numbers' => self::$phone_numbers + ]); + + [$data, $status_code] = self::$apiInstance->createAsyncBulkLookupWithHttpInfo( + self::$account_id, + $async_lookup_request + ); + + $this->assertEquals(202, $status_code); + $this->assertInstanceOf(CreateAsyncBulkLookupResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertInstanceOf(LinkSchema::class, $data->getLinks()[0]); + $this->assertIsString($data->getLinks()[0]->getRel()); + $this->assertIsString($data->getLinks()[0]->getHref()); + $this->assertIsString($data->getLinks()[0]->getMethod()); + $this->assertInstanceOf(CreateAsyncBulkLookupResponseData::class, $data->getData()); + $this->assertIsString($data->getData()->getRequestId()); + $this->assertInstanceOf(InProgressLookupStatusEnum::class, $data->getData()->getStatus()); + $this->assertEquals(InProgressLookupStatusEnum::IN_PROGRESS, $data->getData()->getStatus()); + $this->assertIsArray($data->getErrors()); + } + + /** + * Test case for createSyncLookup + * + * Create Synchronous Number Lookup. + * + */ + public function testCreateSyncLookup() + { + $sync_lookup_request = new SyncLookupRequest([ + 'phone_numbers' => self::$phone_numbers, + 'rcs_agent' => 'TestAgent' + ]); + + [$data, $status_code] = self::$apiInstance->createSyncLookupWithHttpInfo( + self::$account_id, + $sync_lookup_request + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(CreateSyncLookupResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertInstanceOf(CreateSyncLookupResponseData::class, $data->getData()); + $this->assertIsString($data->getData()->getRequestId()); + $this->assertInstanceOf(CompletedLookupStatusEnum::class, $data->getData()->getStatus()); + $this->assertEquals(CompletedLookupStatusEnum::COMPLETE, $data->getData()->getStatus()); + $this->assertIsArray($data->getData()->getResults()); + $this->assertInstanceOf(LookupResult::class, $data->getData()->getResults()[0]); + $this->assertIsString($data->getData()->getResults()[0]->getPhoneNumber()); + $this->assertInstanceOf(LineTypeEnum::class, $data->getData()->getResults()[0]->getLineType()); + $this->assertIsString($data->getData()->getResults()[0]->getMessagingProvider()); + $this->assertIsString($data->getData()->getResults()[0]->getVoiceProvider()); + $this->assertIsString($data->getData()->getResults()[0]->getCountryCodeA3()); + $this->assertInstanceOf( + LatestMessageDeliveryStatusEnum::class, + $data->getData()->getResults()[0]->getLatestMessageDeliveryStatus() + ); + $this->assertEquals( + LatestMessageDeliveryStatusEnum::ACTIVE, + $data->getData()->getResults()[0]->getLatestMessageDeliveryStatus() + ); + $this->assertInstanceOf( + \DateTime::class, + $data->getData()->getResults()[0]->getInitialMessageDeliveryStatusDate() + ); + $this->assertInstanceOf( + \DateTime::class, + $data->getData()->getResults()[0]->getLatestMessageDeliveryStatusDate() + ); + $this->assertIsArray($data->getErrors()); + } + + /** + * Test case for getAsyncBulkLookup + * + * Get Asynchronous Bulk Number Lookup. + * + */ + public function testGetAsyncBulkLookup() + { + [$data, $status_code] = self::$apiInstance->getAsyncBulkLookupWithHttpInfo( + self::$account_id, + self::$request_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(GetAsyncBulkLookupResponse::class, $data); + $this->assertIsArray($data->getLinks()); + $this->assertInstanceOf(GetAsyncBulkLookupResponseData::class, $data->getData()); + $this->assertIsString($data->getData()->getRequestId()); + $this->assertInstanceOf(InProgressLookupStatusEnum::class, $data->getData()->getStatus()); + $this->assertEquals(InProgressLookupStatusEnum::COMPLETE, $data->getData()->getStatus()); + $this->assertIsArray($data->getData()->getResults()); + $this->assertInstanceOf(LookupResult::class, $data->getData()->getResults()[0]); + $this->assertIsString($data->getData()->getResults()[0]->getPhoneNumber()); + $this->assertInstanceOf(LineTypeEnum::class, $data->getData()->getResults()[0]->getLineType()); + $this->assertIsString($data->getData()->getResults()[0]->getMessagingProvider()); + $this->assertIsString($data->getData()->getResults()[0]->getVoiceProvider()); + $this->assertIsString($data->getData()->getResults()[0]->getCountryCodeA3()); + $this->assertInstanceOf( + LatestMessageDeliveryStatusEnum::class, + $data->getData()->getResults()[0]->getLatestMessageDeliveryStatus() + ); + $this->assertEquals( + LatestMessageDeliveryStatusEnum::ACTIVE, + $data->getData()->getResults()[0]->getLatestMessageDeliveryStatus() + ); + $this->assertInstanceOf( + \DateTime::class, + $data->getData()->getResults()[0]->getInitialMessageDeliveryStatusDate() + ); + $this->assertInstanceOf( + \DateTime::class, + $data->getData()->getResults()[0]->getLatestMessageDeliveryStatusDate() + ); + $this->assertIsArray($data->getErrors()); + } +} diff --git a/tests/Unit/Api/RecordingsApiTest.php b/tests/Unit/Api/RecordingsApiTest.php new file mode 100644 index 0000000..f032191 --- /dev/null +++ b/tests/Unit/Api/RecordingsApiTest.php @@ -0,0 +1,342 @@ +setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new RecordingsApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + } + + /** + * Test case for deleteRecording + * + * Delete Recording. + * + */ + public function testDeleteRecording() + { + [, $status_code] = self::$apiInstance->deleteRecordingWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for deleteRecordingMedia + * + * Delete Recording Media. + * + */ + public function testDeleteRecordingMedia() + { + [, $status_code] = self::$apiInstance->deleteRecordingMediaWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for deleteRecordingTranscription + * + * Delete Transcription. + * + */ + public function testDeleteRecordingTranscription() + { + [, $status_code] = self::$apiInstance->deleteRecordingTranscriptionWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for downloadCallRecording + * + * Download Recording. + * + */ + public function testDownloadCallRecording() + { + self::markTestSkipped("Can't set the correct Accept header for Prism"); + + [$data, $status_code] = self::$apiInstance->downloadCallRecordingWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id + ); + + $this->assertEquals(204, $status_code); + $this->assertInstanceOf(SplFileObject::class, $data); + } + + /** + * Test case for getCallRecording + * + * Get Call Recording. + * + */ + public function testGetCallRecording() + { + self::markTestSkipped('Prism Error'); + + [$data, $status_code] = self::$apiInstance->getCallRecordingWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(CallRecordingMetadata::class, $data); + $this->assertEquals(36, \strlen($data->getApplicationId())); + $this->assertEquals(7, \strlen($data->getAccountId())); + $this->assertEquals(47, \strlen($data->getCallId())); + $this->assertEquals(47, \strlen($data->getParentCallId())); + $this->assertEquals(47, \strlen($data->getRecordingId())); + $this->assertEquals(12, \strlen($data->getTo())); + $this->assertEquals(12, \strlen($data->getFrom())); + $this->assertEquals(12, \strlen($data->getTransferCallerId())); + $this->assertEquals(12, \strlen($data->getTransferTo())); + $this->assertIsString($data->getDuration()); + $this->assertInstanceOf(CallDirectionEnum::class, $data->getDirection()); + $this->assertIsInt($data->getChannels()); + $this->assertInstanceOf(\DateTime::class, $data->getStartTime()); + $this->assertInstanceOf(\DateTime::class, $data->getEndTime()); + $this->assertInstanceOf(FileFormatEnum::class, $data->getFileFormat()); + $this->assertIsString($data->getStatus()); + $this->assertIsString($data->getMediaUrl()); + $this->assertInstanceOf(RecordingTranscriptionMetadata::class, $data->getTranscription()); + $this->assertEquals(38, \strlen($data->getTranscription()->getId())); + $this->assertIsString($data->getTranscription()->getStatus()); + $this->assertInstanceOf(\DateTime::class, $data->getTranscription()->getCompletedTime()); + $this->assertIsString($data->getTranscription()->getUrl()); + $this->assertIsString($data->getRecordingName()); + } + + /** + * Test case for getRecordingTranscription + * + * Get Transcription. + * + */ + public function testGetRecordingTranscription() + { + [$data, $status_code] = self::$apiInstance->getRecordingTranscriptionWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(RecordingTranscriptions::class, $data); + $this->assertIsArray($data->getTranscripts()); + $this->assertInstanceOf(Transcription::class, $data->getTranscripts()[0]); + $this->assertIsInt($data->getTranscripts()[0]->getSpeaker()); + $this->assertIsString($data->getTranscripts()[0]->getText()); + $this->assertIsFloat($data->getTranscripts()[0]->getConfidence()); + $this->assertIsArray($data->getClips()); + $this->assertInstanceOf(RecordingTranscriptionClip::class, $data->getClips()[0]); + $this->assertIsInt($data->getClips()[0]->getSpeaker()); + $this->assertIsString($data->getClips()[0]->getText()); + $this->assertIsFloat($data->getClips()[0]->getConfidence()); + $this->assertIsFloat($data->getClips()[0]->getStartTimeSeconds()); + $this->assertIsFloat($data->getClips()[0]->getEndTimeSeconds()); + } + + /** + * Test case for listAccountCallRecordings + * + * Get Call Recordings For Account. + * + */ + public function testListAccountCallRecordings() + { + [$data, $status_code] = self::$apiInstance->listAccountCallRecordingsWithHttpInfo( + self::$account_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(CallRecordingMetadata::class, $data[0]); + $this->assertEquals(36, \strlen($data[0]->getApplicationId())); + $this->assertEquals(7, \strlen($data[0]->getAccountId())); + $this->assertEquals(47, \strlen($data[0]->getCallId())); + $this->assertEquals(47, \strlen($data[0]->getParentCallId())); + $this->assertEquals(47, \strlen($data[0]->getRecordingId())); + $this->assertEquals(12, \strlen($data[0]->getTo())); + $this->assertEquals(12, \strlen($data[0]->getFrom())); + $this->assertEquals(12, \strlen($data[0]->getTransferCallerId())); + $this->assertEquals(12, \strlen($data[0]->getTransferTo())); + $this->assertIsString($data[0]->getDuration()); + $this->assertInstanceOf(CallDirectionEnum::class, $data[0]->getDirection()); + $this->assertIsInt($data[0]->getChannels()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getStartTime()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getEndTime()); + $this->assertInstanceOf(FileFormatEnum::class, $data[0]->getFileFormat()); + $this->assertIsString($data[0]->getStatus()); + $this->assertIsString($data[0]->getMediaUrl()); + $this->assertInstanceOf(RecordingTranscriptionMetadata::class, $data[0]->getTranscription()); + $this->assertEquals(38, \strlen($data[0]->getTranscription()->getId())); + $this->assertIsString($data[0]->getTranscription()->getStatus()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getTranscription()->getCompletedTime()); + $this->assertIsString($data[0]->getTranscription()->getUrl()); + $this->assertIsString($data[0]->getRecordingName()); + } + + /** + * Test case for listCallRecordings + * + * List Call Recordings. + * + */ + public function testListCallRecordings() + { + [$data, $status_code] = self::$apiInstance->listCallRecordingsWithHttpInfo( + self::$account_id, + self::$call_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(CallRecordingMetadata::class, $data[0]); + $this->assertEquals(36, \strlen($data[0]->getApplicationId())); + $this->assertEquals(7, \strlen($data[0]->getAccountId())); + $this->assertEquals(47, \strlen($data[0]->getCallId())); + $this->assertEquals(47, \strlen($data[0]->getParentCallId())); + $this->assertEquals(47, \strlen($data[0]->getRecordingId())); + $this->assertEquals(12, \strlen($data[0]->getTo())); + $this->assertEquals(12, \strlen($data[0]->getFrom())); + $this->assertEquals(12, \strlen($data[0]->getTransferCallerId())); + $this->assertEquals(12, \strlen($data[0]->getTransferTo())); + $this->assertIsString($data[0]->getDuration()); + $this->assertInstanceOf(CallDirectionEnum::class, $data[0]->getDirection()); + $this->assertIsInt($data[0]->getChannels()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getStartTime()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getEndTime()); + $this->assertInstanceOf(FileFormatEnum::class, $data[0]->getFileFormat()); + $this->assertIsString($data[0]->getStatus()); + $this->assertIsString($data[0]->getMediaUrl()); + $this->assertInstanceOf(RecordingTranscriptionMetadata::class, $data[0]->getTranscription()); + $this->assertEquals(38, \strlen($data[0]->getTranscription()->getId())); + $this->assertIsString($data[0]->getTranscription()->getStatus()); + $this->assertInstanceOf(\DateTime::class, $data[0]->getTranscription()->getCompletedTime()); + $this->assertIsString($data[0]->getTranscription()->getUrl()); + $this->assertIsString($data[0]->getRecordingName()); + } + + /** + * Test case for transcribeCallRecording + * + * Create Transcription Request. + * + */ + public function testTranscribeCallRecording() + { + $transcribe_recording = new TranscribeRecording([ + 'callback_url' => 'https://myServer.example/bandwidth/webhooks/transcriptionAvailable' + ]); + + [, $status_code] = self::$apiInstance->transcribeCallRecordingWithHttpInfo( + self::$account_id, + self::$call_id, + self::$recording_id, + $transcribe_recording + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for updateCallRecordingState + * + * Update Recording. + * + */ + public function testUpdateCallRecordingState() + { + $update_call_recording = new UpdateCallRecording([ + 'state' => RecordingStateEnum::PAUSED + ]); + + [, $status_code] = self::$apiInstance->updateCallRecordingStateWithHttpInfo( + self::$account_id, + self::$call_id, + $update_call_recording + ); + + $this->assertEquals(200, $status_code); + } +} diff --git a/tests/Unit/Api/StatisticsApiTest.php b/tests/Unit/Api/StatisticsApiTest.php new file mode 100644 index 0000000..a606274 --- /dev/null +++ b/tests/Unit/Api/StatisticsApiTest.php @@ -0,0 +1,81 @@ +setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new StatisticsApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + } + + /** + * Test case for getStatistics + * + * Get Account Statistics. + * + */ + public function testGetStatistics() + { + [$data, $status_code] = self::$apiInstance->getStatisticsWithHttpInfo( + self::$account_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(AccountStatistics::class, $data); + $this->assertIsInt($data->getCurrentCallQueueSize()); + $this->assertIsInt($data->getMaxCallQueueSize()); + } +} diff --git a/tests/Unit/Api/TollFreeVerificationApiTest.php b/tests/Unit/Api/TollFreeVerificationApiTest.php new file mode 100644 index 0000000..4cd6e05 --- /dev/null +++ b/tests/Unit/Api/TollFreeVerificationApiTest.php @@ -0,0 +1,338 @@ +setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new TollFreeVerificationApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + + self::$webhook_subscription_request_schema = new WebhookSubscriptionRequestSchema([ + 'basic_authentication' => new TfvBasicAuthentication([ + 'username' => 'username', + 'password' => 'password' + ]), + 'callback_url' => 'https://example.com', + 'shared_secret_key' => 'shared-secret-key' + ]); + } + + /** + * Test case for createWebhookSubscription + * + * Create Webhook Subscription. + * + */ + public function testCreateWebhookSubscription() + { + [$data, $status_code] = self::$apiInstance->createWebhookSubscriptionWithHttpInfo( + self::$account_id, + self::$webhook_subscription_request_schema + ); + + $this->assertEquals(201, $status_code); + $this->assertInstanceOf(WebhookSubscription::class, $data); + $this->assertIsString($data->getId()); + $this->assertIsString($data->getAccountId()); + $this->assertIsString($data->getCallbackUrl()); + $this->assertInstanceOf(WebhookSubscriptionTypeEnum::class, $data->getType()); + $this->assertInstanceOf(WebhookSubscriptionBasicAuthentication::class, $data->getBasicAuthentication()); + $this->assertIsString($data->getBasicAuthentication()->getUsername()); + $this->assertIsString($data->getBasicAuthentication()->getPassword()); + $this->assertInstanceOf(\DateTime::class, $data->getCreatedDate()); + $this->assertInstanceOf(\DateTime::class, $data->getModifiedDate()); + } + + /** + * Test case for deleteVerificationRequest + * + * Delete Verification Request. + * + */ + public function testDeleteVerificationRequest() + { + [, $status_code] = self::$apiInstance->deleteVerificationRequestWithHttpInfo( + self::$account_id, + self::$phone_number + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for deleteWebhookSubscription + * + * Delete Webhook Subscription. + * + */ + public function testDeleteWebhookSubscription() + { + [, $status_code] = self::$apiInstance->deleteWebhookSubscriptionWithHttpInfo( + self::$account_id, + self::$subscription_id + ); + + $this->assertEquals(204, $status_code); + } + + /** + * Test case for getTollFreeVerificationStatus + * + * Get Toll-Free Verification Status. + * + */ + public function testGetTollFreeVerificationStatus() + { + [$data, $status_code] = self::$apiInstance->getTollFreeVerificationStatusWithHttpInfo( + self::$account_id, + self::$phone_number + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(TfvStatus::class, $data); + $this->assertIsString($data->getPhoneNumber()); + $this->assertInstanceOf(TfvStatusEnum::class, $data->getStatus()); + $this->assertIsString($data->getInternalTicketNumber()); + $this->assertIsString($data->getDeclineReasonDescription()); + $this->assertIsBool($data->getResubmitAllowed()); + $this->assertInstanceOf(\DateTime::class, $data->getCreatedDateTime()); + $this->assertInstanceOf(\DateTime::class, $data->getModifiedDateTime()); + $this->assertInstanceOf(TfvSubmissionInfo::class, $data->getSubmission()); + $this->assertIsBool($data->getBlocked()); + $this->assertIsString($data->getBlockedReason()); + $this->assertIsString($data->getCvToken()); + } + + /** + * Test case for listTollFreeUseCases + * + * Retrieve Toll-Free Use Cases. + * + */ + public function testListTollFreeUseCases() + { + [$data, $status_code] = self::$apiInstance->listTollFreeUseCasesWithHttpInfo(); + + $this->assertEquals(200, $status_code); + $this->assertIsArray($data); + } + + /** + * Test case for listWebhookSubscriptions + * + * List Webhook Subscriptions. + * + */ + public function testListWebhookSubscriptions() + { + [$data, $status_code] = self::$apiInstance->listWebhookSubscriptionsWithHttpInfo( + self::$account_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(WebhookSubscriptionsListBody::class, $data); + $this->assertInstanceOf(LinksObject::class, $data->getLinks()); + $this->assertIsString($data->getLinks()->getFirst()); + $this->assertIsString($data->getLinks()->getNext()); + $this->assertIsString($data->getLinks()->getPrevious()); + $this->assertIsString($data->getLinks()->getLast()); + $this->assertIsArray($data->getErrors()); + $this->assertIsInt($data->getErrors()[0]->getCode()); + $this->assertIsString($data->getErrors()[0]->getDescription()); + $this->assertIsArray($data->getErrors()[0]->getTelephoneNumbers()); + $this->assertInstanceOf(TelephoneNumber::class, $data->getErrors()[0]->getTelephoneNumbers()[0]); + $this->assertIsString($data->getErrors()[0]->getTelephoneNumbers()[0]->getTelephoneNumber()); + $this->assertIsArray($data->getData()); + $this->assertInstanceOf(WebhookSubscription::class, $data->getData()[0]); + $this->assertIsString($data->getData()[0]->getId()); + $this->assertIsString($data->getData()[0]->getAccountId()); + $this->assertIsString($data->getData()[0]->getCallbackUrl()); + $this->assertInstanceOf(WebhookSubscriptionTypeEnum::class, $data->getData()[0]->getType()); + $this->assertInstanceOf( + WebhookSubscriptionBasicAuthentication::class, + $data->getData()[0]->getBasicAuthentication() + ); + $this->assertIsString($data->getData()[0]->getBasicAuthentication()->getUsername()); + $this->assertIsString($data->getData()[0]->getBasicAuthentication()->getPassword()); + $this->assertInstanceOf(\DateTime::class, $data->getData()[0]->getCreatedDate()); + $this->assertInstanceOf(\DateTime::class, $data->getData()[0]->getModifiedDate()); + } + + /** + * Test case for requestTollFreeVerification + * + * Request Toll-Free Verification. + * + */ + public function testRequestTollFreeVerification() + { + $verification_request = new VerificationRequest([ + 'business_address' => new Address([ + 'name' => 'name', + 'addr1' => 'addr1', + 'addr2' => 'addr2', + 'city' => 'city', + 'state' => 'state', + 'zip' => 'zip', + 'url' => 'https://example.com' + ]), + 'business_contact' => new Contact([ + 'first_name' => 'first-name', + 'last_name' => 'last-name', + 'email' => 'email@email.com', + 'phone_number' => '+19195551234' + ]), + 'message_volume' => 12, + 'phone_numbers' => [self::$phone_number], + 'use_case' => 'useCase', + 'use_case_summary' => 'useCaseSummary', + 'production_message_content' => 'productionMessageContent', + 'opt_in_workflow' => new OptInWorkflow([ + 'description' => 'description', + 'image_urls' => ['https://example.com'], + 'confirmation_response' => 'confirmationResponse' + ]), + 'additional_information' => 'additionalInformation', + 'isv_reseller' => 'isvReseller', + 'privacy_policy_url' => 'privacyPolicyUrl', + 'terms_and_conditions_url' => 'termsAndConditionsUrl', + 'business_dba' => 'businessDba', + 'business_registration_number' => 'businessRegistrationNumber', + 'business_registration_type' => BusinessRegistrationTypeEnum::EIN, + 'business_entity_type' => BusinessEntityTypeEnum::PRIVATE_PROFIT, + 'business_registration_issuing_country' => 'USA', + 'help_message_response' => 'helpMessageResponse', + 'age_gated_content' => true, + 'cv_token' => 'cvToken' + ]); + + [, $status_code] = self::$apiInstance->requestTollFreeVerificationWithHttpInfo( + self::$account_id, + $verification_request + ); + + $this->assertEquals(202, $status_code); + } + + /** + * Test case for updateTollFreeVerificationRequest + * + * Update Toll-Free Verification Request. + * + */ + public function testUpdateTollFreeVerificationRequest() + { + $tfv_submission_wrapper = new TfvSubmissionWrapper([ + 'submission' => null + ]); + + [, $status_code] = self::$apiInstance->updateTollFreeVerificationRequestWithHttpInfo( + self::$account_id, + self::$phone_number, + $tfv_submission_wrapper + ); + + $this->assertEquals(202, $status_code); + } + + /** + * Test case for updateWebhookSubscription + * + * Replace Webhook Subscription. + * + */ + public function testUpdateWebhookSubscription() + { + [$data, $status_code] = self::$apiInstance->updateWebhookSubscriptionWithHttpInfo( + self::$account_id, + self::$subscription_id, + self::$webhook_subscription_request_schema + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(WebhookSubscription::class, $data); + $this->assertIsString($data->getId()); + $this->assertIsString($data->getAccountId()); + $this->assertIsString($data->getCallbackUrl()); + $this->assertInstanceOf(WebhookSubscriptionTypeEnum::class, $data->getType()); + $this->assertInstanceOf(WebhookSubscriptionBasicAuthentication::class, $data->getBasicAuthentication()); + $this->assertIsString($data->getBasicAuthentication()->getUsername()); + $this->assertIsString($data->getBasicAuthentication()->getPassword()); + $this->assertInstanceOf(\DateTime::class, $data->getCreatedDate()); + $this->assertInstanceOf(\DateTime::class, $data->getModifiedDate()); + } +} diff --git a/tests/Unit/Api/TranscriptionsApiTest.php b/tests/Unit/Api/TranscriptionsApiTest.php new file mode 100644 index 0000000..c184309 --- /dev/null +++ b/tests/Unit/Api/TranscriptionsApiTest.php @@ -0,0 +1,138 @@ +setAccessToken("abcd1234") + ->setIgnoreOperationHosts(true) + ->setHost("http://127.0.0.1:4010"); + + self::$apiInstance = new TranscriptionsApi(config: $config); + + self::$account_id = getenv("BW_ACCOUNT_ID"); + } + + /** + * Test case for deleteRealTimeTranscription + * + * Delete a specific transcription. + * + */ + public function testDeleteRealTimeTranscription() + { + [, $status_code] = self::$apiInstance->deleteRealTimeTranscriptionWithHttpInfo( + self::$account_id, + self::$call_id, + self::$transcription_id + ); + + // The API returns 200 instead of 204; VAPI-1863 should fix this + $this->assertEquals(200, $status_code); + } + + /** + * Test case for getRealTimeTranscription + * + * Retrieve a specific transcription. + * + */ + public function testGetRealTimeTranscription() + { + [$data, $status_code] = self::$apiInstance->getRealTimeTranscriptionWithHttpInfo( + self::$account_id, + self::$call_id, + self::$transcription_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(CallTranscriptionResponse::class, $data); + $this->assertEquals(7, \strlen($data->getAccountId())); + $this->assertEquals(47, \strlen($data->getCallId())); + $this->assertIsString($data->getTranscriptionId()); + $this->assertIsArray($data->getTracks()); + $this->assertInstanceOf(CallTranscription::class, $data->getTracks()[0]); + $this->assertInstanceOf( + CallTranscriptionDetectedLanguageEnum::class, + $data->getTracks()[0]->getDetectedLanguage() + ); + $this->assertInstanceOf(CallTranscriptionTrackEnum::class, $data->getTracks()[0]->getTrack()); + $this->assertIsString($data->getTracks()[0]->getTranscript()); + $this->assertIsFloat($data->getTracks()[0]->getConfidence()); + } + + /** + * Test case for listRealTimeTranscriptions + * + * Get a list of transcriptions. + * + */ + public function testListRealTimeTranscriptions() + { + [$data, $status_code] = self::$apiInstance->listRealTimeTranscriptionsWithHttpInfo( + self::$account_id, + self::$call_id + ); + + $this->assertEquals(200, $status_code); + $this->assertInstanceOf(CallTranscriptionMetadata::class, $data[0]); + $this->assertIsString($data[0]->getTranscriptionId()); + $this->assertIsString($data[0]->getTranscriptionUrl()); + $this->assertIsString($data[0]->getTranscriptionName()); + } +} diff --git a/tests/Unit/Model/AccountStatisticsTest.php b/tests/Unit/Model/AccountStatisticsTest.php new file mode 100644 index 0000000..e4505bf --- /dev/null +++ b/tests/Unit/Model/AccountStatisticsTest.php @@ -0,0 +1,83 @@ + 10, + 'max_call_queue_size' => 100 + ]); + } + + /** + * Test "AccountStatistics" + */ + public function testAccountStatistics() + { + $this->assertInstanceOf(AccountStatistics::class, self::$instance); + } + + /** + * Test attribute "current_call_queue_size" + */ + public function testPropertyCurrentCallQueueSize() + { + $this->assertIsInt(self::$instance->getCurrentCallQueueSize()); + $this->assertEquals(10, self::$instance->getCurrentCallQueueSize()); + } + + /** + * Test attribute "max_call_queue_size" + */ + public function testPropertyMaxCallQueueSize() + { + $this->assertIsInt(self::$instance->getMaxCallQueueSize()); + $this->assertEquals(100, self::$instance->getMaxCallQueueSize()); + } +} diff --git a/tests/Unit/Model/AdditionalDenialReasonTest.php b/tests/Unit/Model/AdditionalDenialReasonTest.php new file mode 100644 index 0000000..f77259e --- /dev/null +++ b/tests/Unit/Model/AdditionalDenialReasonTest.php @@ -0,0 +1,92 @@ + 1, + 'reason' => 'test_string', + 'resubmit_allowed' => true + ]); + } + + /** + * Test "AdditionalDenialReason" + */ + public function testAdditionalDenialReason() + { + $this->assertInstanceOf(AdditionalDenialReason::class, self::$instance); + } + + /** + * Test attribute "status_code" + */ + public function testPropertyStatusCode() + { + $this->assertIsInt(self::$instance->getStatusCode()); + $this->assertEquals(1, self::$instance->getStatusCode()); + } + + /** + * Test attribute "reason" + */ + public function testPropertyReason() + { + $this->assertIsString(self::$instance->getReason()); + $this->assertEquals('test_string', self::$instance->getReason()); + } + + /** + * Test attribute "resubmit_allowed" + */ + public function testPropertyResubmitAllowed() + { + $this->assertIsBool(self::$instance->getResubmitAllowed()); + $this->assertTrue(self::$instance->getResubmitAllowed()); + }} diff --git a/tests/Unit/Model/AddressTest.php b/tests/Unit/Model/AddressTest.php new file mode 100644 index 0000000..63ccd3d --- /dev/null +++ b/tests/Unit/Model/AddressTest.php @@ -0,0 +1,132 @@ + 'test_string', + 'addr1' => 'test_string', + 'addr2' => 'test_string', + 'city' => 'test_string', + 'state' => 'test_string', + 'zip' => 'test_string', + 'url' => 'test_string' + ]); + } + + /** + * Test "Address" + */ + public function testAddress() + { + $this->assertInstanceOf(Address::class, self::$instance); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + $this->assertIsString(self::$instance->getName()); + $this->assertEquals('test_string', self::$instance->getName()); + } + + /** + * Test attribute "addr1" + */ + public function testPropertyAddr1() + { + $this->assertIsString(self::$instance->getAddr1()); + $this->assertEquals('test_string', self::$instance->getAddr1()); + } + + /** + * Test attribute "addr2" + */ + public function testPropertyAddr2() + { + $this->assertIsString(self::$instance->getAddr2()); + $this->assertEquals('test_string', self::$instance->getAddr2()); + } + + /** + * Test attribute "city" + */ + public function testPropertyCity() + { + $this->assertIsString(self::$instance->getCity()); + $this->assertEquals('test_string', self::$instance->getCity()); + } + + /** + * Test attribute "state" + */ + public function testPropertyState() + { + $this->assertIsString(self::$instance->getState()); + $this->assertEquals('test_string', self::$instance->getState()); + } + + /** + * Test attribute "zip" + */ + public function testPropertyZip() + { + $this->assertIsString(self::$instance->getZip()); + $this->assertEquals('test_string', self::$instance->getZip()); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + $this->assertIsString(self::$instance->getUrl()); + $this->assertEquals('test_string', self::$instance->getUrl()); + }} diff --git a/tests/Unit/Model/AnswerCallbackTest.php b/tests/Unit/Model/AnswerCallbackTest.php new file mode 100644 index 0000000..cd6bb6f --- /dev/null +++ b/tests/Unit/Model/AnswerCallbackTest.php @@ -0,0 +1,203 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string', + 'machine_detection_result' => new MachineDetectionResult([]) + ]); + } + + /** + * Test "AnswerCallback" + */ + public function testAnswerCallback() + { + $this->assertInstanceOf(AnswerCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "machine_detection_result" + */ + public function testPropertyMachineDetectionResult() + { + $this->assertInstanceOf(MachineDetectionResult::class, self::$instance->getMachineDetectionResult()); + }} diff --git a/tests/Unit/Model/AsyncLookupRequestTest.php b/tests/Unit/Model/AsyncLookupRequestTest.php new file mode 100644 index 0000000..622d61b --- /dev/null +++ b/tests/Unit/Model/AsyncLookupRequestTest.php @@ -0,0 +1,72 @@ + ['test_string'] + ]); + } + + /** + * Test "AsyncLookupRequest" + */ + public function testAsyncLookupRequest() + { + $this->assertInstanceOf(AsyncLookupRequest::class, self::$instance); + } + + /** + * Test attribute "phone_numbers" + */ + public function testPropertyPhoneNumbers() + { + $this->assertIsArray(self::$instance->getPhoneNumbers()); + $this->assertEquals(['test_string'], self::$instance->getPhoneNumbers()); + }} diff --git a/tests/Unit/Model/BlockedWebhookTest.php b/tests/Unit/Model/BlockedWebhookTest.php new file mode 100644 index 0000000..2cf939a --- /dev/null +++ b/tests/Unit/Model/BlockedWebhookTest.php @@ -0,0 +1,123 @@ + 'test_string', + 'phone_number' => 'test_string', + 'status' => TfvCallbackStatusEnum::VERIFIED, + 'internal_ticket_number' => 'test_string', + 'blocked' => true, + 'blocked_reason' => 'test_string' + ]); + } + + /** + * Test "BlockedWebhook" + */ + public function testBlockedWebhook() + { + $this->assertInstanceOf(BlockedWebhook::class, self::$instance); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + $this->assertIsString(self::$instance->getPhoneNumber()); + $this->assertEquals('test_string', self::$instance->getPhoneNumber()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(TfvCallbackStatusEnum::class, self::$instance->getStatus()); + $this->assertSame(TfvCallbackStatusEnum::VERIFIED, self::$instance->getStatus()); + } + + /** + * Test attribute "internal_ticket_number" + */ + public function testPropertyInternalTicketNumber() + { + $this->assertIsString(self::$instance->getInternalTicketNumber()); + $this->assertEquals('test_string', self::$instance->getInternalTicketNumber()); + } + + /** + * Test attribute "blocked" + */ + public function testPropertyBlocked() + { + $this->assertIsBool(self::$instance->getBlocked()); + $this->assertTrue(self::$instance->getBlocked()); + } + + /** + * Test attribute "blocked_reason" + */ + public function testPropertyBlockedReason() + { + $this->assertIsString(self::$instance->getBlockedReason()); + $this->assertEquals('test_string', self::$instance->getBlockedReason()); + }} diff --git a/tests/Unit/Model/BridgeCompleteCallbackTest.php b/tests/Unit/Model/BridgeCompleteCallbackTest.php new file mode 100644 index 0000000..37e1ac5 --- /dev/null +++ b/tests/Unit/Model/BridgeCompleteCallbackTest.php @@ -0,0 +1,223 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string', + 'cause' => 'test_string', + 'error_message' => 'test_string', + 'error_id' => 'test_string' + ]); + } + + /** + * Test "BridgeCompleteCallback" + */ + public function testBridgeCompleteCallback() + { + $this->assertInstanceOf(BridgeCompleteCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "cause" + */ + public function testPropertyCause() + { + $this->assertIsString(self::$instance->getCause()); + $this->assertEquals('test_string', self::$instance->getCause()); + } + + /** + * Test attribute "error_message" + */ + public function testPropertyErrorMessage() + { + $this->assertIsString(self::$instance->getErrorMessage()); + $this->assertEquals('test_string', self::$instance->getErrorMessage()); + } + + /** + * Test attribute "error_id" + */ + public function testPropertyErrorId() + { + $this->assertIsString(self::$instance->getErrorId()); + $this->assertEquals('test_string', self::$instance->getErrorId()); + }} diff --git a/tests/Unit/Model/BridgeTargetCompleteCallbackTest.php b/tests/Unit/Model/BridgeTargetCompleteCallbackTest.php new file mode 100644 index 0000000..046b77d --- /dev/null +++ b/tests/Unit/Model/BridgeTargetCompleteCallbackTest.php @@ -0,0 +1,193 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string' + ]); + } + + /** + * Test "BridgeTargetCompleteCallback" + */ + public function testBridgeTargetCompleteCallback() + { + $this->assertInstanceOf(BridgeTargetCompleteCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/BrtcErrorResponseTest.php b/tests/Unit/Model/BrtcErrorResponseTest.php new file mode 100644 index 0000000..8719a70 --- /dev/null +++ b/tests/Unit/Model/BrtcErrorResponseTest.php @@ -0,0 +1,94 @@ + [new BrtcLink([])], + 'data' => (object) ['key' => 'value'], + 'errors' => [new BrtcError([])] + ]); + } + + /** + * Test "BrtcErrorResponse" + */ + public function testBrtcErrorResponse() + { + $this->assertInstanceOf(BrtcErrorResponse::class, self::$instance); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + $this->assertIsArray(self::$instance->getLinks()); + $this->assertInstanceOf(BrtcLink::class, self::$instance->getLinks()[0]); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + $this->assertIsObject(self::$instance->getData()); + $this->assertEquals((object) ['key' => 'value'], self::$instance->getData()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertInstanceOf(BrtcError::class, self::$instance->getErrors()[0]); + }} diff --git a/tests/Unit/Model/BrtcErrorSourceTest.php b/tests/Unit/Model/BrtcErrorSourceTest.php new file mode 100644 index 0000000..d1c6811 --- /dev/null +++ b/tests/Unit/Model/BrtcErrorSourceTest.php @@ -0,0 +1,102 @@ + 'test_string', + 'field' => 'test_string', + 'header' => 'test_string', + 'reference' => 'test_string' + ]); + } + + /** + * Test "BrtcErrorSource" + */ + public function testBrtcErrorSource() + { + $this->assertInstanceOf(BrtcErrorSource::class, self::$instance); + } + + /** + * Test attribute "parameter" + */ + public function testPropertyParameter() + { + $this->assertIsString(self::$instance->getParameter()); + $this->assertEquals('test_string', self::$instance->getParameter()); + } + + /** + * Test attribute "field" + */ + public function testPropertyField() + { + $this->assertIsString(self::$instance->getField()); + $this->assertEquals('test_string', self::$instance->getField()); + } + + /** + * Test attribute "header" + */ + public function testPropertyHeader() + { + $this->assertIsString(self::$instance->getHeader()); + $this->assertEquals('test_string', self::$instance->getHeader()); + } + + /** + * Test attribute "reference" + */ + public function testPropertyReference() + { + $this->assertIsString(self::$instance->getReference()); + $this->assertEquals('test_string', self::$instance->getReference()); + }} diff --git a/tests/Unit/Model/BrtcErrorTest.php b/tests/Unit/Model/BrtcErrorTest.php new file mode 100644 index 0000000..a22c71e --- /dev/null +++ b/tests/Unit/Model/BrtcErrorTest.php @@ -0,0 +1,112 @@ + 'test_string', + 'type' => 'test_string', + 'description' => 'test_string', + 'code' => 'test_string', + 'source' => new BrtcErrorSource([]) + ]); + } + + /** + * Test "BrtcError" + */ + public function testBrtcError() + { + $this->assertInstanceOf(BrtcError::class, self::$instance); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + $this->assertIsString(self::$instance->getId()); + $this->assertEquals('test_string', self::$instance->getId()); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertIsString(self::$instance->getType()); + $this->assertEquals('test_string', self::$instance->getType()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + } + + /** + * Test attribute "code" + */ + public function testPropertyCode() + { + $this->assertIsString(self::$instance->getCode()); + $this->assertEquals('test_string', self::$instance->getCode()); + } + + /** + * Test attribute "source" + */ + public function testPropertySource() + { + $this->assertInstanceOf(BrtcErrorSource::class, self::$instance->getSource()); + }} diff --git a/tests/Unit/Model/BrtcLinkTest.php b/tests/Unit/Model/BrtcLinkTest.php new file mode 100644 index 0000000..87e8157 --- /dev/null +++ b/tests/Unit/Model/BrtcLinkTest.php @@ -0,0 +1,92 @@ + 'test_string', + 'rel' => 'test_string', + 'method' => 'test_string' + ]); + } + + /** + * Test "BrtcLink" + */ + public function testBrtcLink() + { + $this->assertInstanceOf(BrtcLink::class, self::$instance); + } + + /** + * Test attribute "href" + */ + public function testPropertyHref() + { + $this->assertIsString(self::$instance->getHref()); + $this->assertEquals('test_string', self::$instance->getHref()); + } + + /** + * Test attribute "rel" + */ + public function testPropertyRel() + { + $this->assertIsString(self::$instance->getRel()); + $this->assertEquals('test_string', self::$instance->getRel()); + } + + /** + * Test attribute "method" + */ + public function testPropertyMethod() + { + $this->assertIsString(self::$instance->getMethod()); + $this->assertEquals('test_string', self::$instance->getMethod()); + }} diff --git a/tests/Unit/Model/BusinessEntityTypeEnumTest.php b/tests/Unit/Model/BusinessEntityTypeEnumTest.php new file mode 100644 index 0000000..dce6803 --- /dev/null +++ b/tests/Unit/Model/BusinessEntityTypeEnumTest.php @@ -0,0 +1,55 @@ +assertSame( + ['SOLE_PROPRIETOR', 'PRIVATE_PROFIT', 'PUBLIC_PROFIT', 'NON_PROFIT', 'GOVERNMENT'], + array_column(BusinessEntityTypeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/BusinessRegistrationTypeEnumTest.php b/tests/Unit/Model/BusinessRegistrationTypeEnumTest.php new file mode 100644 index 0000000..7118eba --- /dev/null +++ b/tests/Unit/Model/BusinessRegistrationTypeEnumTest.php @@ -0,0 +1,75 @@ +assertSame( + [ + 'EIN', + 'CBN', + 'NEQ', + 'PROVINCIAL_NUMBER', + 'CRN', + 'VAT', + 'ACN', + 'ABN', + 'BRN', + 'SIREN', + 'SIRET', + 'NZBN', + 'UST_IDNR', + 'CIF', + 'NIF', + 'CNPJ', + 'UID', + 'OTHER' + ], + array_column(BusinessRegistrationTypeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/CallDirectionEnumTest.php b/tests/Unit/Model/CallDirectionEnumTest.php new file mode 100644 index 0000000..530cb65 --- /dev/null +++ b/tests/Unit/Model/CallDirectionEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['inbound', 'outbound'], + array_column(CallDirectionEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/CallRecordingMetadataTest.php b/tests/Unit/Model/CallRecordingMetadataTest.php new file mode 100644 index 0000000..be681a9 --- /dev/null +++ b/tests/Unit/Model/CallRecordingMetadataTest.php @@ -0,0 +1,254 @@ + 'test_string', + 'account_id' => 'test_string', + 'call_id' => 'test_string', + 'parent_call_id' => 'test_string', + 'recording_id' => 'test_string', + 'to' => 'test_string', + 'from' => 'test_string', + 'transfer_caller_id' => 'test_string', + 'transfer_to' => 'test_string', + 'duration' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'channels' => 1, + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'end_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'file_format' => FileFormatEnum::MP3, + 'status' => 'test_string', + 'media_url' => 'test_string', + 'transcription' => new RecordingTranscriptionMetadata([]), + 'recording_name' => 'test_string' + ]); + } + + /** + * Test "CallRecordingMetadata" + */ + public function testCallRecordingMetadata() + { + $this->assertInstanceOf(CallRecordingMetadata::class, self::$instance); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "parent_call_id" + */ + public function testPropertyParentCallId() + { + $this->assertIsString(self::$instance->getParentCallId()); + $this->assertEquals('test_string', self::$instance->getParentCallId()); + } + + /** + * Test attribute "recording_id" + */ + public function testPropertyRecordingId() + { + $this->assertIsString(self::$instance->getRecordingId()); + $this->assertEquals('test_string', self::$instance->getRecordingId()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "transfer_caller_id" + */ + public function testPropertyTransferCallerId() + { + $this->assertIsString(self::$instance->getTransferCallerId()); + $this->assertEquals('test_string', self::$instance->getTransferCallerId()); + } + + /** + * Test attribute "transfer_to" + */ + public function testPropertyTransferTo() + { + $this->assertIsString(self::$instance->getTransferTo()); + $this->assertEquals('test_string', self::$instance->getTransferTo()); + } + + /** + * Test attribute "duration" + */ + public function testPropertyDuration() + { + $this->assertIsString(self::$instance->getDuration()); + $this->assertEquals('test_string', self::$instance->getDuration()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "channels" + */ + public function testPropertyChannels() + { + $this->assertIsInt(self::$instance->getChannels()); + $this->assertEquals(1, self::$instance->getChannels()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "end_time" + */ + public function testPropertyEndTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEndTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEndTime()); + } + + /** + * Test attribute "file_format" + */ + public function testPropertyFileFormat() + { + $this->assertInstanceOf(FileFormatEnum::class, self::$instance->getFileFormat()); + $this->assertSame(FileFormatEnum::MP3, self::$instance->getFileFormat()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertIsString(self::$instance->getStatus()); + $this->assertEquals('test_string', self::$instance->getStatus()); + } + + /** + * Test attribute "media_url" + */ + public function testPropertyMediaUrl() + { + $this->assertIsString(self::$instance->getMediaUrl()); + $this->assertEquals('test_string', self::$instance->getMediaUrl()); + } + + /** + * Test attribute "transcription" + */ + public function testPropertyTranscription() + { + $this->assertInstanceOf(RecordingTranscriptionMetadata::class, self::$instance->getTranscription()); + } + + /** + * Test attribute "recording_name" + */ + public function testPropertyRecordingName() + { + $this->assertIsString(self::$instance->getRecordingName()); + $this->assertEquals('test_string', self::$instance->getRecordingName()); + }} diff --git a/tests/Unit/Model/CallStateEnumTest.php b/tests/Unit/Model/CallStateEnumTest.php new file mode 100644 index 0000000..0abfbfe --- /dev/null +++ b/tests/Unit/Model/CallStateEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['active', 'completed'], + array_column(CallStateEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/CallStateTest.php b/tests/Unit/Model/CallStateTest.php new file mode 100644 index 0000000..a54e144 --- /dev/null +++ b/tests/Unit/Model/CallStateTest.php @@ -0,0 +1,243 @@ + 'test_string', + 'account_id' => 'test_string', + 'call_id' => 'test_string', + 'parent_call_id' => 'test_string', + 'to' => 'test_string', + 'from' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'state' => 'test_string', + 'stir_shaken' => ['key' => 'value'], + 'identity' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'end_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'disconnect_cause' => 'test_string', + 'error_message' => 'test_string', + 'error_id' => 'test_string', + 'last_update' => new \DateTime('2024-01-01T00:00:00+00:00') + ]); + } + + /** + * Test "CallState" + */ + public function testCallState() + { + $this->assertInstanceOf(CallState::class, self::$instance); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "parent_call_id" + */ + public function testPropertyParentCallId() + { + $this->assertIsString(self::$instance->getParentCallId()); + $this->assertEquals('test_string', self::$instance->getParentCallId()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "state" + */ + public function testPropertyState() + { + $this->assertIsString(self::$instance->getState()); + $this->assertEquals('test_string', self::$instance->getState()); + } + + /** + * Test attribute "stir_shaken" + */ + public function testPropertyStirShaken() + { + $this->assertIsArray(self::$instance->getStirShaken()); + $this->assertEquals(['key' => 'value'], self::$instance->getStirShaken()); + } + + /** + * Test attribute "identity" + */ + public function testPropertyIdentity() + { + $this->assertIsString(self::$instance->getIdentity()); + $this->assertEquals('test_string', self::$instance->getIdentity()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "end_time" + */ + public function testPropertyEndTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEndTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEndTime()); + } + + /** + * Test attribute "disconnect_cause" + */ + public function testPropertyDisconnectCause() + { + $this->assertIsString(self::$instance->getDisconnectCause()); + $this->assertEquals('test_string', self::$instance->getDisconnectCause()); + } + + /** + * Test attribute "error_message" + */ + public function testPropertyErrorMessage() + { + $this->assertIsString(self::$instance->getErrorMessage()); + $this->assertEquals('test_string', self::$instance->getErrorMessage()); + } + + /** + * Test attribute "error_id" + */ + public function testPropertyErrorId() + { + $this->assertIsString(self::$instance->getErrorId()); + $this->assertEquals('test_string', self::$instance->getErrorId()); + } + + /** + * Test attribute "last_update" + */ + public function testPropertyLastUpdate() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getLastUpdate()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getLastUpdate()); + }} diff --git a/tests/Unit/Model/CallTranscriptionDetectedLanguageEnumTest.php b/tests/Unit/Model/CallTranscriptionDetectedLanguageEnumTest.php new file mode 100644 index 0000000..a0a3085 --- /dev/null +++ b/tests/Unit/Model/CallTranscriptionDetectedLanguageEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['en-US', 'es-US', 'fr-FR'], + array_column(CallTranscriptionDetectedLanguageEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/CallTranscriptionMetadataTest.php b/tests/Unit/Model/CallTranscriptionMetadataTest.php new file mode 100644 index 0000000..26192a2 --- /dev/null +++ b/tests/Unit/Model/CallTranscriptionMetadataTest.php @@ -0,0 +1,92 @@ + 'test_string', + 'transcription_name' => 'test_string', + 'transcription_url' => 'test_string' + ]); + } + + /** + * Test "CallTranscriptionMetadata" + */ + public function testCallTranscriptionMetadata() + { + $this->assertInstanceOf(CallTranscriptionMetadata::class, self::$instance); + } + + /** + * Test attribute "transcription_id" + */ + public function testPropertyTranscriptionId() + { + $this->assertIsString(self::$instance->getTranscriptionId()); + $this->assertEquals('test_string', self::$instance->getTranscriptionId()); + } + + /** + * Test attribute "transcription_name" + */ + public function testPropertyTranscriptionName() + { + $this->assertIsString(self::$instance->getTranscriptionName()); + $this->assertEquals('test_string', self::$instance->getTranscriptionName()); + } + + /** + * Test attribute "transcription_url" + */ + public function testPropertyTranscriptionUrl() + { + $this->assertIsString(self::$instance->getTranscriptionUrl()); + $this->assertEquals('test_string', self::$instance->getTranscriptionUrl()); + }} diff --git a/tests/Unit/Model/CallTranscriptionResponseTest.php b/tests/Unit/Model/CallTranscriptionResponseTest.php new file mode 100644 index 0000000..993b618 --- /dev/null +++ b/tests/Unit/Model/CallTranscriptionResponseTest.php @@ -0,0 +1,103 @@ + 'test_string', + 'call_id' => 'test_string', + 'transcription_id' => 'test_string', + 'tracks' => [new CallTranscription([])] + ]); + } + + /** + * Test "CallTranscriptionResponse" + */ + public function testCallTranscriptionResponse() + { + $this->assertInstanceOf(CallTranscriptionResponse::class, self::$instance); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "transcription_id" + */ + public function testPropertyTranscriptionId() + { + $this->assertIsString(self::$instance->getTranscriptionId()); + $this->assertEquals('test_string', self::$instance->getTranscriptionId()); + } + + /** + * Test attribute "tracks" + */ + public function testPropertyTracks() + { + $this->assertIsArray(self::$instance->getTracks()); + $this->assertInstanceOf(CallTranscription::class, self::$instance->getTracks()[0]); + }} diff --git a/tests/Unit/Model/CallTranscriptionTest.php b/tests/Unit/Model/CallTranscriptionTest.php new file mode 100644 index 0000000..001198d --- /dev/null +++ b/tests/Unit/Model/CallTranscriptionTest.php @@ -0,0 +1,104 @@ + CallTranscriptionDetectedLanguageEnum::EN_US, + 'track' => CallTranscriptionTrackEnum::INBOUND, + 'transcript' => 'test_string', + 'confidence' => 1.5 + ]); + } + + /** + * Test "CallTranscription" + */ + public function testCallTranscription() + { + $this->assertInstanceOf(CallTranscription::class, self::$instance); + } + + /** + * Test attribute "detected_language" + */ + public function testPropertyDetectedLanguage() + { + $this->assertInstanceOf(CallTranscriptionDetectedLanguageEnum::class, self::$instance->getDetectedLanguage()); + $this->assertSame(CallTranscriptionDetectedLanguageEnum::EN_US, self::$instance->getDetectedLanguage()); + } + + /** + * Test attribute "track" + */ + public function testPropertyTrack() + { + $this->assertInstanceOf(CallTranscriptionTrackEnum::class, self::$instance->getTrack()); + $this->assertSame(CallTranscriptionTrackEnum::INBOUND, self::$instance->getTrack()); + } + + /** + * Test attribute "transcript" + */ + public function testPropertyTranscript() + { + $this->assertIsString(self::$instance->getTranscript()); + $this->assertEquals('test_string', self::$instance->getTranscript()); + } + + /** + * Test attribute "confidence" + */ + public function testPropertyConfidence() + { + $this->assertIsFloat(self::$instance->getConfidence()); + $this->assertEquals(1.5, self::$instance->getConfidence()); + }} diff --git a/tests/Unit/Model/CallTranscriptionTrackEnumTest.php b/tests/Unit/Model/CallTranscriptionTrackEnumTest.php new file mode 100644 index 0000000..e46645e --- /dev/null +++ b/tests/Unit/Model/CallTranscriptionTrackEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['inbound', 'outbound'], + array_column(CallTranscriptionTrackEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/CallbackMethodEnumTest.php b/tests/Unit/Model/CallbackMethodEnumTest.php new file mode 100644 index 0000000..ce275c0 --- /dev/null +++ b/tests/Unit/Model/CallbackMethodEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['GET', 'POST'], + array_column(CallbackMethodEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/CallbackTest.php b/tests/Unit/Model/CallbackTest.php new file mode 100644 index 0000000..7a6d0bc --- /dev/null +++ b/tests/Unit/Model/CallbackTest.php @@ -0,0 +1,112 @@ +assertSame( + [StatusCallback::class, InboundCallback::class], + array_map(fn($type) => ltrim($type, '\\'), Callback::getOneOfTypes()) + ); + $this->assertSame('type', Callback::getOneOfDiscriminator()); + $this->assertSame( + [ + 'message-delivered' => StatusCallback::class, + 'message-failed' => StatusCallback::class, + 'message-read' => StatusCallback::class, + 'message-received' => InboundCallback::class, + 'message-sending' => StatusCallback::class, + 'message-sent' => StatusCallback::class, + 'requested-location-response' => InboundCallback::class, + 'suggestion-response' => InboundCallback::class + ], + array_map(fn($type) => ltrim($type, '\\'), Callback::getOneOfDiscriminatorMappings()) + ); + } + + /** + * Test that each discriminator value deserializes to its mapped type + * + * @dataProvider discriminatorProvider + */ + public function testDeserializeResolvesDiscriminator(string $type, string $expected) + { + $result = ObjectSerializer::deserialize((object) ['type' => $type], Callback::class); + + $this->assertInstanceOf($expected, $result); + $this->assertSame($type, $result->getType()->value); + } + + /** + * Test that an unmapped discriminator value is rejected + */ + public function testDeserializeRejectsUnknownDiscriminator() + { + $this->expectException(\InvalidArgumentException::class); + + ObjectSerializer::deserialize((object) ['type' => 'not-a-callback-type'], Callback::class); + } + + /** + * @return array + */ + public static function discriminatorProvider(): array + { + return [ + 'message-delivered' => ['message-delivered', StatusCallback::class], + 'message-failed' => ['message-failed', StatusCallback::class], + 'message-read' => ['message-read', StatusCallback::class], + 'message-received' => ['message-received', InboundCallback::class], + 'message-sending' => ['message-sending', StatusCallback::class], + 'message-sent' => ['message-sent', StatusCallback::class], + 'requested-location-response' => ['requested-location-response', InboundCallback::class], + 'suggestion-response' => ['suggestion-response', InboundCallback::class] + ]; + } +} diff --git a/tests/Unit/Model/CardWidthEnumTest.php b/tests/Unit/Model/CardWidthEnumTest.php new file mode 100644 index 0000000..7b9cabc --- /dev/null +++ b/tests/Unit/Model/CardWidthEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['SMALL', 'MEDIUM'], + array_column(CardWidthEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/CodeRequestTest.php b/tests/Unit/Model/CodeRequestTest.php new file mode 100644 index 0000000..247e89c --- /dev/null +++ b/tests/Unit/Model/CodeRequestTest.php @@ -0,0 +1,122 @@ + 'test_string', + 'from' => 'test_string', + 'application_id' => 'test_string', + 'scope' => 'test_string', + 'message' => 'test_string', + 'digits' => 1 + ]); + } + + /** + * Test "CodeRequest" + */ + public function testCodeRequest() + { + $this->assertInstanceOf(CodeRequest::class, self::$instance); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "scope" + */ + public function testPropertyScope() + { + $this->assertIsString(self::$instance->getScope()); + $this->assertEquals('test_string', self::$instance->getScope()); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + $this->assertIsString(self::$instance->getMessage()); + $this->assertEquals('test_string', self::$instance->getMessage()); + } + + /** + * Test attribute "digits" + */ + public function testPropertyDigits() + { + $this->assertIsInt(self::$instance->getDigits()); + $this->assertEquals(1, self::$instance->getDigits()); + }} diff --git a/tests/Unit/Model/CompletedLookupStatusEnumTest.php b/tests/Unit/Model/CompletedLookupStatusEnumTest.php new file mode 100644 index 0000000..cb5d3db --- /dev/null +++ b/tests/Unit/Model/CompletedLookupStatusEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['COMPLETE', 'PARTIAL_COMPLETE', 'FAILED'], + array_column(CompletedLookupStatusEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/ConferenceCompletedCallbackTest.php b/tests/Unit/Model/ConferenceCompletedCallbackTest.php new file mode 100644 index 0000000..530d8fc --- /dev/null +++ b/tests/Unit/Model/ConferenceCompletedCallbackTest.php @@ -0,0 +1,112 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'conference_id' => 'test_string', + 'name' => 'test_string', + 'tag' => 'test_string' + ]); + } + + /** + * Test "ConferenceCompletedCallback" + */ + public function testConferenceCompletedCallback() + { + $this->assertInstanceOf(ConferenceCompletedCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "conference_id" + */ + public function testPropertyConferenceId() + { + $this->assertIsString(self::$instance->getConferenceId()); + $this->assertEquals('test_string', self::$instance->getConferenceId()); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + $this->assertIsString(self::$instance->getName()); + $this->assertEquals('test_string', self::$instance->getName()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/ConferenceCreatedCallbackTest.php b/tests/Unit/Model/ConferenceCreatedCallbackTest.php new file mode 100644 index 0000000..ef4e476 --- /dev/null +++ b/tests/Unit/Model/ConferenceCreatedCallbackTest.php @@ -0,0 +1,112 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'conference_id' => 'test_string', + 'name' => 'test_string', + 'tag' => 'test_string' + ]); + } + + /** + * Test "ConferenceCreatedCallback" + */ + public function testConferenceCreatedCallback() + { + $this->assertInstanceOf(ConferenceCreatedCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "conference_id" + */ + public function testPropertyConferenceId() + { + $this->assertIsString(self::$instance->getConferenceId()); + $this->assertEquals('test_string', self::$instance->getConferenceId()); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + $this->assertIsString(self::$instance->getName()); + $this->assertEquals('test_string', self::$instance->getName()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/ConferenceMemberExitCallbackTest.php b/tests/Unit/Model/ConferenceMemberExitCallbackTest.php new file mode 100644 index 0000000..48ae5f6 --- /dev/null +++ b/tests/Unit/Model/ConferenceMemberExitCallbackTest.php @@ -0,0 +1,142 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'conference_id' => 'test_string', + 'name' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'call_id' => 'test_string', + 'tag' => 'test_string' + ]); + } + + /** + * Test "ConferenceMemberExitCallback" + */ + public function testConferenceMemberExitCallback() + { + $this->assertInstanceOf(ConferenceMemberExitCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "conference_id" + */ + public function testPropertyConferenceId() + { + $this->assertIsString(self::$instance->getConferenceId()); + $this->assertEquals('test_string', self::$instance->getConferenceId()); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + $this->assertIsString(self::$instance->getName()); + $this->assertEquals('test_string', self::$instance->getName()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/ConferenceMemberJoinCallbackTest.php b/tests/Unit/Model/ConferenceMemberJoinCallbackTest.php new file mode 100644 index 0000000..c261c50 --- /dev/null +++ b/tests/Unit/Model/ConferenceMemberJoinCallbackTest.php @@ -0,0 +1,142 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'conference_id' => 'test_string', + 'name' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'call_id' => 'test_string', + 'tag' => 'test_string' + ]); + } + + /** + * Test "ConferenceMemberJoinCallback" + */ + public function testConferenceMemberJoinCallback() + { + $this->assertInstanceOf(ConferenceMemberJoinCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "conference_id" + */ + public function testPropertyConferenceId() + { + $this->assertIsString(self::$instance->getConferenceId()); + $this->assertEquals('test_string', self::$instance->getConferenceId()); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + $this->assertIsString(self::$instance->getName()); + $this->assertEquals('test_string', self::$instance->getName()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/ConferenceMemberTest.php b/tests/Unit/Model/ConferenceMemberTest.php new file mode 100644 index 0000000..c409d1d --- /dev/null +++ b/tests/Unit/Model/ConferenceMemberTest.php @@ -0,0 +1,122 @@ + 'test_string', + 'conference_id' => 'test_string', + 'member_url' => 'test_string', + 'mute' => true, + 'hold' => true, + 'call_ids_to_coach' => ['test_string'] + ]); + } + + /** + * Test "ConferenceMember" + */ + public function testConferenceMember() + { + $this->assertInstanceOf(ConferenceMember::class, self::$instance); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "conference_id" + */ + public function testPropertyConferenceId() + { + $this->assertIsString(self::$instance->getConferenceId()); + $this->assertEquals('test_string', self::$instance->getConferenceId()); + } + + /** + * Test attribute "member_url" + */ + public function testPropertyMemberUrl() + { + $this->assertIsString(self::$instance->getMemberUrl()); + $this->assertEquals('test_string', self::$instance->getMemberUrl()); + } + + /** + * Test attribute "mute" + */ + public function testPropertyMute() + { + $this->assertIsBool(self::$instance->getMute()); + $this->assertTrue(self::$instance->getMute()); + } + + /** + * Test attribute "hold" + */ + public function testPropertyHold() + { + $this->assertIsBool(self::$instance->getHold()); + $this->assertTrue(self::$instance->getHold()); + } + + /** + * Test attribute "call_ids_to_coach" + */ + public function testPropertyCallIdsToCoach() + { + $this->assertIsArray(self::$instance->getCallIdsToCoach()); + $this->assertEquals(['test_string'], self::$instance->getCallIdsToCoach()); + }} diff --git a/tests/Unit/Model/ConferenceRecordingAvailableCallbackTest.php b/tests/Unit/Model/ConferenceRecordingAvailableCallbackTest.php new file mode 100644 index 0000000..ace5b7e --- /dev/null +++ b/tests/Unit/Model/ConferenceRecordingAvailableCallbackTest.php @@ -0,0 +1,203 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'conference_id' => 'test_string', + 'name' => 'test_string', + 'account_id' => 'test_string', + 'recording_id' => 'test_string', + 'channels' => 1, + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'end_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'duration' => 'test_string', + 'file_format' => FileFormatEnum::MP3, + 'media_url' => 'test_string', + 'tag' => 'test_string', + 'status' => 'test_string' + ]); + } + + /** + * Test "ConferenceRecordingAvailableCallback" + */ + public function testConferenceRecordingAvailableCallback() + { + $this->assertInstanceOf(ConferenceRecordingAvailableCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "conference_id" + */ + public function testPropertyConferenceId() + { + $this->assertIsString(self::$instance->getConferenceId()); + $this->assertEquals('test_string', self::$instance->getConferenceId()); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + $this->assertIsString(self::$instance->getName()); + $this->assertEquals('test_string', self::$instance->getName()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "recording_id" + */ + public function testPropertyRecordingId() + { + $this->assertIsString(self::$instance->getRecordingId()); + $this->assertEquals('test_string', self::$instance->getRecordingId()); + } + + /** + * Test attribute "channels" + */ + public function testPropertyChannels() + { + $this->assertIsInt(self::$instance->getChannels()); + $this->assertEquals(1, self::$instance->getChannels()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "end_time" + */ + public function testPropertyEndTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEndTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEndTime()); + } + + /** + * Test attribute "duration" + */ + public function testPropertyDuration() + { + $this->assertIsString(self::$instance->getDuration()); + $this->assertEquals('test_string', self::$instance->getDuration()); + } + + /** + * Test attribute "file_format" + */ + public function testPropertyFileFormat() + { + $this->assertInstanceOf(FileFormatEnum::class, self::$instance->getFileFormat()); + $this->assertSame(FileFormatEnum::MP3, self::$instance->getFileFormat()); + } + + /** + * Test attribute "media_url" + */ + public function testPropertyMediaUrl() + { + $this->assertIsString(self::$instance->getMediaUrl()); + $this->assertEquals('test_string', self::$instance->getMediaUrl()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertIsString(self::$instance->getStatus()); + $this->assertEquals('test_string', self::$instance->getStatus()); + }} diff --git a/tests/Unit/Model/ConferenceRecordingMetadataTest.php b/tests/Unit/Model/ConferenceRecordingMetadataTest.php new file mode 100644 index 0000000..5f14c09 --- /dev/null +++ b/tests/Unit/Model/ConferenceRecordingMetadataTest.php @@ -0,0 +1,183 @@ + 'test_string', + 'conference_id' => 'test_string', + 'name' => 'test_string', + 'recording_id' => 'test_string', + 'duration' => 'test_string', + 'channels' => 1, + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'end_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'file_format' => FileFormatEnum::MP3, + 'status' => 'test_string', + 'media_url' => 'test_string', + 'recording_name' => 'test_string' + ]); + } + + /** + * Test "ConferenceRecordingMetadata" + */ + public function testConferenceRecordingMetadata() + { + $this->assertInstanceOf(ConferenceRecordingMetadata::class, self::$instance); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "conference_id" + */ + public function testPropertyConferenceId() + { + $this->assertIsString(self::$instance->getConferenceId()); + $this->assertEquals('test_string', self::$instance->getConferenceId()); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + $this->assertIsString(self::$instance->getName()); + $this->assertEquals('test_string', self::$instance->getName()); + } + + /** + * Test attribute "recording_id" + */ + public function testPropertyRecordingId() + { + $this->assertIsString(self::$instance->getRecordingId()); + $this->assertEquals('test_string', self::$instance->getRecordingId()); + } + + /** + * Test attribute "duration" + */ + public function testPropertyDuration() + { + $this->assertIsString(self::$instance->getDuration()); + $this->assertEquals('test_string', self::$instance->getDuration()); + } + + /** + * Test attribute "channels" + */ + public function testPropertyChannels() + { + $this->assertIsInt(self::$instance->getChannels()); + $this->assertEquals(1, self::$instance->getChannels()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "end_time" + */ + public function testPropertyEndTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEndTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEndTime()); + } + + /** + * Test attribute "file_format" + */ + public function testPropertyFileFormat() + { + $this->assertInstanceOf(FileFormatEnum::class, self::$instance->getFileFormat()); + $this->assertSame(FileFormatEnum::MP3, self::$instance->getFileFormat()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertIsString(self::$instance->getStatus()); + $this->assertEquals('test_string', self::$instance->getStatus()); + } + + /** + * Test attribute "media_url" + */ + public function testPropertyMediaUrl() + { + $this->assertIsString(self::$instance->getMediaUrl()); + $this->assertEquals('test_string', self::$instance->getMediaUrl()); + } + + /** + * Test attribute "recording_name" + */ + public function testPropertyRecordingName() + { + $this->assertIsString(self::$instance->getRecordingName()); + $this->assertEquals('test_string', self::$instance->getRecordingName()); + }} diff --git a/tests/Unit/Model/ConferenceRedirectCallbackTest.php b/tests/Unit/Model/ConferenceRedirectCallbackTest.php new file mode 100644 index 0000000..7f7888a --- /dev/null +++ b/tests/Unit/Model/ConferenceRedirectCallbackTest.php @@ -0,0 +1,112 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'conference_id' => 'test_string', + 'name' => 'test_string', + 'tag' => 'test_string' + ]); + } + + /** + * Test "ConferenceRedirectCallback" + */ + public function testConferenceRedirectCallback() + { + $this->assertInstanceOf(ConferenceRedirectCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "conference_id" + */ + public function testPropertyConferenceId() + { + $this->assertIsString(self::$instance->getConferenceId()); + $this->assertEquals('test_string', self::$instance->getConferenceId()); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + $this->assertIsString(self::$instance->getName()); + $this->assertEquals('test_string', self::$instance->getName()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/ConferenceStateEnumTest.php b/tests/Unit/Model/ConferenceStateEnumTest.php new file mode 100644 index 0000000..3076e92 --- /dev/null +++ b/tests/Unit/Model/ConferenceStateEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['active', 'completed'], + array_column(ConferenceStateEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/ConferenceTest.php b/tests/Unit/Model/ConferenceTest.php new file mode 100644 index 0000000..31b030c --- /dev/null +++ b/tests/Unit/Model/ConferenceTest.php @@ -0,0 +1,144 @@ + 'test_string', + 'name' => 'test_string', + 'created_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'completed_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'conference_event_url' => 'test_string', + 'conference_event_method' => CallbackMethodEnum::GET, + 'tag' => 'test_string', + 'active_members' => [new ConferenceMember([])] + ]); + } + + /** + * Test "Conference" + */ + public function testConference() + { + $this->assertInstanceOf(Conference::class, self::$instance); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + $this->assertIsString(self::$instance->getId()); + $this->assertEquals('test_string', self::$instance->getId()); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + $this->assertIsString(self::$instance->getName()); + $this->assertEquals('test_string', self::$instance->getName()); + } + + /** + * Test attribute "created_time" + */ + public function testPropertyCreatedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getCreatedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getCreatedTime()); + } + + /** + * Test attribute "completed_time" + */ + public function testPropertyCompletedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getCompletedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getCompletedTime()); + } + + /** + * Test attribute "conference_event_url" + */ + public function testPropertyConferenceEventUrl() + { + $this->assertIsString(self::$instance->getConferenceEventUrl()); + $this->assertEquals('test_string', self::$instance->getConferenceEventUrl()); + } + + /** + * Test attribute "conference_event_method" + */ + public function testPropertyConferenceEventMethod() + { + $this->assertInstanceOf(CallbackMethodEnum::class, self::$instance->getConferenceEventMethod()); + $this->assertSame(CallbackMethodEnum::GET, self::$instance->getConferenceEventMethod()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "active_members" + */ + public function testPropertyActiveMembers() + { + $this->assertIsArray(self::$instance->getActiveMembers()); + $this->assertInstanceOf(ConferenceMember::class, self::$instance->getActiveMembers()[0]); + }} diff --git a/tests/Unit/Model/ContactTest.php b/tests/Unit/Model/ContactTest.php new file mode 100644 index 0000000..1f0a99e --- /dev/null +++ b/tests/Unit/Model/ContactTest.php @@ -0,0 +1,102 @@ + 'test_string', + 'last_name' => 'test_string', + 'email' => 'test_string', + 'phone_number' => 'test_string' + ]); + } + + /** + * Test "Contact" + */ + public function testContact() + { + $this->assertInstanceOf(Contact::class, self::$instance); + } + + /** + * Test attribute "first_name" + */ + public function testPropertyFirstName() + { + $this->assertIsString(self::$instance->getFirstName()); + $this->assertEquals('test_string', self::$instance->getFirstName()); + } + + /** + * Test attribute "last_name" + */ + public function testPropertyLastName() + { + $this->assertIsString(self::$instance->getLastName()); + $this->assertEquals('test_string', self::$instance->getLastName()); + } + + /** + * Test attribute "email" + */ + public function testPropertyEmail() + { + $this->assertIsString(self::$instance->getEmail()); + $this->assertEquals('test_string', self::$instance->getEmail()); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + $this->assertIsString(self::$instance->getPhoneNumber()); + $this->assertEquals('test_string', self::$instance->getPhoneNumber()); + }} diff --git a/tests/Unit/Model/CreateAsyncBulkLookupResponseDataTest.php b/tests/Unit/Model/CreateAsyncBulkLookupResponseDataTest.php new file mode 100644 index 0000000..0bc7d8e --- /dev/null +++ b/tests/Unit/Model/CreateAsyncBulkLookupResponseDataTest.php @@ -0,0 +1,83 @@ + 'test_string', + 'status' => InProgressLookupStatusEnum::IN_PROGRESS + ]); + } + + /** + * Test "CreateAsyncBulkLookupResponseData" + */ + public function testCreateAsyncBulkLookupResponseData() + { + $this->assertInstanceOf(CreateAsyncBulkLookupResponseData::class, self::$instance); + } + + /** + * Test attribute "request_id" + */ + public function testPropertyRequestId() + { + $this->assertIsString(self::$instance->getRequestId()); + $this->assertEquals('test_string', self::$instance->getRequestId()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(InProgressLookupStatusEnum::class, self::$instance->getStatus()); + $this->assertSame(InProgressLookupStatusEnum::IN_PROGRESS, self::$instance->getStatus()); + }} diff --git a/tests/Unit/Model/CreateAsyncBulkLookupResponseTest.php b/tests/Unit/Model/CreateAsyncBulkLookupResponseTest.php new file mode 100644 index 0000000..aca3699 --- /dev/null +++ b/tests/Unit/Model/CreateAsyncBulkLookupResponseTest.php @@ -0,0 +1,94 @@ + [new LinkSchema([])], + 'data' => new CreateAsyncBulkLookupResponseData([]), + 'errors' => [new LookupErrorSchema([])] + ]); + } + + /** + * Test "CreateAsyncBulkLookupResponse" + */ + public function testCreateAsyncBulkLookupResponse() + { + $this->assertInstanceOf(CreateAsyncBulkLookupResponse::class, self::$instance); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + $this->assertIsArray(self::$instance->getLinks()); + $this->assertInstanceOf(LinkSchema::class, self::$instance->getLinks()[0]); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + $this->assertInstanceOf(CreateAsyncBulkLookupResponseData::class, self::$instance->getData()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertInstanceOf(LookupErrorSchema::class, self::$instance->getErrors()[0]); + }} diff --git a/tests/Unit/Model/CreateCallResponseTest.php b/tests/Unit/Model/CreateCallResponseTest.php new file mode 100644 index 0000000..c59d360 --- /dev/null +++ b/tests/Unit/Model/CreateCallResponseTest.php @@ -0,0 +1,273 @@ + 'test_string', + 'account_id' => 'test_string', + 'call_id' => 'test_string', + 'to' => 'test_string', + 'from' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'call_url' => 'test_string', + 'call_timeout' => 1.5, + 'callback_timeout' => 1.5, + 'tag' => 'test_string', + 'answer_method' => CallbackMethodEnum::GET, + 'answer_url' => 'test_string', + 'answer_fallback_method' => CallbackMethodEnum::GET, + 'answer_fallback_url' => 'test_string', + 'disconnect_method' => CallbackMethodEnum::GET, + 'disconnect_url' => 'test_string', + 'username' => 'test_string', + 'password' => 'test_string', + 'fallback_username' => 'test_string', + 'fallback_password' => 'test_string', + 'priority' => 1 + ]); + } + + /** + * Test "CreateCallResponse" + */ + public function testCreateCallResponse() + { + $this->assertInstanceOf(CreateCallResponse::class, self::$instance); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "call_timeout" + */ + public function testPropertyCallTimeout() + { + $this->assertIsFloat(self::$instance->getCallTimeout()); + $this->assertEquals(1.5, self::$instance->getCallTimeout()); + } + + /** + * Test attribute "callback_timeout" + */ + public function testPropertyCallbackTimeout() + { + $this->assertIsFloat(self::$instance->getCallbackTimeout()); + $this->assertEquals(1.5, self::$instance->getCallbackTimeout()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "answer_method" + */ + public function testPropertyAnswerMethod() + { + $this->assertInstanceOf(CallbackMethodEnum::class, self::$instance->getAnswerMethod()); + $this->assertSame(CallbackMethodEnum::GET, self::$instance->getAnswerMethod()); + } + + /** + * Test attribute "answer_url" + */ + public function testPropertyAnswerUrl() + { + $this->assertIsString(self::$instance->getAnswerUrl()); + $this->assertEquals('test_string', self::$instance->getAnswerUrl()); + } + + /** + * Test attribute "answer_fallback_method" + */ + public function testPropertyAnswerFallbackMethod() + { + $this->assertInstanceOf(CallbackMethodEnum::class, self::$instance->getAnswerFallbackMethod()); + $this->assertSame(CallbackMethodEnum::GET, self::$instance->getAnswerFallbackMethod()); + } + + /** + * Test attribute "answer_fallback_url" + */ + public function testPropertyAnswerFallbackUrl() + { + $this->assertIsString(self::$instance->getAnswerFallbackUrl()); + $this->assertEquals('test_string', self::$instance->getAnswerFallbackUrl()); + } + + /** + * Test attribute "disconnect_method" + */ + public function testPropertyDisconnectMethod() + { + $this->assertInstanceOf(CallbackMethodEnum::class, self::$instance->getDisconnectMethod()); + $this->assertSame(CallbackMethodEnum::GET, self::$instance->getDisconnectMethod()); + } + + /** + * Test attribute "disconnect_url" + */ + public function testPropertyDisconnectUrl() + { + $this->assertIsString(self::$instance->getDisconnectUrl()); + $this->assertEquals('test_string', self::$instance->getDisconnectUrl()); + } + + /** + * Test attribute "username" + */ + public function testPropertyUsername() + { + $this->assertIsString(self::$instance->getUsername()); + $this->assertEquals('test_string', self::$instance->getUsername()); + } + + /** + * Test attribute "password" + */ + public function testPropertyPassword() + { + $this->assertIsString(self::$instance->getPassword()); + $this->assertEquals('test_string', self::$instance->getPassword()); + } + + /** + * Test attribute "fallback_username" + */ + public function testPropertyFallbackUsername() + { + $this->assertIsString(self::$instance->getFallbackUsername()); + $this->assertEquals('test_string', self::$instance->getFallbackUsername()); + } + + /** + * Test attribute "fallback_password" + */ + public function testPropertyFallbackPassword() + { + $this->assertIsString(self::$instance->getFallbackPassword()); + $this->assertEquals('test_string', self::$instance->getFallbackPassword()); + } + + /** + * Test attribute "priority" + */ + public function testPropertyPriority() + { + $this->assertIsInt(self::$instance->getPriority()); + $this->assertEquals(1, self::$instance->getPriority()); + }} diff --git a/tests/Unit/Model/CreateCallTest.php b/tests/Unit/Model/CreateCallTest.php new file mode 100644 index 0000000..d814df3 --- /dev/null +++ b/tests/Unit/Model/CreateCallTest.php @@ -0,0 +1,273 @@ + 'test_string', + 'from' => 'test_string', + 'privacy' => true, + 'display_name' => 'test_string', + 'uui' => 'test_string', + 'application_id' => 'test_string', + 'answer_url' => 'test_string', + 'answer_method' => CallbackMethodEnum::GET, + 'username' => 'test_string', + 'password' => 'test_string', + 'answer_fallback_url' => 'test_string', + 'answer_fallback_method' => CallbackMethodEnum::GET, + 'fallback_username' => 'test_string', + 'fallback_password' => 'test_string', + 'disconnect_url' => 'test_string', + 'disconnect_method' => CallbackMethodEnum::GET, + 'call_timeout' => 1.5, + 'callback_timeout' => 1.5, + 'machine_detection' => new MachineDetectionConfiguration([]), + 'priority' => 1, + 'tag' => 'test_string' + ]); + } + + /** + * Test "CreateCall" + */ + public function testCreateCall() + { + $this->assertInstanceOf(CreateCall::class, self::$instance); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "privacy" + */ + public function testPropertyPrivacy() + { + $this->assertIsBool(self::$instance->getPrivacy()); + $this->assertTrue(self::$instance->getPrivacy()); + } + + /** + * Test attribute "display_name" + */ + public function testPropertyDisplayName() + { + $this->assertIsString(self::$instance->getDisplayName()); + $this->assertEquals('test_string', self::$instance->getDisplayName()); + } + + /** + * Test attribute "uui" + */ + public function testPropertyUui() + { + $this->assertIsString(self::$instance->getUui()); + $this->assertEquals('test_string', self::$instance->getUui()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "answer_url" + */ + public function testPropertyAnswerUrl() + { + $this->assertIsString(self::$instance->getAnswerUrl()); + $this->assertEquals('test_string', self::$instance->getAnswerUrl()); + } + + /** + * Test attribute "answer_method" + */ + public function testPropertyAnswerMethod() + { + $this->assertInstanceOf(CallbackMethodEnum::class, self::$instance->getAnswerMethod()); + $this->assertSame(CallbackMethodEnum::GET, self::$instance->getAnswerMethod()); + } + + /** + * Test attribute "username" + */ + public function testPropertyUsername() + { + $this->assertIsString(self::$instance->getUsername()); + $this->assertEquals('test_string', self::$instance->getUsername()); + } + + /** + * Test attribute "password" + */ + public function testPropertyPassword() + { + $this->assertIsString(self::$instance->getPassword()); + $this->assertEquals('test_string', self::$instance->getPassword()); + } + + /** + * Test attribute "answer_fallback_url" + */ + public function testPropertyAnswerFallbackUrl() + { + $this->assertIsString(self::$instance->getAnswerFallbackUrl()); + $this->assertEquals('test_string', self::$instance->getAnswerFallbackUrl()); + } + + /** + * Test attribute "answer_fallback_method" + */ + public function testPropertyAnswerFallbackMethod() + { + $this->assertInstanceOf(CallbackMethodEnum::class, self::$instance->getAnswerFallbackMethod()); + $this->assertSame(CallbackMethodEnum::GET, self::$instance->getAnswerFallbackMethod()); + } + + /** + * Test attribute "fallback_username" + */ + public function testPropertyFallbackUsername() + { + $this->assertIsString(self::$instance->getFallbackUsername()); + $this->assertEquals('test_string', self::$instance->getFallbackUsername()); + } + + /** + * Test attribute "fallback_password" + */ + public function testPropertyFallbackPassword() + { + $this->assertIsString(self::$instance->getFallbackPassword()); + $this->assertEquals('test_string', self::$instance->getFallbackPassword()); + } + + /** + * Test attribute "disconnect_url" + */ + public function testPropertyDisconnectUrl() + { + $this->assertIsString(self::$instance->getDisconnectUrl()); + $this->assertEquals('test_string', self::$instance->getDisconnectUrl()); + } + + /** + * Test attribute "disconnect_method" + */ + public function testPropertyDisconnectMethod() + { + $this->assertInstanceOf(CallbackMethodEnum::class, self::$instance->getDisconnectMethod()); + $this->assertSame(CallbackMethodEnum::GET, self::$instance->getDisconnectMethod()); + } + + /** + * Test attribute "call_timeout" + */ + public function testPropertyCallTimeout() + { + $this->assertIsFloat(self::$instance->getCallTimeout()); + $this->assertEquals(1.5, self::$instance->getCallTimeout()); + } + + /** + * Test attribute "callback_timeout" + */ + public function testPropertyCallbackTimeout() + { + $this->assertIsFloat(self::$instance->getCallbackTimeout()); + $this->assertEquals(1.5, self::$instance->getCallbackTimeout()); + } + + /** + * Test attribute "machine_detection" + */ + public function testPropertyMachineDetection() + { + $this->assertInstanceOf(MachineDetectionConfiguration::class, self::$instance->getMachineDetection()); + } + + /** + * Test attribute "priority" + */ + public function testPropertyPriority() + { + $this->assertIsInt(self::$instance->getPriority()); + $this->assertEquals(1, self::$instance->getPriority()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/CreateEndpointRequestBaseTest.php b/tests/Unit/Model/CreateEndpointRequestBaseTest.php new file mode 100644 index 0000000..56dea6f --- /dev/null +++ b/tests/Unit/Model/CreateEndpointRequestBaseTest.php @@ -0,0 +1,114 @@ + EndpointTypeEnum::WEBRTC, + 'direction' => EndpointDirectionEnum::INBOUND, + 'event_callback_url' => 'test_string', + 'event_fallback_url' => 'test_string', + 'tag' => 'test_string' + ]); + } + + /** + * Test "CreateEndpointRequestBase" + */ + public function testCreateEndpointRequestBase() + { + $this->assertInstanceOf(CreateEndpointRequestBase::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(EndpointTypeEnum::class, self::$instance->getType()); + $this->assertSame(EndpointTypeEnum::WEBRTC, self::$instance->getType()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(EndpointDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(EndpointDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "event_callback_url" + */ + public function testPropertyEventCallbackUrl() + { + $this->assertIsString(self::$instance->getEventCallbackUrl()); + $this->assertEquals('test_string', self::$instance->getEventCallbackUrl()); + } + + /** + * Test attribute "event_fallback_url" + */ + public function testPropertyEventFallbackUrl() + { + $this->assertIsString(self::$instance->getEventFallbackUrl()); + $this->assertEquals('test_string', self::$instance->getEventFallbackUrl()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/CreateEndpointResponseDataTest.php b/tests/Unit/Model/CreateEndpointResponseDataTest.php new file mode 100644 index 0000000..2aee373 --- /dev/null +++ b/tests/Unit/Model/CreateEndpointResponseDataTest.php @@ -0,0 +1,145 @@ + 'test_string', + 'type' => EndpointTypeEnum::WEBRTC, + 'status' => EndpointStatusEnum::CONNECTED, + 'creation_timestamp' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'expiration_timestamp' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string', + 'devices' => [new Device([])], + 'token' => 'test_string' + ]); + } + + /** + * Test "CreateEndpointResponseData" + */ + public function testCreateEndpointResponseData() + { + $this->assertInstanceOf(CreateEndpointResponseData::class, self::$instance); + } + + /** + * Test attribute "endpoint_id" + */ + public function testPropertyEndpointId() + { + $this->assertIsString(self::$instance->getEndpointId()); + $this->assertEquals('test_string', self::$instance->getEndpointId()); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(EndpointTypeEnum::class, self::$instance->getType()); + $this->assertSame(EndpointTypeEnum::WEBRTC, self::$instance->getType()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(EndpointStatusEnum::class, self::$instance->getStatus()); + $this->assertSame(EndpointStatusEnum::CONNECTED, self::$instance->getStatus()); + } + + /** + * Test attribute "creation_timestamp" + */ + public function testPropertyCreationTimestamp() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getCreationTimestamp()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getCreationTimestamp()); + } + + /** + * Test attribute "expiration_timestamp" + */ + public function testPropertyExpirationTimestamp() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getExpirationTimestamp()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getExpirationTimestamp()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "devices" + */ + public function testPropertyDevices() + { + $this->assertIsArray(self::$instance->getDevices()); + $this->assertInstanceOf(Device::class, self::$instance->getDevices()[0]); + } + + /** + * Test attribute "token" + */ + public function testPropertyToken() + { + $this->assertIsString(self::$instance->getToken()); + $this->assertEquals('test_string', self::$instance->getToken()); + }} diff --git a/tests/Unit/Model/CreateEndpointResponseTest.php b/tests/Unit/Model/CreateEndpointResponseTest.php new file mode 100644 index 0000000..a4fdf20 --- /dev/null +++ b/tests/Unit/Model/CreateEndpointResponseTest.php @@ -0,0 +1,94 @@ + [new BrtcLink([])], + 'data' => new CreateEndpointResponseData([]), + 'errors' => [new BrtcError([])] + ]); + } + + /** + * Test "CreateEndpointResponse" + */ + public function testCreateEndpointResponse() + { + $this->assertInstanceOf(CreateEndpointResponse::class, self::$instance); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + $this->assertIsArray(self::$instance->getLinks()); + $this->assertInstanceOf(BrtcLink::class, self::$instance->getLinks()[0]); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + $this->assertInstanceOf(CreateEndpointResponseData::class, self::$instance->getData()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertInstanceOf(BrtcError::class, self::$instance->getErrors()[0]); + }} diff --git a/tests/Unit/Model/CreateMessageRequestErrorTest.php b/tests/Unit/Model/CreateMessageRequestErrorTest.php new file mode 100644 index 0000000..c93250b --- /dev/null +++ b/tests/Unit/Model/CreateMessageRequestErrorTest.php @@ -0,0 +1,93 @@ + 'test_string', + 'description' => 'test_string', + 'field_errors' => [new FieldError([])] + ]); + } + + /** + * Test "CreateMessageRequestError" + */ + public function testCreateMessageRequestError() + { + $this->assertInstanceOf(CreateMessageRequestError::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertIsString(self::$instance->getType()); + $this->assertEquals('test_string', self::$instance->getType()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + } + + /** + * Test attribute "field_errors" + */ + public function testPropertyFieldErrors() + { + $this->assertIsArray(self::$instance->getFieldErrors()); + $this->assertInstanceOf(FieldError::class, self::$instance->getFieldErrors()[0]); + }} diff --git a/tests/Unit/Model/CreateMultiChannelMessageResponseTest.php b/tests/Unit/Model/CreateMultiChannelMessageResponseTest.php new file mode 100644 index 0000000..56e9b26 --- /dev/null +++ b/tests/Unit/Model/CreateMultiChannelMessageResponseTest.php @@ -0,0 +1,94 @@ + [new Link([])], + 'data' => new MultiChannelMessageResponseData([]), + 'errors' => [new ErrorObject([])] + ]); + } + + /** + * Test "CreateMultiChannelMessageResponse" + */ + public function testCreateMultiChannelMessageResponse() + { + $this->assertInstanceOf(CreateMultiChannelMessageResponse::class, self::$instance); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + $this->assertIsArray(self::$instance->getLinks()); + $this->assertInstanceOf(Link::class, self::$instance->getLinks()[0]); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + $this->assertInstanceOf(MultiChannelMessageResponseData::class, self::$instance->getData()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertInstanceOf(ErrorObject::class, self::$instance->getErrors()[0]); + }} diff --git a/tests/Unit/Model/CreateSyncLookupResponseDataTest.php b/tests/Unit/Model/CreateSyncLookupResponseDataTest.php new file mode 100644 index 0000000..d1aab5b --- /dev/null +++ b/tests/Unit/Model/CreateSyncLookupResponseDataTest.php @@ -0,0 +1,94 @@ + 'test_string', + 'status' => CompletedLookupStatusEnum::COMPLETE, + 'results' => [new LookupResult([])] + ]); + } + + /** + * Test "CreateSyncLookupResponseData" + */ + public function testCreateSyncLookupResponseData() + { + $this->assertInstanceOf(CreateSyncLookupResponseData::class, self::$instance); + } + + /** + * Test attribute "request_id" + */ + public function testPropertyRequestId() + { + $this->assertIsString(self::$instance->getRequestId()); + $this->assertEquals('test_string', self::$instance->getRequestId()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(CompletedLookupStatusEnum::class, self::$instance->getStatus()); + $this->assertSame(CompletedLookupStatusEnum::COMPLETE, self::$instance->getStatus()); + } + + /** + * Test attribute "results" + */ + public function testPropertyResults() + { + $this->assertIsArray(self::$instance->getResults()); + $this->assertInstanceOf(LookupResult::class, self::$instance->getResults()[0]); + }} diff --git a/tests/Unit/Model/CreateSyncLookupResponseTest.php b/tests/Unit/Model/CreateSyncLookupResponseTest.php new file mode 100644 index 0000000..4100dd4 --- /dev/null +++ b/tests/Unit/Model/CreateSyncLookupResponseTest.php @@ -0,0 +1,94 @@ + [new LinkSchema([])], + 'data' => new CreateSyncLookupResponseData([]), + 'errors' => [new LookupErrorSchema([])] + ]); + } + + /** + * Test "CreateSyncLookupResponse" + */ + public function testCreateSyncLookupResponse() + { + $this->assertInstanceOf(CreateSyncLookupResponse::class, self::$instance); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + $this->assertIsArray(self::$instance->getLinks()); + $this->assertInstanceOf(LinkSchema::class, self::$instance->getLinks()[0]); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + $this->assertInstanceOf(CreateSyncLookupResponseData::class, self::$instance->getData()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertInstanceOf(LookupErrorSchema::class, self::$instance->getErrors()[0]); + }} diff --git a/tests/Unit/Model/CreateWebRtcConnectionRequestTest.php b/tests/Unit/Model/CreateWebRtcConnectionRequestTest.php new file mode 100644 index 0000000..ec57f28 --- /dev/null +++ b/tests/Unit/Model/CreateWebRtcConnectionRequestTest.php @@ -0,0 +1,124 @@ + EndpointTypeEnum::WEBRTC, + 'direction' => EndpointDirectionEnum::INBOUND, + 'event_callback_url' => 'test_string', + 'event_fallback_url' => 'test_string', + 'tag' => 'test_string', + 'connection_metadata' => (object) ['key' => 'value'] + ]); + } + + /** + * Test "CreateWebRtcConnectionRequest" + */ + public function testCreateWebRtcConnectionRequest() + { + $this->assertInstanceOf(CreateWebRtcConnectionRequest::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(EndpointTypeEnum::class, self::$instance->getType()); + $this->assertSame(EndpointTypeEnum::WEBRTC, self::$instance->getType()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(EndpointDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(EndpointDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "event_callback_url" + */ + public function testPropertyEventCallbackUrl() + { + $this->assertIsString(self::$instance->getEventCallbackUrl()); + $this->assertEquals('test_string', self::$instance->getEventCallbackUrl()); + } + + /** + * Test attribute "event_fallback_url" + */ + public function testPropertyEventFallbackUrl() + { + $this->assertIsString(self::$instance->getEventFallbackUrl()); + $this->assertEquals('test_string', self::$instance->getEventFallbackUrl()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "connection_metadata" + */ + public function testPropertyConnectionMetadata() + { + $this->assertIsObject(self::$instance->getConnectionMetadata()); + $this->assertEquals((object) ['key' => 'value'], self::$instance->getConnectionMetadata()); + }} diff --git a/tests/Unit/Model/DeactivationEventEnumTest.php b/tests/Unit/Model/DeactivationEventEnumTest.php new file mode 100644 index 0000000..5969177 --- /dev/null +++ b/tests/Unit/Model/DeactivationEventEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['DEACTIVATED'], + array_column(DeactivationEventEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/DeviceStatusEnumTest.php b/tests/Unit/Model/DeviceStatusEnumTest.php new file mode 100644 index 0000000..83f309e --- /dev/null +++ b/tests/Unit/Model/DeviceStatusEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['CONNECTED', 'DISCONNECTED'], + array_column(DeviceStatusEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/DeviceTest.php b/tests/Unit/Model/DeviceTest.php new file mode 100644 index 0000000..e73c385 --- /dev/null +++ b/tests/Unit/Model/DeviceTest.php @@ -0,0 +1,103 @@ + 'test_string', + 'device_name' => 'test_string', + 'status' => DeviceStatusEnum::CONNECTED, + 'creation_timestamp' => new \DateTime('2024-01-01T00:00:00+00:00') + ]); + } + + /** + * Test "Device" + */ + public function testDevice() + { + $this->assertInstanceOf(Device::class, self::$instance); + } + + /** + * Test attribute "device_id" + */ + public function testPropertyDeviceId() + { + $this->assertIsString(self::$instance->getDeviceId()); + $this->assertEquals('test_string', self::$instance->getDeviceId()); + } + + /** + * Test attribute "device_name" + */ + public function testPropertyDeviceName() + { + $this->assertIsString(self::$instance->getDeviceName()); + $this->assertEquals('test_string', self::$instance->getDeviceName()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(DeviceStatusEnum::class, self::$instance->getStatus()); + $this->assertSame(DeviceStatusEnum::CONNECTED, self::$instance->getStatus()); + } + + /** + * Test attribute "creation_timestamp" + */ + public function testPropertyCreationTimestamp() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getCreationTimestamp()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getCreationTimestamp()); + }} diff --git a/tests/Unit/Model/DisconnectCallbackTest.php b/tests/Unit/Model/DisconnectCallbackTest.php new file mode 100644 index 0000000..e45025c --- /dev/null +++ b/tests/Unit/Model/DisconnectCallbackTest.php @@ -0,0 +1,233 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'call_id' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_url' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'end_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'cause' => 'test_string', + 'error_message' => 'test_string', + 'error_id' => 'test_string', + 'tag' => 'test_string' + ]); + } + + /** + * Test "DisconnectCallback" + */ + public function testDisconnectCallback() + { + $this->assertInstanceOf(DisconnectCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "end_time" + */ + public function testPropertyEndTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEndTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEndTime()); + } + + /** + * Test attribute "cause" + */ + public function testPropertyCause() + { + $this->assertIsString(self::$instance->getCause()); + $this->assertEquals('test_string', self::$instance->getCause()); + } + + /** + * Test attribute "error_message" + */ + public function testPropertyErrorMessage() + { + $this->assertIsString(self::$instance->getErrorMessage()); + $this->assertEquals('test_string', self::$instance->getErrorMessage()); + } + + /** + * Test attribute "error_id" + */ + public function testPropertyErrorId() + { + $this->assertIsString(self::$instance->getErrorId()); + $this->assertEquals('test_string', self::$instance->getErrorId()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/DiversionTest.php b/tests/Unit/Model/DiversionTest.php new file mode 100644 index 0000000..10a57c0 --- /dev/null +++ b/tests/Unit/Model/DiversionTest.php @@ -0,0 +1,132 @@ + 'test_string', + 'privacy' => 'test_string', + 'screen' => 'test_string', + 'counter' => 'test_string', + 'limit' => 'test_string', + 'unknown' => 'test_string', + 'orig_to' => 'test_string' + ]); + } + + /** + * Test "Diversion" + */ + public function testDiversion() + { + $this->assertInstanceOf(Diversion::class, self::$instance); + } + + /** + * Test attribute "reason" + */ + public function testPropertyReason() + { + $this->assertIsString(self::$instance->getReason()); + $this->assertEquals('test_string', self::$instance->getReason()); + } + + /** + * Test attribute "privacy" + */ + public function testPropertyPrivacy() + { + $this->assertIsString(self::$instance->getPrivacy()); + $this->assertEquals('test_string', self::$instance->getPrivacy()); + } + + /** + * Test attribute "screen" + */ + public function testPropertyScreen() + { + $this->assertIsString(self::$instance->getScreen()); + $this->assertEquals('test_string', self::$instance->getScreen()); + } + + /** + * Test attribute "counter" + */ + public function testPropertyCounter() + { + $this->assertIsString(self::$instance->getCounter()); + $this->assertEquals('test_string', self::$instance->getCounter()); + } + + /** + * Test attribute "limit" + */ + public function testPropertyLimit() + { + $this->assertIsString(self::$instance->getLimit()); + $this->assertEquals('test_string', self::$instance->getLimit()); + } + + /** + * Test attribute "unknown" + */ + public function testPropertyUnknown() + { + $this->assertIsString(self::$instance->getUnknown()); + $this->assertEquals('test_string', self::$instance->getUnknown()); + } + + /** + * Test attribute "orig_to" + */ + public function testPropertyOrigTo() + { + $this->assertIsString(self::$instance->getOrigTo()); + $this->assertEquals('test_string', self::$instance->getOrigTo()); + }} diff --git a/tests/Unit/Model/DtmfCallbackTest.php b/tests/Unit/Model/DtmfCallbackTest.php new file mode 100644 index 0000000..82f3241 --- /dev/null +++ b/tests/Unit/Model/DtmfCallbackTest.php @@ -0,0 +1,233 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'call_id' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'digit' => 'test_string', + 'call_url' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'parent_call_id' => 'test_string', + 'transfer_caller_id' => 'test_string', + 'transfer_to' => 'test_string', + 'tag' => 'test_string' + ]); + } + + /** + * Test "DtmfCallback" + */ + public function testDtmfCallback() + { + $this->assertInstanceOf(DtmfCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "digit" + */ + public function testPropertyDigit() + { + $this->assertIsString(self::$instance->getDigit()); + $this->assertEquals('test_string', self::$instance->getDigit()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "parent_call_id" + */ + public function testPropertyParentCallId() + { + $this->assertIsString(self::$instance->getParentCallId()); + $this->assertEquals('test_string', self::$instance->getParentCallId()); + } + + /** + * Test attribute "transfer_caller_id" + */ + public function testPropertyTransferCallerId() + { + $this->assertIsString(self::$instance->getTransferCallerId()); + $this->assertEquals('test_string', self::$instance->getTransferCallerId()); + } + + /** + * Test attribute "transfer_to" + */ + public function testPropertyTransferTo() + { + $this->assertIsString(self::$instance->getTransferTo()); + $this->assertEquals('test_string', self::$instance->getTransferTo()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/EndpointDirectionEnumTest.php b/tests/Unit/Model/EndpointDirectionEnumTest.php new file mode 100644 index 0000000..b87456d --- /dev/null +++ b/tests/Unit/Model/EndpointDirectionEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['INBOUND', 'OUTBOUND', 'BIDIRECTIONAL'], + array_column(EndpointDirectionEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/EndpointEventTest.php b/tests/Unit/Model/EndpointEventTest.php new file mode 100644 index 0000000..6228f4d --- /dev/null +++ b/tests/Unit/Model/EndpointEventTest.php @@ -0,0 +1,155 @@ + 'test_string', + 'type' => EndpointTypeEnum::WEBRTC, + 'status' => EndpointStatusEnum::CONNECTED, + 'creation_timestamp' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'expiration_timestamp' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'event_type' => EndpointEventTypeEnum::DEVICE_CONNECTED, + 'device' => new Device([]) + ]); + } + + /** + * Test "EndpointEvent" + */ + public function testEndpointEvent() + { + $this->assertInstanceOf(EndpointEvent::class, self::$instance); + } + + /** + * Test attribute "endpoint_id" + */ + public function testPropertyEndpointId() + { + $this->assertIsString(self::$instance->getEndpointId()); + $this->assertEquals('test_string', self::$instance->getEndpointId()); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(EndpointTypeEnum::class, self::$instance->getType()); + $this->assertSame(EndpointTypeEnum::WEBRTC, self::$instance->getType()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(EndpointStatusEnum::class, self::$instance->getStatus()); + $this->assertSame(EndpointStatusEnum::CONNECTED, self::$instance->getStatus()); + } + + /** + * Test attribute "creation_timestamp" + */ + public function testPropertyCreationTimestamp() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getCreationTimestamp()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getCreationTimestamp()); + } + + /** + * Test attribute "expiration_timestamp" + */ + public function testPropertyExpirationTimestamp() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getExpirationTimestamp()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getExpirationTimestamp()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertInstanceOf(EndpointEventTypeEnum::class, self::$instance->getEventType()); + $this->assertSame(EndpointEventTypeEnum::DEVICE_CONNECTED, self::$instance->getEventType()); + } + + /** + * Test attribute "device" + */ + public function testPropertyDevice() + { + $this->assertInstanceOf(Device::class, self::$instance->getDevice()); + }} diff --git a/tests/Unit/Model/EndpointEventTypeEnumTest.php b/tests/Unit/Model/EndpointEventTypeEnumTest.php new file mode 100644 index 0000000..a87c28a --- /dev/null +++ b/tests/Unit/Model/EndpointEventTypeEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['DEVICE_CONNECTED', 'DEVICE_DISCONNECTED'], + array_column(EndpointEventTypeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/EndpointResponseTest.php b/tests/Unit/Model/EndpointResponseTest.php new file mode 100644 index 0000000..c6dc58d --- /dev/null +++ b/tests/Unit/Model/EndpointResponseTest.php @@ -0,0 +1,94 @@ + [new BrtcLink([])], + 'data' => new Endpoint([]), + 'errors' => [new BrtcError([])] + ]); + } + + /** + * Test "EndpointResponse" + */ + public function testEndpointResponse() + { + $this->assertInstanceOf(EndpointResponse::class, self::$instance); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + $this->assertIsArray(self::$instance->getLinks()); + $this->assertInstanceOf(BrtcLink::class, self::$instance->getLinks()[0]); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + $this->assertInstanceOf(Endpoint::class, self::$instance->getData()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertInstanceOf(BrtcError::class, self::$instance->getErrors()[0]); + }} diff --git a/tests/Unit/Model/EndpointStatusEnumTest.php b/tests/Unit/Model/EndpointStatusEnumTest.php new file mode 100644 index 0000000..b6d3998 --- /dev/null +++ b/tests/Unit/Model/EndpointStatusEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['CONNECTED', 'DISCONNECTED'], + array_column(EndpointStatusEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/EndpointTest.php b/tests/Unit/Model/EndpointTest.php new file mode 100644 index 0000000..9b8ae8a --- /dev/null +++ b/tests/Unit/Model/EndpointTest.php @@ -0,0 +1,135 @@ + 'test_string', + 'type' => EndpointTypeEnum::WEBRTC, + 'status' => EndpointStatusEnum::CONNECTED, + 'creation_timestamp' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'expiration_timestamp' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string', + 'devices' => [new Device([])] + ]); + } + + /** + * Test "Endpoint" + */ + public function testEndpoint() + { + $this->assertInstanceOf(Endpoint::class, self::$instance); + } + + /** + * Test attribute "endpoint_id" + */ + public function testPropertyEndpointId() + { + $this->assertIsString(self::$instance->getEndpointId()); + $this->assertEquals('test_string', self::$instance->getEndpointId()); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(EndpointTypeEnum::class, self::$instance->getType()); + $this->assertSame(EndpointTypeEnum::WEBRTC, self::$instance->getType()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(EndpointStatusEnum::class, self::$instance->getStatus()); + $this->assertSame(EndpointStatusEnum::CONNECTED, self::$instance->getStatus()); + } + + /** + * Test attribute "creation_timestamp" + */ + public function testPropertyCreationTimestamp() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getCreationTimestamp()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getCreationTimestamp()); + } + + /** + * Test attribute "expiration_timestamp" + */ + public function testPropertyExpirationTimestamp() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getExpirationTimestamp()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getExpirationTimestamp()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "devices" + */ + public function testPropertyDevices() + { + $this->assertIsArray(self::$instance->getDevices()); + $this->assertInstanceOf(Device::class, self::$instance->getDevices()[0]); + }} diff --git a/tests/Unit/Model/EndpointTypeEnumTest.php b/tests/Unit/Model/EndpointTypeEnumTest.php new file mode 100644 index 0000000..52621b7 --- /dev/null +++ b/tests/Unit/Model/EndpointTypeEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['WEBRTC'], + array_column(EndpointTypeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/EndpointsTest.php b/tests/Unit/Model/EndpointsTest.php new file mode 100644 index 0000000..2cdd490 --- /dev/null +++ b/tests/Unit/Model/EndpointsTest.php @@ -0,0 +1,124 @@ + 'test_string', + 'type' => EndpointTypeEnum::WEBRTC, + 'status' => EndpointStatusEnum::CONNECTED, + 'creation_timestamp' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'expiration_timestamp' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string' + ]); + } + + /** + * Test "Endpoints" + */ + public function testEndpoints() + { + $this->assertInstanceOf(Endpoints::class, self::$instance); + } + + /** + * Test attribute "endpoint_id" + */ + public function testPropertyEndpointId() + { + $this->assertIsString(self::$instance->getEndpointId()); + $this->assertEquals('test_string', self::$instance->getEndpointId()); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(EndpointTypeEnum::class, self::$instance->getType()); + $this->assertSame(EndpointTypeEnum::WEBRTC, self::$instance->getType()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(EndpointStatusEnum::class, self::$instance->getStatus()); + $this->assertSame(EndpointStatusEnum::CONNECTED, self::$instance->getStatus()); + } + + /** + * Test attribute "creation_timestamp" + */ + public function testPropertyCreationTimestamp() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getCreationTimestamp()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getCreationTimestamp()); + } + + /** + * Test attribute "expiration_timestamp" + */ + public function testPropertyExpirationTimestamp() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getExpirationTimestamp()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getExpirationTimestamp()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/ErrorObjectTest.php b/tests/Unit/Model/ErrorObjectTest.php new file mode 100644 index 0000000..473b859 --- /dev/null +++ b/tests/Unit/Model/ErrorObjectTest.php @@ -0,0 +1,92 @@ + 'test_string', + 'description' => 'test_string', + 'source' => new ErrorSource([]) + ]); + } + + /** + * Test "ErrorObject" + */ + public function testErrorObject() + { + $this->assertInstanceOf(ErrorObject::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertIsString(self::$instance->getType()); + $this->assertEquals('test_string', self::$instance->getType()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + } + + /** + * Test attribute "source" + */ + public function testPropertySource() + { + $this->assertInstanceOf(ErrorSource::class, self::$instance->getSource()); + }} diff --git a/tests/Unit/Model/ErrorSourceTest.php b/tests/Unit/Model/ErrorSourceTest.php new file mode 100644 index 0000000..951c526 --- /dev/null +++ b/tests/Unit/Model/ErrorSourceTest.php @@ -0,0 +1,102 @@ + 'test_string', + 'field' => 'test_string', + 'header' => 'test_string', + 'reference' => 'test_string' + ]); + } + + /** + * Test "ErrorSource" + */ + public function testErrorSource() + { + $this->assertInstanceOf(ErrorSource::class, self::$instance); + } + + /** + * Test attribute "parameter" + */ + public function testPropertyParameter() + { + $this->assertIsString(self::$instance->getParameter()); + $this->assertEquals('test_string', self::$instance->getParameter()); + } + + /** + * Test attribute "field" + */ + public function testPropertyField() + { + $this->assertIsString(self::$instance->getField()); + $this->assertEquals('test_string', self::$instance->getField()); + } + + /** + * Test attribute "header" + */ + public function testPropertyHeader() + { + $this->assertIsString(self::$instance->getHeader()); + $this->assertEquals('test_string', self::$instance->getHeader()); + } + + /** + * Test attribute "reference" + */ + public function testPropertyReference() + { + $this->assertIsString(self::$instance->getReference()); + $this->assertEquals('test_string', self::$instance->getReference()); + }} diff --git a/tests/Unit/Model/FailureWebhookTest.php b/tests/Unit/Model/FailureWebhookTest.php new file mode 100644 index 0000000..f24cb14 --- /dev/null +++ b/tests/Unit/Model/FailureWebhookTest.php @@ -0,0 +1,122 @@ + 'test_string', + 'phone_number' => 'test_string', + 'error_code' => 'test_string', + 'error_message' => 'test_string', + 'errors' => ['test_string'], + 'internal_ticket_number' => 'test_string' + ]); + } + + /** + * Test "FailureWebhook" + */ + public function testFailureWebhook() + { + $this->assertInstanceOf(FailureWebhook::class, self::$instance); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + $this->assertIsString(self::$instance->getPhoneNumber()); + $this->assertEquals('test_string', self::$instance->getPhoneNumber()); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + $this->assertIsString(self::$instance->getErrorCode()); + $this->assertEquals('test_string', self::$instance->getErrorCode()); + } + + /** + * Test attribute "error_message" + */ + public function testPropertyErrorMessage() + { + $this->assertIsString(self::$instance->getErrorMessage()); + $this->assertEquals('test_string', self::$instance->getErrorMessage()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertEquals(['test_string'], self::$instance->getErrors()); + } + + /** + * Test attribute "internal_ticket_number" + */ + public function testPropertyInternalTicketNumber() + { + $this->assertIsString(self::$instance->getInternalTicketNumber()); + $this->assertEquals('test_string', self::$instance->getInternalTicketNumber()); + }} diff --git a/tests/Unit/Model/FieldErrorTest.php b/tests/Unit/Model/FieldErrorTest.php new file mode 100644 index 0000000..9001e49 --- /dev/null +++ b/tests/Unit/Model/FieldErrorTest.php @@ -0,0 +1,82 @@ + 'test_string', + 'description' => 'test_string' + ]); + } + + /** + * Test "FieldError" + */ + public function testFieldError() + { + $this->assertInstanceOf(FieldError::class, self::$instance); + } + + /** + * Test attribute "field_name" + */ + public function testPropertyFieldName() + { + $this->assertIsString(self::$instance->getFieldName()); + $this->assertEquals('test_string', self::$instance->getFieldName()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + }} diff --git a/tests/Unit/Model/FileFormatEnumTest.php b/tests/Unit/Model/FileFormatEnumTest.php new file mode 100644 index 0000000..a81b7c9 --- /dev/null +++ b/tests/Unit/Model/FileFormatEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['mp3', 'wav'], + array_column(FileFormatEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/GatherCallbackTest.php b/tests/Unit/Model/GatherCallbackTest.php new file mode 100644 index 0000000..2202d30 --- /dev/null +++ b/tests/Unit/Model/GatherCallbackTest.php @@ -0,0 +1,243 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'digits' => 'test_string', + 'call_url' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'parent_call_id' => 'test_string', + 'terminating_digit' => 'test_string', + 'transfer_caller_id' => 'test_string', + 'transfer_to' => 'test_string', + 'tag' => 'test_string' + ]); + } + + /** + * Test "GatherCallback" + */ + public function testGatherCallback() + { + $this->assertInstanceOf(GatherCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "digits" + */ + public function testPropertyDigits() + { + $this->assertIsString(self::$instance->getDigits()); + $this->assertEquals('test_string', self::$instance->getDigits()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "parent_call_id" + */ + public function testPropertyParentCallId() + { + $this->assertIsString(self::$instance->getParentCallId()); + $this->assertEquals('test_string', self::$instance->getParentCallId()); + } + + /** + * Test attribute "terminating_digit" + */ + public function testPropertyTerminatingDigit() + { + $this->assertIsString(self::$instance->getTerminatingDigit()); + $this->assertEquals('test_string', self::$instance->getTerminatingDigit()); + } + + /** + * Test attribute "transfer_caller_id" + */ + public function testPropertyTransferCallerId() + { + $this->assertIsString(self::$instance->getTransferCallerId()); + $this->assertEquals('test_string', self::$instance->getTransferCallerId()); + } + + /** + * Test attribute "transfer_to" + */ + public function testPropertyTransferTo() + { + $this->assertIsString(self::$instance->getTransferTo()); + $this->assertEquals('test_string', self::$instance->getTransferTo()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/GetAsyncBulkLookupResponseDataTest.php b/tests/Unit/Model/GetAsyncBulkLookupResponseDataTest.php new file mode 100644 index 0000000..01025cb --- /dev/null +++ b/tests/Unit/Model/GetAsyncBulkLookupResponseDataTest.php @@ -0,0 +1,94 @@ + 'test_string', + 'status' => InProgressLookupStatusEnum::IN_PROGRESS, + 'results' => [new LookupResult([])] + ]); + } + + /** + * Test "GetAsyncBulkLookupResponseData" + */ + public function testGetAsyncBulkLookupResponseData() + { + $this->assertInstanceOf(GetAsyncBulkLookupResponseData::class, self::$instance); + } + + /** + * Test attribute "request_id" + */ + public function testPropertyRequestId() + { + $this->assertIsString(self::$instance->getRequestId()); + $this->assertEquals('test_string', self::$instance->getRequestId()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(InProgressLookupStatusEnum::class, self::$instance->getStatus()); + $this->assertSame(InProgressLookupStatusEnum::IN_PROGRESS, self::$instance->getStatus()); + } + + /** + * Test attribute "results" + */ + public function testPropertyResults() + { + $this->assertIsArray(self::$instance->getResults()); + $this->assertInstanceOf(LookupResult::class, self::$instance->getResults()[0]); + }} diff --git a/tests/Unit/Model/GetAsyncBulkLookupResponseTest.php b/tests/Unit/Model/GetAsyncBulkLookupResponseTest.php new file mode 100644 index 0000000..ce831d1 --- /dev/null +++ b/tests/Unit/Model/GetAsyncBulkLookupResponseTest.php @@ -0,0 +1,94 @@ + [new LinkSchema([])], + 'data' => new GetAsyncBulkLookupResponseData([]), + 'errors' => [new LookupErrorSchema([])] + ]); + } + + /** + * Test "GetAsyncBulkLookupResponse" + */ + public function testGetAsyncBulkLookupResponse() + { + $this->assertInstanceOf(GetAsyncBulkLookupResponse::class, self::$instance); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + $this->assertIsArray(self::$instance->getLinks()); + $this->assertInstanceOf(LinkSchema::class, self::$instance->getLinks()[0]); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + $this->assertInstanceOf(GetAsyncBulkLookupResponseData::class, self::$instance->getData()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertInstanceOf(LookupErrorSchema::class, self::$instance->getErrors()[0]); + }} diff --git a/tests/Unit/Model/InProgressLookupStatusEnumTest.php b/tests/Unit/Model/InProgressLookupStatusEnumTest.php new file mode 100644 index 0000000..e7c6801 --- /dev/null +++ b/tests/Unit/Model/InProgressLookupStatusEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['IN_PROGRESS', 'COMPLETE', 'PARTIAL_COMPLETE', 'FAILED'], + array_column(InProgressLookupStatusEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/InboundCallbackMessageTest.php b/tests/Unit/Model/InboundCallbackMessageTest.php new file mode 100644 index 0000000..d8714c5 --- /dev/null +++ b/tests/Unit/Model/InboundCallbackMessageTest.php @@ -0,0 +1,225 @@ + 'test_string', + 'owner' => 'test_string', + 'application_id' => 'test_string', + 'time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'segment_count' => 1, + 'direction' => MessageDirectionEnum::IN, + 'to' => ['test_string'], + 'from' => 'test_string', + 'text' => 'test_string', + 'tag' => 'test_string', + 'media' => ['test_string'], + 'priority' => PriorityEnum::_DEFAULT, + 'channel' => MultiChannelMessageChannelEnum::RBM, + 'content' => new MultiChannelMessageContent([]), + 'suggestion_response' => new RbmSuggestionResponse([]), + 'location_response' => new RbmLocationResponse([]) + ]); + } + + /** + * Test "InboundCallbackMessage" + */ + public function testInboundCallbackMessage() + { + $this->assertInstanceOf(InboundCallbackMessage::class, self::$instance); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + $this->assertIsString(self::$instance->getId()); + $this->assertEquals('test_string', self::$instance->getId()); + } + + /** + * Test attribute "owner" + */ + public function testPropertyOwner() + { + $this->assertIsString(self::$instance->getOwner()); + $this->assertEquals('test_string', self::$instance->getOwner()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "time" + */ + public function testPropertyTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getTime()); + } + + /** + * Test attribute "segment_count" + */ + public function testPropertySegmentCount() + { + $this->assertIsInt(self::$instance->getSegmentCount()); + $this->assertEquals(1, self::$instance->getSegmentCount()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(MessageDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(MessageDirectionEnum::IN, self::$instance->getDirection()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsArray(self::$instance->getTo()); + $this->assertEquals(['test_string'], self::$instance->getTo()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "media" + */ + public function testPropertyMedia() + { + $this->assertIsArray(self::$instance->getMedia()); + $this->assertEquals(['test_string'], self::$instance->getMedia()); + } + + /** + * Test attribute "priority" + */ + public function testPropertyPriority() + { + $this->assertInstanceOf(PriorityEnum::class, self::$instance->getPriority()); + $this->assertSame(PriorityEnum::_DEFAULT, self::$instance->getPriority()); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + $this->assertInstanceOf(MultiChannelMessageChannelEnum::class, self::$instance->getChannel()); + $this->assertSame(MultiChannelMessageChannelEnum::RBM, self::$instance->getChannel()); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + $this->assertInstanceOf(MultiChannelMessageContent::class, self::$instance->getContent()); + } + + /** + * Test attribute "suggestion_response" + */ + public function testPropertySuggestionResponse() + { + $this->assertInstanceOf(RbmSuggestionResponse::class, self::$instance->getSuggestionResponse()); + } + + /** + * Test attribute "location_response" + */ + public function testPropertyLocationResponse() + { + $this->assertInstanceOf(RbmLocationResponse::class, self::$instance->getLocationResponse()); + }} diff --git a/tests/Unit/Model/InboundCallbackTest.php b/tests/Unit/Model/InboundCallbackTest.php new file mode 100644 index 0000000..66df754 --- /dev/null +++ b/tests/Unit/Model/InboundCallbackTest.php @@ -0,0 +1,123 @@ + new \DateTime('2024-01-01T00:00:00+00:00'), + 'type' => InboundCallbackTypeEnum::MESSAGE_RECEIVED, + 'to' => 'test_string', + 'description' => 'test_string', + 'message' => new InboundCallbackMessage([]), + 'carrier_name' => 'test_string' + ]); + } + + /** + * Test "InboundCallback" + */ + public function testInboundCallback() + { + $this->assertInstanceOf(InboundCallback::class, self::$instance); + } + + /** + * Test attribute "time" + */ + public function testPropertyTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getTime()); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(InboundCallbackTypeEnum::class, self::$instance->getType()); + $this->assertSame(InboundCallbackTypeEnum::MESSAGE_RECEIVED, self::$instance->getType()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + $this->assertInstanceOf(InboundCallbackMessage::class, self::$instance->getMessage()); + } + + /** + * Test attribute "carrier_name" + */ + public function testPropertyCarrierName() + { + $this->assertIsString(self::$instance->getCarrierName()); + $this->assertEquals('test_string', self::$instance->getCarrierName()); + }} diff --git a/tests/Unit/Model/InboundCallbackTypeEnumTest.php b/tests/Unit/Model/InboundCallbackTypeEnumTest.php new file mode 100644 index 0000000..82d3415 --- /dev/null +++ b/tests/Unit/Model/InboundCallbackTypeEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['message-received', 'requested-location-response', 'suggestion-response'], + array_column(InboundCallbackTypeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/InitiateCallbackTest.php b/tests/Unit/Model/InitiateCallbackTest.php new file mode 100644 index 0000000..c2a12e1 --- /dev/null +++ b/tests/Unit/Model/InitiateCallbackTest.php @@ -0,0 +1,193 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'diversion' => new Diversion([]), + 'stir_shaken' => new StirShaken([]), + 'uui' => 'test_string' + ]); + } + + /** + * Test "InitiateCallback" + */ + public function testInitiateCallback() + { + $this->assertInstanceOf(InitiateCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "diversion" + */ + public function testPropertyDiversion() + { + $this->assertInstanceOf(Diversion::class, self::$instance->getDiversion()); + } + + /** + * Test attribute "stir_shaken" + */ + public function testPropertyStirShaken() + { + $this->assertInstanceOf(StirShaken::class, self::$instance->getStirShaken()); + } + + /** + * Test attribute "uui" + */ + public function testPropertyUui() + { + $this->assertIsString(self::$instance->getUui()); + $this->assertEquals('test_string', self::$instance->getUui()); + }} diff --git a/tests/Unit/Model/LatestMessageDeliveryStatusEnumTest.php b/tests/Unit/Model/LatestMessageDeliveryStatusEnumTest.php new file mode 100644 index 0000000..b5d21c0 --- /dev/null +++ b/tests/Unit/Model/LatestMessageDeliveryStatusEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['ACTIVE', 'DEACTIVATED', 'UNKNOWN', 'NOT_ENABLED'], + array_column(LatestMessageDeliveryStatusEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/LineTypeEnumTest.php b/tests/Unit/Model/LineTypeEnumTest.php new file mode 100644 index 0000000..e65dbf1 --- /dev/null +++ b/tests/Unit/Model/LineTypeEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['FIXED', 'VOIP-FIXED', 'MOBILE', 'VOIP'], + array_column(LineTypeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/LinkSchemaTest.php b/tests/Unit/Model/LinkSchemaTest.php new file mode 100644 index 0000000..da89a17 --- /dev/null +++ b/tests/Unit/Model/LinkSchemaTest.php @@ -0,0 +1,92 @@ + 'test_string', + 'rel' => 'test_string', + 'method' => 'test_string' + ]); + } + + /** + * Test "LinkSchema" + */ + public function testLinkSchema() + { + $this->assertInstanceOf(LinkSchema::class, self::$instance); + } + + /** + * Test attribute "href" + */ + public function testPropertyHref() + { + $this->assertIsString(self::$instance->getHref()); + $this->assertEquals('test_string', self::$instance->getHref()); + } + + /** + * Test attribute "rel" + */ + public function testPropertyRel() + { + $this->assertIsString(self::$instance->getRel()); + $this->assertEquals('test_string', self::$instance->getRel()); + } + + /** + * Test attribute "method" + */ + public function testPropertyMethod() + { + $this->assertIsString(self::$instance->getMethod()); + $this->assertEquals('test_string', self::$instance->getMethod()); + }} diff --git a/tests/Unit/Model/LinkTest.php b/tests/Unit/Model/LinkTest.php new file mode 100644 index 0000000..6a46a91 --- /dev/null +++ b/tests/Unit/Model/LinkTest.php @@ -0,0 +1,82 @@ + 'test_string', + 'href' => 'test_string' + ]); + } + + /** + * Test "Link" + */ + public function testLink() + { + $this->assertInstanceOf(Link::class, self::$instance); + } + + /** + * Test attribute "rel" + */ + public function testPropertyRel() + { + $this->assertIsString(self::$instance->getRel()); + $this->assertEquals('test_string', self::$instance->getRel()); + } + + /** + * Test attribute "href" + */ + public function testPropertyHref() + { + $this->assertIsString(self::$instance->getHref()); + $this->assertEquals('test_string', self::$instance->getHref()); + }} diff --git a/tests/Unit/Model/LinksObjectTest.php b/tests/Unit/Model/LinksObjectTest.php new file mode 100644 index 0000000..594aab0 --- /dev/null +++ b/tests/Unit/Model/LinksObjectTest.php @@ -0,0 +1,102 @@ + 'test_string', + 'next' => 'test_string', + 'previous' => 'test_string', + 'last' => 'test_string' + ]); + } + + /** + * Test "LinksObject" + */ + public function testLinksObject() + { + $this->assertInstanceOf(LinksObject::class, self::$instance); + } + + /** + * Test attribute "first" + */ + public function testPropertyFirst() + { + $this->assertIsString(self::$instance->getFirst()); + $this->assertEquals('test_string', self::$instance->getFirst()); + } + + /** + * Test attribute "next" + */ + public function testPropertyNext() + { + $this->assertIsString(self::$instance->getNext()); + $this->assertEquals('test_string', self::$instance->getNext()); + } + + /** + * Test attribute "previous" + */ + public function testPropertyPrevious() + { + $this->assertIsString(self::$instance->getPrevious()); + $this->assertEquals('test_string', self::$instance->getPrevious()); + } + + /** + * Test attribute "last" + */ + public function testPropertyLast() + { + $this->assertIsString(self::$instance->getLast()); + $this->assertEquals('test_string', self::$instance->getLast()); + }} diff --git a/tests/Unit/Model/ListEndpointsResponseTest.php b/tests/Unit/Model/ListEndpointsResponseTest.php new file mode 100644 index 0000000..e43c31c --- /dev/null +++ b/tests/Unit/Model/ListEndpointsResponseTest.php @@ -0,0 +1,105 @@ + [new BrtcLink([])], + 'page' => new Page([]), + 'data' => [new Endpoints([])], + 'errors' => [new BrtcError([])] + ]); + } + + /** + * Test "ListEndpointsResponse" + */ + public function testListEndpointsResponse() + { + $this->assertInstanceOf(ListEndpointsResponse::class, self::$instance); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + $this->assertIsArray(self::$instance->getLinks()); + $this->assertInstanceOf(BrtcLink::class, self::$instance->getLinks()[0]); + } + + /** + * Test attribute "page" + */ + public function testPropertyPage() + { + $this->assertInstanceOf(Page::class, self::$instance->getPage()); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + $this->assertIsArray(self::$instance->getData()); + $this->assertInstanceOf(Endpoints::class, self::$instance->getData()[0]); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertInstanceOf(BrtcError::class, self::$instance->getErrors()[0]); + }} diff --git a/tests/Unit/Model/ListMessageDirectionEnumTest.php b/tests/Unit/Model/ListMessageDirectionEnumTest.php new file mode 100644 index 0000000..a117bf7 --- /dev/null +++ b/tests/Unit/Model/ListMessageDirectionEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['INBOUND', 'OUTBOUND'], + array_column(ListMessageDirectionEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/ListMessageItemTest.php b/tests/Unit/Model/ListMessageItemTest.php new file mode 100644 index 0000000..c0bff34 --- /dev/null +++ b/tests/Unit/Model/ListMessageItemTest.php @@ -0,0 +1,295 @@ + 'test_string', + 'account_id' => 'test_string', + 'source_tn' => 'test_string', + 'destination_tn' => 'test_string', + 'message_status' => MessageStatusEnum::RECEIVED, + 'message_direction' => ListMessageDirectionEnum::INBOUND, + 'message_type' => MessageTypeEnum::SMS, + 'segment_count' => 1, + 'error_code' => 1, + 'receive_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'carrier_name' => 'test_string', + 'message_size' => 1, + 'message_length' => 1, + 'attachment_count' => 1, + 'recipient_count' => 1, + 'campaign_class' => 'test_string', + 'campaign_id' => 'test_string', + 'bw_latency' => 1, + 'carrier_latency' => 1, + 'calling_number_country_a3' => 'test_string', + 'called_number_country_a3' => 'test_string', + 'product' => 'test_string', + 'location' => 'test_string' + ]); + } + + /** + * Test "ListMessageItem" + */ + public function testListMessageItem() + { + $this->assertInstanceOf(ListMessageItem::class, self::$instance); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + $this->assertIsString(self::$instance->getMessageId()); + $this->assertEquals('test_string', self::$instance->getMessageId()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "source_tn" + */ + public function testPropertySourceTn() + { + $this->assertIsString(self::$instance->getSourceTn()); + $this->assertEquals('test_string', self::$instance->getSourceTn()); + } + + /** + * Test attribute "destination_tn" + */ + public function testPropertyDestinationTn() + { + $this->assertIsString(self::$instance->getDestinationTn()); + $this->assertEquals('test_string', self::$instance->getDestinationTn()); + } + + /** + * Test attribute "message_status" + */ + public function testPropertyMessageStatus() + { + $this->assertInstanceOf(MessageStatusEnum::class, self::$instance->getMessageStatus()); + $this->assertSame(MessageStatusEnum::RECEIVED, self::$instance->getMessageStatus()); + } + + /** + * Test attribute "message_direction" + */ + public function testPropertyMessageDirection() + { + $this->assertInstanceOf(ListMessageDirectionEnum::class, self::$instance->getMessageDirection()); + $this->assertSame(ListMessageDirectionEnum::INBOUND, self::$instance->getMessageDirection()); + } + + /** + * Test attribute "message_type" + */ + public function testPropertyMessageType() + { + $this->assertInstanceOf(MessageTypeEnum::class, self::$instance->getMessageType()); + $this->assertSame(MessageTypeEnum::SMS, self::$instance->getMessageType()); + } + + /** + * Test attribute "segment_count" + */ + public function testPropertySegmentCount() + { + $this->assertIsInt(self::$instance->getSegmentCount()); + $this->assertEquals(1, self::$instance->getSegmentCount()); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + $this->assertIsInt(self::$instance->getErrorCode()); + $this->assertEquals(1, self::$instance->getErrorCode()); + } + + /** + * Test attribute "receive_time" + */ + public function testPropertyReceiveTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getReceiveTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getReceiveTime()); + } + + /** + * Test attribute "carrier_name" + */ + public function testPropertyCarrierName() + { + $this->assertIsString(self::$instance->getCarrierName()); + $this->assertEquals('test_string', self::$instance->getCarrierName()); + } + + /** + * Test attribute "message_size" + */ + public function testPropertyMessageSize() + { + $this->assertIsInt(self::$instance->getMessageSize()); + $this->assertEquals(1, self::$instance->getMessageSize()); + } + + /** + * Test attribute "message_length" + */ + public function testPropertyMessageLength() + { + $this->assertIsInt(self::$instance->getMessageLength()); + $this->assertEquals(1, self::$instance->getMessageLength()); + } + + /** + * Test attribute "attachment_count" + */ + public function testPropertyAttachmentCount() + { + $this->assertIsInt(self::$instance->getAttachmentCount()); + $this->assertEquals(1, self::$instance->getAttachmentCount()); + } + + /** + * Test attribute "recipient_count" + */ + public function testPropertyRecipientCount() + { + $this->assertIsInt(self::$instance->getRecipientCount()); + $this->assertEquals(1, self::$instance->getRecipientCount()); + } + + /** + * Test attribute "campaign_class" + */ + public function testPropertyCampaignClass() + { + $this->assertIsString(self::$instance->getCampaignClass()); + $this->assertEquals('test_string', self::$instance->getCampaignClass()); + } + + /** + * Test attribute "campaign_id" + */ + public function testPropertyCampaignId() + { + $this->assertIsString(self::$instance->getCampaignId()); + $this->assertEquals('test_string', self::$instance->getCampaignId()); + } + + /** + * Test attribute "bw_latency" + */ + public function testPropertyBwLatency() + { + $this->assertIsInt(self::$instance->getBwLatency()); + $this->assertEquals(1, self::$instance->getBwLatency()); + } + + /** + * Test attribute "carrier_latency" + */ + public function testPropertyCarrierLatency() + { + $this->assertIsInt(self::$instance->getCarrierLatency()); + $this->assertEquals(1, self::$instance->getCarrierLatency()); + } + + /** + * Test attribute "calling_number_country_a3" + */ + public function testPropertyCallingNumberCountryA3() + { + $this->assertIsString(self::$instance->getCallingNumberCountryA3()); + $this->assertEquals('test_string', self::$instance->getCallingNumberCountryA3()); + } + + /** + * Test attribute "called_number_country_a3" + */ + public function testPropertyCalledNumberCountryA3() + { + $this->assertIsString(self::$instance->getCalledNumberCountryA3()); + $this->assertEquals('test_string', self::$instance->getCalledNumberCountryA3()); + } + + /** + * Test attribute "product" + */ + public function testPropertyProduct() + { + $this->assertIsString(self::$instance->getProduct()); + $this->assertEquals('test_string', self::$instance->getProduct()); + } + + /** + * Test attribute "location" + */ + public function testPropertyLocation() + { + $this->assertIsString(self::$instance->getLocation()); + $this->assertEquals('test_string', self::$instance->getLocation()); + }} diff --git a/tests/Unit/Model/LookupErrorResponseTest.php b/tests/Unit/Model/LookupErrorResponseTest.php new file mode 100644 index 0000000..368203a --- /dev/null +++ b/tests/Unit/Model/LookupErrorResponseTest.php @@ -0,0 +1,94 @@ + [new LinkSchema([])], + 'data' => (object) ['key' => 'value'], + 'errors' => [new LookupErrorSchema([])] + ]); + } + + /** + * Test "LookupErrorResponse" + */ + public function testLookupErrorResponse() + { + $this->assertInstanceOf(LookupErrorResponse::class, self::$instance); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + $this->assertIsArray(self::$instance->getLinks()); + $this->assertInstanceOf(LinkSchema::class, self::$instance->getLinks()[0]); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + $this->assertIsObject(self::$instance->getData()); + $this->assertEquals((object) ['key' => 'value'], self::$instance->getData()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertInstanceOf(LookupErrorSchema::class, self::$instance->getErrors()[0]); + }} diff --git a/tests/Unit/Model/LookupErrorSchemaMetaTest.php b/tests/Unit/Model/LookupErrorSchemaMetaTest.php new file mode 100644 index 0000000..3e5b424 --- /dev/null +++ b/tests/Unit/Model/LookupErrorSchemaMetaTest.php @@ -0,0 +1,92 @@ + ['test_string'], + 'message' => 'test_string', + 'code' => 1 + ]); + } + + /** + * Test "LookupErrorSchemaMeta" + */ + public function testLookupErrorSchemaMeta() + { + $this->assertInstanceOf(LookupErrorSchemaMeta::class, self::$instance); + } + + /** + * Test attribute "phone_numbers" + */ + public function testPropertyPhoneNumbers() + { + $this->assertIsArray(self::$instance->getPhoneNumbers()); + $this->assertEquals(['test_string'], self::$instance->getPhoneNumbers()); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + $this->assertIsString(self::$instance->getMessage()); + $this->assertEquals('test_string', self::$instance->getMessage()); + } + + /** + * Test attribute "code" + */ + public function testPropertyCode() + { + $this->assertIsInt(self::$instance->getCode()); + $this->assertEquals(1, self::$instance->getCode()); + }} diff --git a/tests/Unit/Model/LookupErrorSchemaTest.php b/tests/Unit/Model/LookupErrorSchemaTest.php new file mode 100644 index 0000000..4d6f4ae --- /dev/null +++ b/tests/Unit/Model/LookupErrorSchemaTest.php @@ -0,0 +1,102 @@ + 'test_string', + 'description' => 'test_string', + 'type' => 'test_string', + 'meta' => new LookupErrorSchemaMeta([]) + ]); + } + + /** + * Test "LookupErrorSchema" + */ + public function testLookupErrorSchema() + { + $this->assertInstanceOf(LookupErrorSchema::class, self::$instance); + } + + /** + * Test attribute "code" + */ + public function testPropertyCode() + { + $this->assertIsString(self::$instance->getCode()); + $this->assertEquals('test_string', self::$instance->getCode()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertIsString(self::$instance->getType()); + $this->assertEquals('test_string', self::$instance->getType()); + } + + /** + * Test attribute "meta" + */ + public function testPropertyMeta() + { + $this->assertInstanceOf(LookupErrorSchemaMeta::class, self::$instance->getMeta()); + }} diff --git a/tests/Unit/Model/LookupResultTest.php b/tests/Unit/Model/LookupResultTest.php new file mode 100644 index 0000000..69ab4e7 --- /dev/null +++ b/tests/Unit/Model/LookupResultTest.php @@ -0,0 +1,185 @@ + 'test_string', + 'line_type' => LineTypeEnum::FIXED, + 'messaging_provider' => 'test_string', + 'voice_provider' => 'test_string', + 'country_code_a3' => 'test_string', + 'deactivation_reporter' => 'test_string', + 'deactivation_date' => 'test_string', + 'deactivation_event' => DeactivationEventEnum::DEACTIVATED, + 'latest_message_delivery_status' => LatestMessageDeliveryStatusEnum::ACTIVE, + 'initial_message_delivery_status_date' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'latest_message_delivery_status_date' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'rcs_enabled' => true + ]); + } + + /** + * Test "LookupResult" + */ + public function testLookupResult() + { + $this->assertInstanceOf(LookupResult::class, self::$instance); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + $this->assertIsString(self::$instance->getPhoneNumber()); + $this->assertEquals('test_string', self::$instance->getPhoneNumber()); + } + + /** + * Test attribute "line_type" + */ + public function testPropertyLineType() + { + $this->assertInstanceOf(LineTypeEnum::class, self::$instance->getLineType()); + $this->assertSame(LineTypeEnum::FIXED, self::$instance->getLineType()); + } + + /** + * Test attribute "messaging_provider" + */ + public function testPropertyMessagingProvider() + { + $this->assertIsString(self::$instance->getMessagingProvider()); + $this->assertEquals('test_string', self::$instance->getMessagingProvider()); + } + + /** + * Test attribute "voice_provider" + */ + public function testPropertyVoiceProvider() + { + $this->assertIsString(self::$instance->getVoiceProvider()); + $this->assertEquals('test_string', self::$instance->getVoiceProvider()); + } + + /** + * Test attribute "country_code_a3" + */ + public function testPropertyCountryCodeA3() + { + $this->assertIsString(self::$instance->getCountryCodeA3()); + $this->assertEquals('test_string', self::$instance->getCountryCodeA3()); + } + + /** + * Test attribute "deactivation_reporter" + */ + public function testPropertyDeactivationReporter() + { + $this->assertIsString(self::$instance->getDeactivationReporter()); + $this->assertEquals('test_string', self::$instance->getDeactivationReporter()); + } + + /** + * Test attribute "deactivation_date" + */ + public function testPropertyDeactivationDate() + { + $this->assertIsString(self::$instance->getDeactivationDate()); + $this->assertEquals('test_string', self::$instance->getDeactivationDate()); + } + + /** + * Test attribute "deactivation_event" + */ + public function testPropertyDeactivationEvent() + { + $this->assertInstanceOf(DeactivationEventEnum::class, self::$instance->getDeactivationEvent()); + $this->assertSame(DeactivationEventEnum::DEACTIVATED, self::$instance->getDeactivationEvent()); + } + + /** + * Test attribute "latest_message_delivery_status" + */ + public function testPropertyLatestMessageDeliveryStatus() + { + $this->assertInstanceOf(LatestMessageDeliveryStatusEnum::class, self::$instance->getLatestMessageDeliveryStatus()); + $this->assertSame(LatestMessageDeliveryStatusEnum::ACTIVE, self::$instance->getLatestMessageDeliveryStatus()); + } + + /** + * Test attribute "initial_message_delivery_status_date" + */ + public function testPropertyInitialMessageDeliveryStatusDate() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getInitialMessageDeliveryStatusDate()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getInitialMessageDeliveryStatusDate()); + } + + /** + * Test attribute "latest_message_delivery_status_date" + */ + public function testPropertyLatestMessageDeliveryStatusDate() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getLatestMessageDeliveryStatusDate()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getLatestMessageDeliveryStatusDate()); + } + + /** + * Test attribute "rcs_enabled" + */ + public function testPropertyRcsEnabled() + { + $this->assertIsBool(self::$instance->getRcsEnabled()); + $this->assertTrue(self::$instance->getRcsEnabled()); + }} diff --git a/tests/Unit/Model/MachineDetectionCompleteCallbackTest.php b/tests/Unit/Model/MachineDetectionCompleteCallbackTest.php new file mode 100644 index 0000000..124f8f4 --- /dev/null +++ b/tests/Unit/Model/MachineDetectionCompleteCallbackTest.php @@ -0,0 +1,203 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string', + 'machine_detection_result' => new MachineDetectionResult([]) + ]); + } + + /** + * Test "MachineDetectionCompleteCallback" + */ + public function testMachineDetectionCompleteCallback() + { + $this->assertInstanceOf(MachineDetectionCompleteCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "machine_detection_result" + */ + public function testPropertyMachineDetectionResult() + { + $this->assertInstanceOf(MachineDetectionResult::class, self::$instance->getMachineDetectionResult()); + }} diff --git a/tests/Unit/Model/MachineDetectionConfigurationTest.php b/tests/Unit/Model/MachineDetectionConfigurationTest.php new file mode 100644 index 0000000..a578744 --- /dev/null +++ b/tests/Unit/Model/MachineDetectionConfigurationTest.php @@ -0,0 +1,214 @@ + MachineDetectionModeEnum::SYNC, + 'detection_timeout' => 1.5, + 'silence_timeout' => 1.5, + 'speech_threshold' => 1.5, + 'speech_end_threshold' => 1.5, + 'machine_speech_end_threshold' => 1.5, + 'delay_result' => true, + 'callback_url' => 'test_string', + 'callback_method' => CallbackMethodEnum::GET, + 'username' => 'test_string', + 'password' => 'test_string', + 'fallback_url' => 'test_string', + 'fallback_method' => CallbackMethodEnum::GET, + 'fallback_username' => 'test_string', + 'fallback_password' => 'test_string' + ]); + } + + /** + * Test "MachineDetectionConfiguration" + */ + public function testMachineDetectionConfiguration() + { + $this->assertInstanceOf(MachineDetectionConfiguration::class, self::$instance); + } + + /** + * Test attribute "mode" + */ + public function testPropertyMode() + { + $this->assertInstanceOf(MachineDetectionModeEnum::class, self::$instance->getMode()); + $this->assertSame(MachineDetectionModeEnum::SYNC, self::$instance->getMode()); + } + + /** + * Test attribute "detection_timeout" + */ + public function testPropertyDetectionTimeout() + { + $this->assertIsFloat(self::$instance->getDetectionTimeout()); + $this->assertEquals(1.5, self::$instance->getDetectionTimeout()); + } + + /** + * Test attribute "silence_timeout" + */ + public function testPropertySilenceTimeout() + { + $this->assertIsFloat(self::$instance->getSilenceTimeout()); + $this->assertEquals(1.5, self::$instance->getSilenceTimeout()); + } + + /** + * Test attribute "speech_threshold" + */ + public function testPropertySpeechThreshold() + { + $this->assertIsFloat(self::$instance->getSpeechThreshold()); + $this->assertEquals(1.5, self::$instance->getSpeechThreshold()); + } + + /** + * Test attribute "speech_end_threshold" + */ + public function testPropertySpeechEndThreshold() + { + $this->assertIsFloat(self::$instance->getSpeechEndThreshold()); + $this->assertEquals(1.5, self::$instance->getSpeechEndThreshold()); + } + + /** + * Test attribute "machine_speech_end_threshold" + */ + public function testPropertyMachineSpeechEndThreshold() + { + $this->assertIsFloat(self::$instance->getMachineSpeechEndThreshold()); + $this->assertEquals(1.5, self::$instance->getMachineSpeechEndThreshold()); + } + + /** + * Test attribute "delay_result" + */ + public function testPropertyDelayResult() + { + $this->assertIsBool(self::$instance->getDelayResult()); + $this->assertTrue(self::$instance->getDelayResult()); + } + + /** + * Test attribute "callback_url" + */ + public function testPropertyCallbackUrl() + { + $this->assertIsString(self::$instance->getCallbackUrl()); + $this->assertEquals('test_string', self::$instance->getCallbackUrl()); + } + + /** + * Test attribute "callback_method" + */ + public function testPropertyCallbackMethod() + { + $this->assertInstanceOf(CallbackMethodEnum::class, self::$instance->getCallbackMethod()); + $this->assertSame(CallbackMethodEnum::GET, self::$instance->getCallbackMethod()); + } + + /** + * Test attribute "username" + */ + public function testPropertyUsername() + { + $this->assertIsString(self::$instance->getUsername()); + $this->assertEquals('test_string', self::$instance->getUsername()); + } + + /** + * Test attribute "password" + */ + public function testPropertyPassword() + { + $this->assertIsString(self::$instance->getPassword()); + $this->assertEquals('test_string', self::$instance->getPassword()); + } + + /** + * Test attribute "fallback_url" + */ + public function testPropertyFallbackUrl() + { + $this->assertIsString(self::$instance->getFallbackUrl()); + $this->assertEquals('test_string', self::$instance->getFallbackUrl()); + } + + /** + * Test attribute "fallback_method" + */ + public function testPropertyFallbackMethod() + { + $this->assertInstanceOf(CallbackMethodEnum::class, self::$instance->getFallbackMethod()); + $this->assertSame(CallbackMethodEnum::GET, self::$instance->getFallbackMethod()); + } + + /** + * Test attribute "fallback_username" + */ + public function testPropertyFallbackUsername() + { + $this->assertIsString(self::$instance->getFallbackUsername()); + $this->assertEquals('test_string', self::$instance->getFallbackUsername()); + } + + /** + * Test attribute "fallback_password" + */ + public function testPropertyFallbackPassword() + { + $this->assertIsString(self::$instance->getFallbackPassword()); + $this->assertEquals('test_string', self::$instance->getFallbackPassword()); + }} diff --git a/tests/Unit/Model/MachineDetectionModeEnumTest.php b/tests/Unit/Model/MachineDetectionModeEnumTest.php new file mode 100644 index 0000000..09ae13d --- /dev/null +++ b/tests/Unit/Model/MachineDetectionModeEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['sync', 'async'], + array_column(MachineDetectionModeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/MachineDetectionResultTest.php b/tests/Unit/Model/MachineDetectionResultTest.php new file mode 100644 index 0000000..2f0af84 --- /dev/null +++ b/tests/Unit/Model/MachineDetectionResultTest.php @@ -0,0 +1,82 @@ + 'test_string', + 'duration' => 'test_string' + ]); + } + + /** + * Test "MachineDetectionResult" + */ + public function testMachineDetectionResult() + { + $this->assertInstanceOf(MachineDetectionResult::class, self::$instance); + } + + /** + * Test attribute "value" + */ + public function testPropertyValue() + { + $this->assertIsString(self::$instance->getValue()); + $this->assertEquals('test_string', self::$instance->getValue()); + } + + /** + * Test attribute "duration" + */ + public function testPropertyDuration() + { + $this->assertIsString(self::$instance->getDuration()); + $this->assertEquals('test_string', self::$instance->getDuration()); + }} diff --git a/tests/Unit/Model/MediaTest.php b/tests/Unit/Model/MediaTest.php new file mode 100644 index 0000000..659ebec --- /dev/null +++ b/tests/Unit/Model/MediaTest.php @@ -0,0 +1,92 @@ + 'test_string', + 'content_length' => 1, + 'media_name' => 'test_string' + ]); + } + + /** + * Test "Media" + */ + public function testMedia() + { + $this->assertInstanceOf(Media::class, self::$instance); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + $this->assertIsString(self::$instance->getContent()); + $this->assertEquals('test_string', self::$instance->getContent()); + } + + /** + * Test attribute "content_length" + */ + public function testPropertyContentLength() + { + $this->assertIsInt(self::$instance->getContentLength()); + $this->assertEquals(1, self::$instance->getContentLength()); + } + + /** + * Test attribute "media_name" + */ + public function testPropertyMediaName() + { + $this->assertIsString(self::$instance->getMediaName()); + $this->assertEquals('test_string', self::$instance->getMediaName()); + }} diff --git a/tests/Unit/Model/MessageDirectionEnumTest.php b/tests/Unit/Model/MessageDirectionEnumTest.php new file mode 100644 index 0000000..43bf58a --- /dev/null +++ b/tests/Unit/Model/MessageDirectionEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['in', 'out'], + array_column(MessageDirectionEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/MessageRequestTest.php b/tests/Unit/Model/MessageRequestTest.php new file mode 100644 index 0000000..babf914 --- /dev/null +++ b/tests/Unit/Model/MessageRequestTest.php @@ -0,0 +1,143 @@ + 'test_string', + 'to' => ['test_string'], + 'from' => 'test_string', + 'text' => 'test_string', + 'media' => ['test_string'], + 'tag' => 'test_string', + 'priority' => PriorityEnum::_DEFAULT, + 'expiration' => new \DateTime('2024-01-01T00:00:00+00:00') + ]); + } + + /** + * Test "MessageRequest" + */ + public function testMessageRequest() + { + $this->assertInstanceOf(MessageRequest::class, self::$instance); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsArray(self::$instance->getTo()); + $this->assertEquals(['test_string'], self::$instance->getTo()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "media" + */ + public function testPropertyMedia() + { + $this->assertIsArray(self::$instance->getMedia()); + $this->assertEquals(['test_string'], self::$instance->getMedia()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "priority" + */ + public function testPropertyPriority() + { + $this->assertInstanceOf(PriorityEnum::class, self::$instance->getPriority()); + $this->assertSame(PriorityEnum::_DEFAULT, self::$instance->getPriority()); + } + + /** + * Test attribute "expiration" + */ + public function testPropertyExpiration() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getExpiration()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getExpiration()); + }} diff --git a/tests/Unit/Model/MessageStatusEnumTest.php b/tests/Unit/Model/MessageStatusEnumTest.php new file mode 100644 index 0000000..f81f43f --- /dev/null +++ b/tests/Unit/Model/MessageStatusEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['RECEIVED', 'QUEUED', 'SENDING', 'SENT', 'FAILED', 'DELIVERED', 'ACCEPTED', 'UNDELIVERED'], + array_column(MessageStatusEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/MessageTest.php b/tests/Unit/Model/MessageTest.php new file mode 100644 index 0000000..0beafff --- /dev/null +++ b/tests/Unit/Model/MessageTest.php @@ -0,0 +1,194 @@ + 'test_string', + 'owner' => 'test_string', + 'application_id' => 'test_string', + 'time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'segment_count' => 1, + 'direction' => MessageDirectionEnum::IN, + 'to' => ['test_string'], + 'from' => 'test_string', + 'media' => ['test_string'], + 'text' => 'test_string', + 'tag' => 'test_string', + 'priority' => PriorityEnum::_DEFAULT, + 'expiration' => new \DateTime('2024-01-01T00:00:00+00:00') + ]); + } + + /** + * Test "Message" + */ + public function testMessage() + { + $this->assertInstanceOf(Message::class, self::$instance); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + $this->assertIsString(self::$instance->getId()); + $this->assertEquals('test_string', self::$instance->getId()); + } + + /** + * Test attribute "owner" + */ + public function testPropertyOwner() + { + $this->assertIsString(self::$instance->getOwner()); + $this->assertEquals('test_string', self::$instance->getOwner()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "time" + */ + public function testPropertyTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getTime()); + } + + /** + * Test attribute "segment_count" + */ + public function testPropertySegmentCount() + { + $this->assertIsInt(self::$instance->getSegmentCount()); + $this->assertEquals(1, self::$instance->getSegmentCount()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(MessageDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(MessageDirectionEnum::IN, self::$instance->getDirection()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsArray(self::$instance->getTo()); + $this->assertEquals(['test_string'], self::$instance->getTo()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "media" + */ + public function testPropertyMedia() + { + $this->assertIsArray(self::$instance->getMedia()); + $this->assertEquals(['test_string'], self::$instance->getMedia()); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "priority" + */ + public function testPropertyPriority() + { + $this->assertInstanceOf(PriorityEnum::class, self::$instance->getPriority()); + $this->assertSame(PriorityEnum::_DEFAULT, self::$instance->getPriority()); + } + + /** + * Test attribute "expiration" + */ + public function testPropertyExpiration() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getExpiration()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getExpiration()); + }} diff --git a/tests/Unit/Model/MessageTypeEnumTest.php b/tests/Unit/Model/MessageTypeEnumTest.php new file mode 100644 index 0000000..219ea60 --- /dev/null +++ b/tests/Unit/Model/MessageTypeEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['sms', 'mms', 'rcs'], + array_column(MessageTypeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/MessagesListTest.php b/tests/Unit/Model/MessagesListTest.php new file mode 100644 index 0000000..48d09ed --- /dev/null +++ b/tests/Unit/Model/MessagesListTest.php @@ -0,0 +1,93 @@ + 1, + 'page_info' => new PageInfo([]), + 'messages' => [new ListMessageItem([])] + ]); + } + + /** + * Test "MessagesList" + */ + public function testMessagesList() + { + $this->assertInstanceOf(MessagesList::class, self::$instance); + } + + /** + * Test attribute "total_count" + */ + public function testPropertyTotalCount() + { + $this->assertIsInt(self::$instance->getTotalCount()); + $this->assertEquals(1, self::$instance->getTotalCount()); + } + + /** + * Test attribute "page_info" + */ + public function testPropertyPageInfo() + { + $this->assertInstanceOf(PageInfo::class, self::$instance->getPageInfo()); + } + + /** + * Test attribute "messages" + */ + public function testPropertyMessages() + { + $this->assertIsArray(self::$instance->getMessages()); + $this->assertInstanceOf(ListMessageItem::class, self::$instance->getMessages()[0]); + }} diff --git a/tests/Unit/Model/MessagingCodeResponseTest.php b/tests/Unit/Model/MessagingCodeResponseTest.php new file mode 100644 index 0000000..dfdd5b5 --- /dev/null +++ b/tests/Unit/Model/MessagingCodeResponseTest.php @@ -0,0 +1,72 @@ + 'test_string' + ]); + } + + /** + * Test "MessagingCodeResponse" + */ + public function testMessagingCodeResponse() + { + $this->assertInstanceOf(MessagingCodeResponse::class, self::$instance); + } + + /** + * Test attribute "message_id" + */ + public function testPropertyMessageId() + { + $this->assertIsString(self::$instance->getMessageId()); + $this->assertEquals('test_string', self::$instance->getMessageId()); + }} diff --git a/tests/Unit/Model/MessagingRequestErrorTest.php b/tests/Unit/Model/MessagingRequestErrorTest.php new file mode 100644 index 0000000..054b390 --- /dev/null +++ b/tests/Unit/Model/MessagingRequestErrorTest.php @@ -0,0 +1,82 @@ + 'test_string', + 'description' => 'test_string' + ]); + } + + /** + * Test "MessagingRequestError" + */ + public function testMessagingRequestError() + { + $this->assertInstanceOf(MessagingRequestError::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertIsString(self::$instance->getType()); + $this->assertEquals('test_string', self::$instance->getType()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + }} diff --git a/tests/Unit/Model/MfaForbiddenRequestErrorTest.php b/tests/Unit/Model/MfaForbiddenRequestErrorTest.php new file mode 100644 index 0000000..bc86707 --- /dev/null +++ b/tests/Unit/Model/MfaForbiddenRequestErrorTest.php @@ -0,0 +1,72 @@ + 'test_string' + ]); + } + + /** + * Test "MfaForbiddenRequestError" + */ + public function testMfaForbiddenRequestError() + { + $this->assertInstanceOf(MfaForbiddenRequestError::class, self::$instance); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + $this->assertIsString(self::$instance->getMessage()); + $this->assertEquals('test_string', self::$instance->getMessage()); + }} diff --git a/tests/Unit/Model/MfaRequestErrorTest.php b/tests/Unit/Model/MfaRequestErrorTest.php new file mode 100644 index 0000000..bc2cd6d --- /dev/null +++ b/tests/Unit/Model/MfaRequestErrorTest.php @@ -0,0 +1,82 @@ + 'test_string', + 'request_id' => 'test_string' + ]); + } + + /** + * Test "MfaRequestError" + */ + public function testMfaRequestError() + { + $this->assertInstanceOf(MfaRequestError::class, self::$instance); + } + + /** + * Test attribute "error" + */ + public function testPropertyError() + { + $this->assertIsString(self::$instance->getError()); + $this->assertEquals('test_string', self::$instance->getError()); + } + + /** + * Test attribute "request_id" + */ + public function testPropertyRequestId() + { + $this->assertIsString(self::$instance->getRequestId()); + $this->assertEquals('test_string', self::$instance->getRequestId()); + }} diff --git a/tests/Unit/Model/MfaUnauthorizedRequestErrorTest.php b/tests/Unit/Model/MfaUnauthorizedRequestErrorTest.php new file mode 100644 index 0000000..294e04f --- /dev/null +++ b/tests/Unit/Model/MfaUnauthorizedRequestErrorTest.php @@ -0,0 +1,72 @@ + 'test_string' + ]); + } + + /** + * Test "MfaUnauthorizedRequestError" + */ + public function testMfaUnauthorizedRequestError() + { + $this->assertInstanceOf(MfaUnauthorizedRequestError::class, self::$instance); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + $this->assertIsString(self::$instance->getMessage()); + $this->assertEquals('test_string', self::$instance->getMessage()); + }} diff --git a/tests/Unit/Model/MmsMessageContentFileTest.php b/tests/Unit/Model/MmsMessageContentFileTest.php new file mode 100644 index 0000000..1651ec3 --- /dev/null +++ b/tests/Unit/Model/MmsMessageContentFileTest.php @@ -0,0 +1,72 @@ + 'test_string' + ]); + } + + /** + * Test "MmsMessageContentFile" + */ + public function testMmsMessageContentFile() + { + $this->assertInstanceOf(MmsMessageContentFile::class, self::$instance); + } + + /** + * Test attribute "file_url" + */ + public function testPropertyFileUrl() + { + $this->assertIsString(self::$instance->getFileUrl()); + $this->assertEquals('test_string', self::$instance->getFileUrl()); + }} diff --git a/tests/Unit/Model/MmsMessageContentTest.php b/tests/Unit/Model/MmsMessageContentTest.php new file mode 100644 index 0000000..5e11f12 --- /dev/null +++ b/tests/Unit/Model/MmsMessageContentTest.php @@ -0,0 +1,83 @@ + 'test_string', + 'media' => [new MmsMessageContentFile([])] + ]); + } + + /** + * Test "MmsMessageContent" + */ + public function testMmsMessageContent() + { + $this->assertInstanceOf(MmsMessageContent::class, self::$instance); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "media" + */ + public function testPropertyMedia() + { + $this->assertIsArray(self::$instance->getMedia()); + $this->assertInstanceOf(MmsMessageContentFile::class, self::$instance->getMedia()[0]); + }} diff --git a/tests/Unit/Model/MultiChannelActionCalendarEventTest.php b/tests/Unit/Model/MultiChannelActionCalendarEventTest.php new file mode 100644 index 0000000..92e1b32 --- /dev/null +++ b/tests/Unit/Model/MultiChannelActionCalendarEventTest.php @@ -0,0 +1,133 @@ + RbmActionTypeEnum::REPLY, + 'text' => 'test_string', + 'postback_data' => 'test_string', + 'title' => 'test_string', + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'end_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'description' => 'test_string' + ]); + } + + /** + * Test "MultiChannelActionCalendarEvent" + */ + public function testMultiChannelActionCalendarEvent() + { + $this->assertInstanceOf(MultiChannelActionCalendarEvent::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(RbmActionTypeEnum::class, self::$instance->getType()); + $this->assertSame(RbmActionTypeEnum::REPLY, self::$instance->getType()); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "postback_data" + */ + public function testPropertyPostbackData() + { + $this->assertIsString(self::$instance->getPostbackData()); + $this->assertEquals('test_string', self::$instance->getPostbackData()); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + $this->assertIsString(self::$instance->getTitle()); + $this->assertEquals('test_string', self::$instance->getTitle()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "end_time" + */ + public function testPropertyEndTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEndTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEndTime()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + }} diff --git a/tests/Unit/Model/MultiChannelActionTest.php b/tests/Unit/Model/MultiChannelActionTest.php new file mode 100644 index 0000000..5f7c9f6 --- /dev/null +++ b/tests/Unit/Model/MultiChannelActionTest.php @@ -0,0 +1,117 @@ +assertSame( + [ + RbmActionBase::class, + RbmActionDial::class, + RbmActionViewLocation::class, + MultiChannelActionCalendarEvent::class, + RbmActionOpenUrl::class + ], + array_map(fn($type) => ltrim($type, '\\'), MultiChannelAction::getAnyOfTypes()) + ); + $this->assertSame('type', MultiChannelAction::getAnyOfDiscriminator()); + $this->assertSame( + [ + 'CREATE_CALENDAR_EVENT' => MultiChannelActionCalendarEvent::class, + 'DIAL_PHONE' => RbmActionDial::class, + 'OPEN_URL' => RbmActionOpenUrl::class, + 'REPLY' => RbmActionBase::class, + 'REQUEST_LOCATION' => RbmActionBase::class, + 'SHOW_LOCATION' => RbmActionViewLocation::class + ], + array_map(fn($type) => ltrim($type, '\\'), MultiChannelAction::getAnyOfDiscriminatorMappings()) + ); + } + + /** + * Test that each discriminator value deserializes to its mapped type + * + * @dataProvider discriminatorProvider + */ + public function testDeserializeResolvesDiscriminator(string $type, string $expected) + { + $result = ObjectSerializer::deserialize((object) ['type' => $type], MultiChannelAction::class); + + $this->assertInstanceOf($expected, $result); + $this->assertSame($type, $result->getType()->value); + } + + /** + * Test that an unmapped discriminator value is rejected + */ + public function testDeserializeRejectsUnknownDiscriminator() + { + $this->expectException(\InvalidArgumentException::class); + + ObjectSerializer::deserialize((object) ['type' => 'NOT_AN_ACTION'], MultiChannelAction::class); + } + + /** + * @return array + */ + public static function discriminatorProvider(): array + { + return [ + 'CREATE_CALENDAR_EVENT' => ['CREATE_CALENDAR_EVENT', MultiChannelActionCalendarEvent::class], + 'DIAL_PHONE' => ['DIAL_PHONE', RbmActionDial::class], + 'OPEN_URL' => ['OPEN_URL', RbmActionOpenUrl::class], + 'REPLY' => ['REPLY', RbmActionBase::class], + 'REQUEST_LOCATION' => ['REQUEST_LOCATION', RbmActionBase::class], + 'SHOW_LOCATION' => ['SHOW_LOCATION', RbmActionViewLocation::class] + ]; + } +} diff --git a/tests/Unit/Model/MultiChannelChannelListMMSObjectTest.php b/tests/Unit/Model/MultiChannelChannelListMMSObjectTest.php new file mode 100644 index 0000000..cc28f8f --- /dev/null +++ b/tests/Unit/Model/MultiChannelChannelListMMSObjectTest.php @@ -0,0 +1,103 @@ + 'test_string', + 'application_id' => 'test_string', + 'channel' => MultiChannelMessageChannelEnum::RBM, + 'content' => new MmsMessageContent([]) + ]); + } + + /** + * Test "MultiChannelChannelListMMSObject" + */ + public function testMultiChannelChannelListMMSObject() + { + $this->assertInstanceOf(MultiChannelChannelListMMSObject::class, self::$instance); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + $this->assertInstanceOf(MultiChannelMessageChannelEnum::class, self::$instance->getChannel()); + $this->assertSame(MultiChannelMessageChannelEnum::RBM, self::$instance->getChannel()); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + $this->assertInstanceOf(MmsMessageContent::class, self::$instance->getContent()); + }} diff --git a/tests/Unit/Model/MultiChannelChannelListMMSResponseObjectTest.php b/tests/Unit/Model/MultiChannelChannelListMMSResponseObjectTest.php new file mode 100644 index 0000000..28776c9 --- /dev/null +++ b/tests/Unit/Model/MultiChannelChannelListMMSResponseObjectTest.php @@ -0,0 +1,113 @@ + 'test_string', + 'application_id' => 'test_string', + 'channel' => MultiChannelMessageChannelEnum::RBM, + 'content' => new MmsMessageContent([]), + 'owner' => 'test_string' + ]); + } + + /** + * Test "MultiChannelChannelListMMSResponseObject" + */ + public function testMultiChannelChannelListMMSResponseObject() + { + $this->assertInstanceOf(MultiChannelChannelListMMSResponseObject::class, self::$instance); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + $this->assertInstanceOf(MultiChannelMessageChannelEnum::class, self::$instance->getChannel()); + $this->assertSame(MultiChannelMessageChannelEnum::RBM, self::$instance->getChannel()); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + $this->assertInstanceOf(MmsMessageContent::class, self::$instance->getContent()); + } + + /** + * Test attribute "owner" + */ + public function testPropertyOwner() + { + $this->assertIsString(self::$instance->getOwner()); + $this->assertEquals('test_string', self::$instance->getOwner()); + }} diff --git a/tests/Unit/Model/MultiChannelChannelListObjectBaseTest.php b/tests/Unit/Model/MultiChannelChannelListObjectBaseTest.php new file mode 100644 index 0000000..2a1b3f5 --- /dev/null +++ b/tests/Unit/Model/MultiChannelChannelListObjectBaseTest.php @@ -0,0 +1,93 @@ + 'test_string', + 'application_id' => 'test_string', + 'channel' => MultiChannelMessageChannelEnum::RBM + ]); + } + + /** + * Test "MultiChannelChannelListObjectBase" + */ + public function testMultiChannelChannelListObjectBase() + { + $this->assertInstanceOf(MultiChannelChannelListObjectBase::class, self::$instance); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + $this->assertInstanceOf(MultiChannelMessageChannelEnum::class, self::$instance->getChannel()); + $this->assertSame(MultiChannelMessageChannelEnum::RBM, self::$instance->getChannel()); + }} diff --git a/tests/Unit/Model/MultiChannelChannelListOwnerObjectTest.php b/tests/Unit/Model/MultiChannelChannelListOwnerObjectTest.php new file mode 100644 index 0000000..7fefe73 --- /dev/null +++ b/tests/Unit/Model/MultiChannelChannelListOwnerObjectTest.php @@ -0,0 +1,72 @@ + 'test_string' + ]); + } + + /** + * Test "MultiChannelChannelListOwnerObject" + */ + public function testMultiChannelChannelListOwnerObject() + { + $this->assertInstanceOf(MultiChannelChannelListOwnerObject::class, self::$instance); + } + + /** + * Test attribute "owner" + */ + public function testPropertyOwner() + { + $this->assertIsString(self::$instance->getOwner()); + $this->assertEquals('test_string', self::$instance->getOwner()); + }} diff --git a/tests/Unit/Model/MultiChannelChannelListRBMObjectAllOfContentTest.php b/tests/Unit/Model/MultiChannelChannelListRBMObjectAllOfContentTest.php new file mode 100644 index 0000000..b61b965 --- /dev/null +++ b/tests/Unit/Model/MultiChannelChannelListRBMObjectAllOfContentTest.php @@ -0,0 +1,80 @@ + 'test_string', + 'application_id' => 'test_string', + 'channel' => MultiChannelMessageChannelEnum::RBM, + 'content' => new RbmMessageContentText([]) + ]); + } + + /** + * Test "MultiChannelChannelListRBMObject" + */ + public function testMultiChannelChannelListRBMObject() + { + $this->assertInstanceOf(MultiChannelChannelListRBMObject::class, self::$instance); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + $this->assertInstanceOf(MultiChannelMessageChannelEnum::class, self::$instance->getChannel()); + $this->assertSame(MultiChannelMessageChannelEnum::RBM, self::$instance->getChannel()); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + $this->assertInstanceOf(RbmMessageContentText::class, self::$instance->getContent()); + }} diff --git a/tests/Unit/Model/MultiChannelChannelListRBMResponseObjectTest.php b/tests/Unit/Model/MultiChannelChannelListRBMResponseObjectTest.php new file mode 100644 index 0000000..2ac362e --- /dev/null +++ b/tests/Unit/Model/MultiChannelChannelListRBMResponseObjectTest.php @@ -0,0 +1,113 @@ + 'test_string', + 'application_id' => 'test_string', + 'channel' => MultiChannelMessageChannelEnum::RBM, + 'content' => new RbmMessageContentText([]), + 'owner' => 'test_string' + ]); + } + + /** + * Test "MultiChannelChannelListRBMResponseObject" + */ + public function testMultiChannelChannelListRBMResponseObject() + { + $this->assertInstanceOf(MultiChannelChannelListRBMResponseObject::class, self::$instance); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + $this->assertInstanceOf(MultiChannelMessageChannelEnum::class, self::$instance->getChannel()); + $this->assertSame(MultiChannelMessageChannelEnum::RBM, self::$instance->getChannel()); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + $this->assertInstanceOf(RbmMessageContentText::class, self::$instance->getContent()); + } + + /** + * Test attribute "owner" + */ + public function testPropertyOwner() + { + $this->assertIsString(self::$instance->getOwner()); + $this->assertEquals('test_string', self::$instance->getOwner()); + }} diff --git a/tests/Unit/Model/MultiChannelChannelListRequestObjectTest.php b/tests/Unit/Model/MultiChannelChannelListRequestObjectTest.php new file mode 100644 index 0000000..da213fe --- /dev/null +++ b/tests/Unit/Model/MultiChannelChannelListRequestObjectTest.php @@ -0,0 +1,116 @@ +assertSame( + [ + MultiChannelChannelListRBMObject::class, + MultiChannelChannelListSMSObject::class, + MultiChannelChannelListMMSObject::class + ], + array_map(fn($type) => ltrim($type, '\\'), MultiChannelChannelListRequestObject::getAnyOfTypes()) + ); + $this->assertSame('channel', MultiChannelChannelListRequestObject::getAnyOfDiscriminator()); + $this->assertSame( + [ + 'MMS' => MultiChannelChannelListMMSObject::class, + 'RBM' => MultiChannelChannelListRBMObject::class, + 'SMS' => MultiChannelChannelListSMSObject::class + ], + array_map( + fn($type) => ltrim($type, '\\'), + MultiChannelChannelListRequestObject::getAnyOfDiscriminatorMappings() + ) + ); + } + + /** + * Test that each discriminator value deserializes to its mapped type + * + * @dataProvider discriminatorProvider + */ + public function testDeserializeResolvesDiscriminator(string $channel, string $expected) + { + $result = ObjectSerializer::deserialize( + (object) ['channel' => $channel], + MultiChannelChannelListRequestObject::class + ); + + $this->assertInstanceOf($expected, $result); + $this->assertSame($channel, $result->getChannel()->value); + } + + /** + * Test that an unmapped discriminator value is rejected + */ + public function testDeserializeRejectsUnknownDiscriminator() + { + $this->expectException(\InvalidArgumentException::class); + + ObjectSerializer::deserialize( + (object) ['channel' => 'FAX'], + MultiChannelChannelListRequestObject::class + ); + } + + /** + * @return array + */ + public static function discriminatorProvider(): array + { + return [ + 'MMS' => ['MMS', MultiChannelChannelListMMSObject::class], + 'RBM' => ['RBM', MultiChannelChannelListRBMObject::class], + 'SMS' => ['SMS', MultiChannelChannelListSMSObject::class] + ]; + } +} diff --git a/tests/Unit/Model/MultiChannelChannelListResponseObjectTest.php b/tests/Unit/Model/MultiChannelChannelListResponseObjectTest.php new file mode 100644 index 0000000..3270d2e --- /dev/null +++ b/tests/Unit/Model/MultiChannelChannelListResponseObjectTest.php @@ -0,0 +1,116 @@ +assertSame( + [ + MultiChannelChannelListRBMResponseObject::class, + MultiChannelChannelListSMSResponseObject::class, + MultiChannelChannelListMMSResponseObject::class + ], + array_map(fn($type) => ltrim($type, '\\'), MultiChannelChannelListResponseObject::getAnyOfTypes()) + ); + $this->assertSame('channel', MultiChannelChannelListResponseObject::getAnyOfDiscriminator()); + $this->assertSame( + [ + 'MMS' => MultiChannelChannelListMMSResponseObject::class, + 'RBM' => MultiChannelChannelListRBMResponseObject::class, + 'SMS' => MultiChannelChannelListSMSResponseObject::class + ], + array_map( + fn($type) => ltrim($type, '\\'), + MultiChannelChannelListResponseObject::getAnyOfDiscriminatorMappings() + ) + ); + } + + /** + * Test that each discriminator value deserializes to its mapped type + * + * @dataProvider discriminatorProvider + */ + public function testDeserializeResolvesDiscriminator(string $channel, string $expected) + { + $result = ObjectSerializer::deserialize( + (object) ['channel' => $channel], + MultiChannelChannelListResponseObject::class + ); + + $this->assertInstanceOf($expected, $result); + $this->assertSame($channel, $result->getChannel()->value); + } + + /** + * Test that an unmapped discriminator value is rejected + */ + public function testDeserializeRejectsUnknownDiscriminator() + { + $this->expectException(\InvalidArgumentException::class); + + ObjectSerializer::deserialize( + (object) ['channel' => 'FAX'], + MultiChannelChannelListResponseObject::class + ); + } + + /** + * @return array + */ + public static function discriminatorProvider(): array + { + return [ + 'MMS' => ['MMS', MultiChannelChannelListMMSResponseObject::class], + 'RBM' => ['RBM', MultiChannelChannelListRBMResponseObject::class], + 'SMS' => ['SMS', MultiChannelChannelListSMSResponseObject::class] + ]; + } +} diff --git a/tests/Unit/Model/MultiChannelChannelListSMSObjectTest.php b/tests/Unit/Model/MultiChannelChannelListSMSObjectTest.php new file mode 100644 index 0000000..f8231f9 --- /dev/null +++ b/tests/Unit/Model/MultiChannelChannelListSMSObjectTest.php @@ -0,0 +1,103 @@ + 'test_string', + 'application_id' => 'test_string', + 'channel' => MultiChannelMessageChannelEnum::RBM, + 'content' => new SmsMessageContent([]) + ]); + } + + /** + * Test "MultiChannelChannelListSMSObject" + */ + public function testMultiChannelChannelListSMSObject() + { + $this->assertInstanceOf(MultiChannelChannelListSMSObject::class, self::$instance); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + $this->assertInstanceOf(MultiChannelMessageChannelEnum::class, self::$instance->getChannel()); + $this->assertSame(MultiChannelMessageChannelEnum::RBM, self::$instance->getChannel()); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + $this->assertInstanceOf(SmsMessageContent::class, self::$instance->getContent()); + }} diff --git a/tests/Unit/Model/MultiChannelChannelListSMSResponseObjectTest.php b/tests/Unit/Model/MultiChannelChannelListSMSResponseObjectTest.php new file mode 100644 index 0000000..720d191 --- /dev/null +++ b/tests/Unit/Model/MultiChannelChannelListSMSResponseObjectTest.php @@ -0,0 +1,113 @@ + 'test_string', + 'application_id' => 'test_string', + 'channel' => MultiChannelMessageChannelEnum::RBM, + 'content' => new SmsMessageContent([]), + 'owner' => 'test_string' + ]); + } + + /** + * Test "MultiChannelChannelListSMSResponseObject" + */ + public function testMultiChannelChannelListSMSResponseObject() + { + $this->assertInstanceOf(MultiChannelChannelListSMSResponseObject::class, self::$instance); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + $this->assertInstanceOf(MultiChannelMessageChannelEnum::class, self::$instance->getChannel()); + $this->assertSame(MultiChannelMessageChannelEnum::RBM, self::$instance->getChannel()); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + $this->assertInstanceOf(SmsMessageContent::class, self::$instance->getContent()); + } + + /** + * Test attribute "owner" + */ + public function testPropertyOwner() + { + $this->assertIsString(self::$instance->getOwner()); + $this->assertEquals('test_string', self::$instance->getOwner()); + }} diff --git a/tests/Unit/Model/MultiChannelErrorTest.php b/tests/Unit/Model/MultiChannelErrorTest.php new file mode 100644 index 0000000..ee2fb35 --- /dev/null +++ b/tests/Unit/Model/MultiChannelErrorTest.php @@ -0,0 +1,94 @@ + [new Link([])], + 'data' => (object) ['key' => 'value'], + 'errors' => [new ErrorObject([])] + ]); + } + + /** + * Test "MultiChannelError" + */ + public function testMultiChannelError() + { + $this->assertInstanceOf(MultiChannelError::class, self::$instance); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + $this->assertIsArray(self::$instance->getLinks()); + $this->assertInstanceOf(Link::class, self::$instance->getLinks()[0]); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + $this->assertIsObject(self::$instance->getData()); + $this->assertEquals((object) ['key' => 'value'], self::$instance->getData()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertInstanceOf(ErrorObject::class, self::$instance->getErrors()[0]); + }} diff --git a/tests/Unit/Model/MultiChannelMessageChannelEnumTest.php b/tests/Unit/Model/MultiChannelMessageChannelEnumTest.php new file mode 100644 index 0000000..3ed7102 --- /dev/null +++ b/tests/Unit/Model/MultiChannelMessageChannelEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['RBM', 'SMS', 'MMS'], + array_column(MultiChannelMessageChannelEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/MultiChannelMessageContentTest.php b/tests/Unit/Model/MultiChannelMessageContentTest.php new file mode 100644 index 0000000..334d310 --- /dev/null +++ b/tests/Unit/Model/MultiChannelMessageContentTest.php @@ -0,0 +1,82 @@ + 'test_string', + 'media' => new RbmMessageContentFile([]) + ]); + } + + /** + * Test "MultiChannelMessageContent" + */ + public function testMultiChannelMessageContent() + { + $this->assertInstanceOf(MultiChannelMessageContent::class, self::$instance); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "media" + */ + public function testPropertyMedia() + { + $this->assertInstanceOf(RbmMessageContentFile::class, self::$instance->getMedia()); + }} diff --git a/tests/Unit/Model/MultiChannelMessageRequestTest.php b/tests/Unit/Model/MultiChannelMessageRequestTest.php new file mode 100644 index 0000000..bd14604 --- /dev/null +++ b/tests/Unit/Model/MultiChannelMessageRequestTest.php @@ -0,0 +1,114 @@ + 'test_string', + 'channel_list' => [new MultiChannelChannelListRBMObject([])], + 'tag' => 'test_string', + 'priority' => PriorityEnum::_DEFAULT, + 'expiration' => new \DateTime('2024-01-01T00:00:00+00:00') + ]); + } + + /** + * Test "MultiChannelMessageRequest" + */ + public function testMultiChannelMessageRequest() + { + $this->assertInstanceOf(MultiChannelMessageRequest::class, self::$instance); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "channel_list" + */ + public function testPropertyChannelList() + { + $this->assertIsArray(self::$instance->getChannelList()); + $this->assertInstanceOf(MultiChannelChannelListRBMObject::class, self::$instance->getChannelList()[0]); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "priority" + */ + public function testPropertyPriority() + { + $this->assertInstanceOf(PriorityEnum::class, self::$instance->getPriority()); + $this->assertSame(PriorityEnum::_DEFAULT, self::$instance->getPriority()); + } + + /** + * Test attribute "expiration" + */ + public function testPropertyExpiration() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getExpiration()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getExpiration()); + }} diff --git a/tests/Unit/Model/MultiChannelMessageResponseDataTest.php b/tests/Unit/Model/MultiChannelMessageResponseDataTest.php new file mode 100644 index 0000000..a7bbc7b --- /dev/null +++ b/tests/Unit/Model/MultiChannelMessageResponseDataTest.php @@ -0,0 +1,145 @@ + 'test_string', + 'time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'direction' => MessageDirectionEnum::IN, + 'to' => ['test_string'], + 'channel_list' => [new MultiChannelChannelListRBMResponseObject([])], + 'tag' => 'test_string', + 'priority' => PriorityEnum::_DEFAULT, + 'expiration' => new \DateTime('2024-01-01T00:00:00+00:00') + ]); + } + + /** + * Test "MultiChannelMessageResponseData" + */ + public function testMultiChannelMessageResponseData() + { + $this->assertInstanceOf(MultiChannelMessageResponseData::class, self::$instance); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + $this->assertIsString(self::$instance->getId()); + $this->assertEquals('test_string', self::$instance->getId()); + } + + /** + * Test attribute "time" + */ + public function testPropertyTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getTime()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(MessageDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(MessageDirectionEnum::IN, self::$instance->getDirection()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsArray(self::$instance->getTo()); + $this->assertEquals(['test_string'], self::$instance->getTo()); + } + + /** + * Test attribute "channel_list" + */ + public function testPropertyChannelList() + { + $this->assertIsArray(self::$instance->getChannelList()); + $this->assertInstanceOf(MultiChannelChannelListRBMResponseObject::class, self::$instance->getChannelList()[0]); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "priority" + */ + public function testPropertyPriority() + { + $this->assertInstanceOf(PriorityEnum::class, self::$instance->getPriority()); + $this->assertSame(PriorityEnum::_DEFAULT, self::$instance->getPriority()); + } + + /** + * Test attribute "expiration" + */ + public function testPropertyExpiration() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getExpiration()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getExpiration()); + }} diff --git a/tests/Unit/Model/OptInWorkflowTest.php b/tests/Unit/Model/OptInWorkflowTest.php new file mode 100644 index 0000000..0a7ed0c --- /dev/null +++ b/tests/Unit/Model/OptInWorkflowTest.php @@ -0,0 +1,92 @@ + 'test_string', + 'image_urls' => ['test_string'], + 'confirmation_response' => 'test_string' + ]); + } + + /** + * Test "OptInWorkflow" + */ + public function testOptInWorkflow() + { + $this->assertInstanceOf(OptInWorkflow::class, self::$instance); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + } + + /** + * Test attribute "image_urls" + */ + public function testPropertyImageUrls() + { + $this->assertIsArray(self::$instance->getImageUrls()); + $this->assertEquals(['test_string'], self::$instance->getImageUrls()); + } + + /** + * Test attribute "confirmation_response" + */ + public function testPropertyConfirmationResponse() + { + $this->assertIsString(self::$instance->getConfirmationResponse()); + $this->assertEquals('test_string', self::$instance->getConfirmationResponse()); + }} diff --git a/tests/Unit/Model/PageInfoTest.php b/tests/Unit/Model/PageInfoTest.php new file mode 100644 index 0000000..d4824ab --- /dev/null +++ b/tests/Unit/Model/PageInfoTest.php @@ -0,0 +1,102 @@ + 'test_string', + 'next_page' => 'test_string', + 'prev_page_token' => 'test_string', + 'next_page_token' => 'test_string' + ]); + } + + /** + * Test "PageInfo" + */ + public function testPageInfo() + { + $this->assertInstanceOf(PageInfo::class, self::$instance); + } + + /** + * Test attribute "prev_page" + */ + public function testPropertyPrevPage() + { + $this->assertIsString(self::$instance->getPrevPage()); + $this->assertEquals('test_string', self::$instance->getPrevPage()); + } + + /** + * Test attribute "next_page" + */ + public function testPropertyNextPage() + { + $this->assertIsString(self::$instance->getNextPage()); + $this->assertEquals('test_string', self::$instance->getNextPage()); + } + + /** + * Test attribute "prev_page_token" + */ + public function testPropertyPrevPageToken() + { + $this->assertIsString(self::$instance->getPrevPageToken()); + $this->assertEquals('test_string', self::$instance->getPrevPageToken()); + } + + /** + * Test attribute "next_page_token" + */ + public function testPropertyNextPageToken() + { + $this->assertIsString(self::$instance->getNextPageToken()); + $this->assertEquals('test_string', self::$instance->getNextPageToken()); + }} diff --git a/tests/Unit/Model/PageTest.php b/tests/Unit/Model/PageTest.php new file mode 100644 index 0000000..c902b29 --- /dev/null +++ b/tests/Unit/Model/PageTest.php @@ -0,0 +1,102 @@ + 1, + 'total_elements' => 1, + 'total_pages' => 1, + 'page_number' => 1 + ]); + } + + /** + * Test "Page" + */ + public function testPage() + { + $this->assertInstanceOf(Page::class, self::$instance); + } + + /** + * Test attribute "page_size" + */ + public function testPropertyPageSize() + { + $this->assertIsInt(self::$instance->getPageSize()); + $this->assertEquals(1, self::$instance->getPageSize()); + } + + /** + * Test attribute "total_elements" + */ + public function testPropertyTotalElements() + { + $this->assertIsInt(self::$instance->getTotalElements()); + $this->assertEquals(1, self::$instance->getTotalElements()); + } + + /** + * Test attribute "total_pages" + */ + public function testPropertyTotalPages() + { + $this->assertIsInt(self::$instance->getTotalPages()); + $this->assertEquals(1, self::$instance->getTotalPages()); + } + + /** + * Test attribute "page_number" + */ + public function testPropertyPageNumber() + { + $this->assertIsInt(self::$instance->getPageNumber()); + $this->assertEquals(1, self::$instance->getPageNumber()); + }} diff --git a/tests/Unit/Model/PriorityEnumTest.php b/tests/Unit/Model/PriorityEnumTest.php new file mode 100644 index 0000000..e9efd13 --- /dev/null +++ b/tests/Unit/Model/PriorityEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['default', 'high'], + array_column(PriorityEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/ProductTypeEnumTest.php b/tests/Unit/Model/ProductTypeEnumTest.php new file mode 100644 index 0000000..885abca --- /dev/null +++ b/tests/Unit/Model/ProductTypeEnumTest.php @@ -0,0 +1,66 @@ +assertSame( + [ + 'LOCAL_A2P', + 'P2P', + 'SHORT_CODE_REACH', + 'TOLL_FREE', + 'HOSTED_SHORT_CODE', + 'ALPHA_NUMERIC', + 'RBM_MEDIA', + 'RBM_RICH', + 'RBM_CONVERSATIONAL' + ], + array_column(ProductTypeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/RbmActionBaseTest.php b/tests/Unit/Model/RbmActionBaseTest.php new file mode 100644 index 0000000..ca45907 --- /dev/null +++ b/tests/Unit/Model/RbmActionBaseTest.php @@ -0,0 +1,93 @@ + RbmActionTypeEnum::REPLY, + 'text' => 'test_string', + 'postback_data' => 'test_string' + ]); + } + + /** + * Test "RbmActionBase" + */ + public function testRbmActionBase() + { + $this->assertInstanceOf(RbmActionBase::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(RbmActionTypeEnum::class, self::$instance->getType()); + $this->assertSame(RbmActionTypeEnum::REPLY, self::$instance->getType()); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "postback_data" + */ + public function testPropertyPostbackData() + { + $this->assertIsString(self::$instance->getPostbackData()); + $this->assertEquals('test_string', self::$instance->getPostbackData()); + }} diff --git a/tests/Unit/Model/RbmActionDialTest.php b/tests/Unit/Model/RbmActionDialTest.php new file mode 100644 index 0000000..1e4cc2f --- /dev/null +++ b/tests/Unit/Model/RbmActionDialTest.php @@ -0,0 +1,103 @@ + RbmActionTypeEnum::REPLY, + 'text' => 'test_string', + 'postback_data' => 'test_string', + 'phone_number' => 'test_string' + ]); + } + + /** + * Test "RbmActionDial" + */ + public function testRbmActionDial() + { + $this->assertInstanceOf(RbmActionDial::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(RbmActionTypeEnum::class, self::$instance->getType()); + $this->assertSame(RbmActionTypeEnum::REPLY, self::$instance->getType()); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "postback_data" + */ + public function testPropertyPostbackData() + { + $this->assertIsString(self::$instance->getPostbackData()); + $this->assertEquals('test_string', self::$instance->getPostbackData()); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + $this->assertIsString(self::$instance->getPhoneNumber()); + $this->assertEquals('test_string', self::$instance->getPhoneNumber()); + }} diff --git a/tests/Unit/Model/RbmActionOpenUrlTest.php b/tests/Unit/Model/RbmActionOpenUrlTest.php new file mode 100644 index 0000000..fc65b9b --- /dev/null +++ b/tests/Unit/Model/RbmActionOpenUrlTest.php @@ -0,0 +1,125 @@ + RbmActionTypeEnum::REPLY, + 'text' => 'test_string', + 'postback_data' => 'test_string', + 'url' => 'test_string', + 'application' => RbmOpenUrlEnum::BROWSER, + 'webview_view_mode' => RbmWebViewEnum::FULL + ]); + } + + /** + * Test "RbmActionOpenUrl" + */ + public function testRbmActionOpenUrl() + { + $this->assertInstanceOf(RbmActionOpenUrl::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(RbmActionTypeEnum::class, self::$instance->getType()); + $this->assertSame(RbmActionTypeEnum::REPLY, self::$instance->getType()); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "postback_data" + */ + public function testPropertyPostbackData() + { + $this->assertIsString(self::$instance->getPostbackData()); + $this->assertEquals('test_string', self::$instance->getPostbackData()); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + $this->assertIsString(self::$instance->getUrl()); + $this->assertEquals('test_string', self::$instance->getUrl()); + } + + /** + * Test attribute "application" + */ + public function testPropertyApplication() + { + $this->assertInstanceOf(RbmOpenUrlEnum::class, self::$instance->getApplication()); + $this->assertSame(RbmOpenUrlEnum::BROWSER, self::$instance->getApplication()); + } + + /** + * Test attribute "webview_view_mode" + */ + public function testPropertyWebviewViewMode() + { + $this->assertInstanceOf(RbmWebViewEnum::class, self::$instance->getWebviewViewMode()); + $this->assertSame(RbmWebViewEnum::FULL, self::$instance->getWebviewViewMode()); + }} diff --git a/tests/Unit/Model/RbmActionTypeEnumTest.php b/tests/Unit/Model/RbmActionTypeEnumTest.php new file mode 100644 index 0000000..2b07ef1 --- /dev/null +++ b/tests/Unit/Model/RbmActionTypeEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['REPLY', 'DIAL_PHONE', 'SHOW_LOCATION', 'CREATE_CALENDAR_EVENT', 'OPEN_URL', 'REQUEST_LOCATION'], + array_column(RbmActionTypeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/RbmActionViewLocationTest.php b/tests/Unit/Model/RbmActionViewLocationTest.php new file mode 100644 index 0000000..f9b18fd --- /dev/null +++ b/tests/Unit/Model/RbmActionViewLocationTest.php @@ -0,0 +1,123 @@ + RbmActionTypeEnum::REPLY, + 'text' => 'test_string', + 'postback_data' => 'test_string', + 'latitude' => 1.5, + 'longitude' => 1.5, + 'label' => 'test_string' + ]); + } + + /** + * Test "RbmActionViewLocation" + */ + public function testRbmActionViewLocation() + { + $this->assertInstanceOf(RbmActionViewLocation::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(RbmActionTypeEnum::class, self::$instance->getType()); + $this->assertSame(RbmActionTypeEnum::REPLY, self::$instance->getType()); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "postback_data" + */ + public function testPropertyPostbackData() + { + $this->assertIsString(self::$instance->getPostbackData()); + $this->assertEquals('test_string', self::$instance->getPostbackData()); + } + + /** + * Test attribute "latitude" + */ + public function testPropertyLatitude() + { + $this->assertIsFloat(self::$instance->getLatitude()); + $this->assertEquals(1.5, self::$instance->getLatitude()); + } + + /** + * Test attribute "longitude" + */ + public function testPropertyLongitude() + { + $this->assertIsFloat(self::$instance->getLongitude()); + $this->assertEquals(1.5, self::$instance->getLongitude()); + } + + /** + * Test attribute "label" + */ + public function testPropertyLabel() + { + $this->assertIsString(self::$instance->getLabel()); + $this->assertEquals('test_string', self::$instance->getLabel()); + }} diff --git a/tests/Unit/Model/RbmCardContentMediaTest.php b/tests/Unit/Model/RbmCardContentMediaTest.php new file mode 100644 index 0000000..78243ac --- /dev/null +++ b/tests/Unit/Model/RbmCardContentMediaTest.php @@ -0,0 +1,93 @@ + 'test_string', + 'thumbnail_url' => 'test_string', + 'height' => RbmMediaHeightEnum::SHORT + ]); + } + + /** + * Test "RbmCardContentMedia" + */ + public function testRbmCardContentMedia() + { + $this->assertInstanceOf(RbmCardContentMedia::class, self::$instance); + } + + /** + * Test attribute "file_url" + */ + public function testPropertyFileUrl() + { + $this->assertIsString(self::$instance->getFileUrl()); + $this->assertEquals('test_string', self::$instance->getFileUrl()); + } + + /** + * Test attribute "thumbnail_url" + */ + public function testPropertyThumbnailUrl() + { + $this->assertIsString(self::$instance->getThumbnailUrl()); + $this->assertEquals('test_string', self::$instance->getThumbnailUrl()); + } + + /** + * Test attribute "height" + */ + public function testPropertyHeight() + { + $this->assertInstanceOf(RbmMediaHeightEnum::class, self::$instance->getHeight()); + $this->assertSame(RbmMediaHeightEnum::SHORT, self::$instance->getHeight()); + }} diff --git a/tests/Unit/Model/RbmCardContentTest.php b/tests/Unit/Model/RbmCardContentTest.php new file mode 100644 index 0000000..cdd7c87 --- /dev/null +++ b/tests/Unit/Model/RbmCardContentTest.php @@ -0,0 +1,103 @@ + 'test_string', + 'description' => 'test_string', + 'media' => new RbmCardContentMedia([]), + 'suggestions' => [new RbmActionBase([])] + ]); + } + + /** + * Test "RbmCardContent" + */ + public function testRbmCardContent() + { + $this->assertInstanceOf(RbmCardContent::class, self::$instance); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + $this->assertIsString(self::$instance->getTitle()); + $this->assertEquals('test_string', self::$instance->getTitle()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + } + + /** + * Test attribute "media" + */ + public function testPropertyMedia() + { + $this->assertInstanceOf(RbmCardContentMedia::class, self::$instance->getMedia()); + } + + /** + * Test attribute "suggestions" + */ + public function testPropertySuggestions() + { + $this->assertIsArray(self::$instance->getSuggestions()); + $this->assertInstanceOf(RbmActionBase::class, self::$instance->getSuggestions()[0]); + }} diff --git a/tests/Unit/Model/RbmLocationResponseTest.php b/tests/Unit/Model/RbmLocationResponseTest.php new file mode 100644 index 0000000..a694521 --- /dev/null +++ b/tests/Unit/Model/RbmLocationResponseTest.php @@ -0,0 +1,82 @@ + 1.5, + 'longitude' => 1.5 + ]); + } + + /** + * Test "RbmLocationResponse" + */ + public function testRbmLocationResponse() + { + $this->assertInstanceOf(RbmLocationResponse::class, self::$instance); + } + + /** + * Test attribute "latitude" + */ + public function testPropertyLatitude() + { + $this->assertIsFloat(self::$instance->getLatitude()); + $this->assertEquals(1.5, self::$instance->getLatitude()); + } + + /** + * Test attribute "longitude" + */ + public function testPropertyLongitude() + { + $this->assertIsFloat(self::$instance->getLongitude()); + $this->assertEquals(1.5, self::$instance->getLongitude()); + }} diff --git a/tests/Unit/Model/RbmMediaHeightEnumTest.php b/tests/Unit/Model/RbmMediaHeightEnumTest.php new file mode 100644 index 0000000..9ac1a8c --- /dev/null +++ b/tests/Unit/Model/RbmMediaHeightEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['SHORT', 'MEDIUM', 'TALL'], + array_column(RbmMediaHeightEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/RbmMessageCarouselCardTest.php b/tests/Unit/Model/RbmMessageCarouselCardTest.php new file mode 100644 index 0000000..2d73dfd --- /dev/null +++ b/tests/Unit/Model/RbmMessageCarouselCardTest.php @@ -0,0 +1,95 @@ + CardWidthEnum::SMALL, + 'card_contents' => [new RbmCardContent([])], + 'suggestions' => [new RbmActionBase([])] + ]); + } + + /** + * Test "RbmMessageCarouselCard" + */ + public function testRbmMessageCarouselCard() + { + $this->assertInstanceOf(RbmMessageCarouselCard::class, self::$instance); + } + + /** + * Test attribute "card_width" + */ + public function testPropertyCardWidth() + { + $this->assertInstanceOf(CardWidthEnum::class, self::$instance->getCardWidth()); + $this->assertSame(CardWidthEnum::SMALL, self::$instance->getCardWidth()); + } + + /** + * Test attribute "card_contents" + */ + public function testPropertyCardContents() + { + $this->assertIsArray(self::$instance->getCardContents()); + $this->assertInstanceOf(RbmCardContent::class, self::$instance->getCardContents()[0]); + } + + /** + * Test attribute "suggestions" + */ + public function testPropertySuggestions() + { + $this->assertIsArray(self::$instance->getSuggestions()); + $this->assertInstanceOf(RbmActionBase::class, self::$instance->getSuggestions()[0]); + }} diff --git a/tests/Unit/Model/RbmMessageContentFileTest.php b/tests/Unit/Model/RbmMessageContentFileTest.php new file mode 100644 index 0000000..ddfdd32 --- /dev/null +++ b/tests/Unit/Model/RbmMessageContentFileTest.php @@ -0,0 +1,82 @@ + 'test_string', + 'thumbnail_url' => 'test_string' + ]); + } + + /** + * Test "RbmMessageContentFile" + */ + public function testRbmMessageContentFile() + { + $this->assertInstanceOf(RbmMessageContentFile::class, self::$instance); + } + + /** + * Test attribute "file_url" + */ + public function testPropertyFileUrl() + { + $this->assertIsString(self::$instance->getFileUrl()); + $this->assertEquals('test_string', self::$instance->getFileUrl()); + } + + /** + * Test attribute "thumbnail_url" + */ + public function testPropertyThumbnailUrl() + { + $this->assertIsString(self::$instance->getThumbnailUrl()); + $this->assertEquals('test_string', self::$instance->getThumbnailUrl()); + }} diff --git a/tests/Unit/Model/RbmMessageContentRichCardTest.php b/tests/Unit/Model/RbmMessageContentRichCardTest.php new file mode 100644 index 0000000..efb0de9 --- /dev/null +++ b/tests/Unit/Model/RbmMessageContentRichCardTest.php @@ -0,0 +1,80 @@ + 'test_string', + 'suggestions' => [new RbmActionBase([])] + ]); + } + + /** + * Test "RbmMessageContentText" + */ + public function testRbmMessageContentText() + { + $this->assertInstanceOf(RbmMessageContentText::class, self::$instance); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "suggestions" + */ + public function testPropertySuggestions() + { + $this->assertIsArray(self::$instance->getSuggestions()); + $this->assertInstanceOf(RbmActionBase::class, self::$instance->getSuggestions()[0]); + }} diff --git a/tests/Unit/Model/RbmMessageMediaTest.php b/tests/Unit/Model/RbmMessageMediaTest.php new file mode 100644 index 0000000..77b260b --- /dev/null +++ b/tests/Unit/Model/RbmMessageMediaTest.php @@ -0,0 +1,84 @@ + [new RbmMessageContentFile([])], + 'suggestions' => [new RbmActionBase([])] + ]); + } + + /** + * Test "RbmMessageMedia" + */ + public function testRbmMessageMedia() + { + $this->assertInstanceOf(RbmMessageMedia::class, self::$instance); + } + + /** + * Test attribute "media" + */ + public function testPropertyMedia() + { + $this->assertIsArray(self::$instance->getMedia()); + $this->assertInstanceOf(RbmMessageContentFile::class, self::$instance->getMedia()[0]); + } + + /** + * Test attribute "suggestions" + */ + public function testPropertySuggestions() + { + $this->assertIsArray(self::$instance->getSuggestions()); + $this->assertInstanceOf(RbmActionBase::class, self::$instance->getSuggestions()[0]); + }} diff --git a/tests/Unit/Model/RbmOpenUrlEnumTest.php b/tests/Unit/Model/RbmOpenUrlEnumTest.php new file mode 100644 index 0000000..e266353 --- /dev/null +++ b/tests/Unit/Model/RbmOpenUrlEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['BROWSER', 'WEBVIEW'], + array_column(RbmOpenUrlEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/RbmStandaloneCardTest.php b/tests/Unit/Model/RbmStandaloneCardTest.php new file mode 100644 index 0000000..f1b0a5b --- /dev/null +++ b/tests/Unit/Model/RbmStandaloneCardTest.php @@ -0,0 +1,105 @@ + StandaloneCardOrientationEnum::HORIZONTAL, + 'thumbnail_image_alignment' => ThumbnailAlignmentEnum::LEFT, + 'card_content' => new RbmCardContent([]), + 'suggestions' => [new RbmActionBase([])] + ]); + } + + /** + * Test "RbmStandaloneCard" + */ + public function testRbmStandaloneCard() + { + $this->assertInstanceOf(RbmStandaloneCard::class, self::$instance); + } + + /** + * Test attribute "orientation" + */ + public function testPropertyOrientation() + { + $this->assertInstanceOf(StandaloneCardOrientationEnum::class, self::$instance->getOrientation()); + $this->assertSame(StandaloneCardOrientationEnum::HORIZONTAL, self::$instance->getOrientation()); + } + + /** + * Test attribute "thumbnail_image_alignment" + */ + public function testPropertyThumbnailImageAlignment() + { + $this->assertInstanceOf(ThumbnailAlignmentEnum::class, self::$instance->getThumbnailImageAlignment()); + $this->assertSame(ThumbnailAlignmentEnum::LEFT, self::$instance->getThumbnailImageAlignment()); + } + + /** + * Test attribute "card_content" + */ + public function testPropertyCardContent() + { + $this->assertInstanceOf(RbmCardContent::class, self::$instance->getCardContent()); + } + + /** + * Test attribute "suggestions" + */ + public function testPropertySuggestions() + { + $this->assertIsArray(self::$instance->getSuggestions()); + $this->assertInstanceOf(RbmActionBase::class, self::$instance->getSuggestions()[0]); + }} diff --git a/tests/Unit/Model/RbmSuggestionResponseTest.php b/tests/Unit/Model/RbmSuggestionResponseTest.php new file mode 100644 index 0000000..daa544e --- /dev/null +++ b/tests/Unit/Model/RbmSuggestionResponseTest.php @@ -0,0 +1,92 @@ + 'test_string', + 'postback_data' => 'test_string', + 'paired_message_id' => 'test_string' + ]); + } + + /** + * Test "RbmSuggestionResponse" + */ + public function testRbmSuggestionResponse() + { + $this->assertInstanceOf(RbmSuggestionResponse::class, self::$instance); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "postback_data" + */ + public function testPropertyPostbackData() + { + $this->assertIsString(self::$instance->getPostbackData()); + $this->assertEquals('test_string', self::$instance->getPostbackData()); + } + + /** + * Test attribute "paired_message_id" + */ + public function testPropertyPairedMessageId() + { + $this->assertIsString(self::$instance->getPairedMessageId()); + $this->assertEquals('test_string', self::$instance->getPairedMessageId()); + }} diff --git a/tests/Unit/Model/RbmWebViewEnumTest.php b/tests/Unit/Model/RbmWebViewEnumTest.php new file mode 100644 index 0000000..101f04f --- /dev/null +++ b/tests/Unit/Model/RbmWebViewEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['FULL', 'HALF', 'TALL'], + array_column(RbmWebViewEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/RecordingAvailableCallbackTest.php b/tests/Unit/Model/RecordingAvailableCallbackTest.php new file mode 100644 index 0000000..677a070 --- /dev/null +++ b/tests/Unit/Model/RecordingAvailableCallbackTest.php @@ -0,0 +1,284 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'parent_call_id' => 'test_string', + 'recording_id' => 'test_string', + 'media_url' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'end_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'duration' => 'test_string', + 'file_format' => FileFormatEnum::MP3, + 'channels' => 1, + 'tag' => 'test_string', + 'status' => 'test_string', + 'transfer_caller_id' => 'test_string', + 'transfer_to' => 'test_string' + ]); + } + + /** + * Test "RecordingAvailableCallback" + */ + public function testRecordingAvailableCallback() + { + $this->assertInstanceOf(RecordingAvailableCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "parent_call_id" + */ + public function testPropertyParentCallId() + { + $this->assertIsString(self::$instance->getParentCallId()); + $this->assertEquals('test_string', self::$instance->getParentCallId()); + } + + /** + * Test attribute "recording_id" + */ + public function testPropertyRecordingId() + { + $this->assertIsString(self::$instance->getRecordingId()); + $this->assertEquals('test_string', self::$instance->getRecordingId()); + } + + /** + * Test attribute "media_url" + */ + public function testPropertyMediaUrl() + { + $this->assertIsString(self::$instance->getMediaUrl()); + $this->assertEquals('test_string', self::$instance->getMediaUrl()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "end_time" + */ + public function testPropertyEndTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEndTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEndTime()); + } + + /** + * Test attribute "duration" + */ + public function testPropertyDuration() + { + $this->assertIsString(self::$instance->getDuration()); + $this->assertEquals('test_string', self::$instance->getDuration()); + } + + /** + * Test attribute "file_format" + */ + public function testPropertyFileFormat() + { + $this->assertInstanceOf(FileFormatEnum::class, self::$instance->getFileFormat()); + $this->assertSame(FileFormatEnum::MP3, self::$instance->getFileFormat()); + } + + /** + * Test attribute "channels" + */ + public function testPropertyChannels() + { + $this->assertIsInt(self::$instance->getChannels()); + $this->assertEquals(1, self::$instance->getChannels()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertIsString(self::$instance->getStatus()); + $this->assertEquals('test_string', self::$instance->getStatus()); + } + + /** + * Test attribute "transfer_caller_id" + */ + public function testPropertyTransferCallerId() + { + $this->assertIsString(self::$instance->getTransferCallerId()); + $this->assertEquals('test_string', self::$instance->getTransferCallerId()); + } + + /** + * Test attribute "transfer_to" + */ + public function testPropertyTransferTo() + { + $this->assertIsString(self::$instance->getTransferTo()); + $this->assertEquals('test_string', self::$instance->getTransferTo()); + }} diff --git a/tests/Unit/Model/RecordingCompleteCallbackTest.php b/tests/Unit/Model/RecordingCompleteCallbackTest.php new file mode 100644 index 0000000..8d1c898 --- /dev/null +++ b/tests/Unit/Model/RecordingCompleteCallbackTest.php @@ -0,0 +1,284 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'parent_call_id' => 'test_string', + 'recording_id' => 'test_string', + 'media_url' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'end_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'duration' => 'test_string', + 'file_format' => FileFormatEnum::MP3, + 'channels' => 1, + 'tag' => 'test_string', + 'transfer_caller_id' => 'test_string', + 'transfer_to' => 'test_string' + ]); + } + + /** + * Test "RecordingCompleteCallback" + */ + public function testRecordingCompleteCallback() + { + $this->assertInstanceOf(RecordingCompleteCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "parent_call_id" + */ + public function testPropertyParentCallId() + { + $this->assertIsString(self::$instance->getParentCallId()); + $this->assertEquals('test_string', self::$instance->getParentCallId()); + } + + /** + * Test attribute "recording_id" + */ + public function testPropertyRecordingId() + { + $this->assertIsString(self::$instance->getRecordingId()); + $this->assertEquals('test_string', self::$instance->getRecordingId()); + } + + /** + * Test attribute "media_url" + */ + public function testPropertyMediaUrl() + { + $this->assertIsString(self::$instance->getMediaUrl()); + $this->assertEquals('test_string', self::$instance->getMediaUrl()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "end_time" + */ + public function testPropertyEndTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEndTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEndTime()); + } + + /** + * Test attribute "duration" + */ + public function testPropertyDuration() + { + $this->assertIsString(self::$instance->getDuration()); + $this->assertEquals('test_string', self::$instance->getDuration()); + } + + /** + * Test attribute "file_format" + */ + public function testPropertyFileFormat() + { + $this->assertInstanceOf(FileFormatEnum::class, self::$instance->getFileFormat()); + $this->assertSame(FileFormatEnum::MP3, self::$instance->getFileFormat()); + } + + /** + * Test attribute "channels" + */ + public function testPropertyChannels() + { + $this->assertIsInt(self::$instance->getChannels()); + $this->assertEquals(1, self::$instance->getChannels()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "transfer_caller_id" + */ + public function testPropertyTransferCallerId() + { + $this->assertIsString(self::$instance->getTransferCallerId()); + $this->assertEquals('test_string', self::$instance->getTransferCallerId()); + } + + /** + * Test attribute "transfer_to" + */ + public function testPropertyTransferTo() + { + $this->assertIsString(self::$instance->getTransferTo()); + $this->assertEquals('test_string', self::$instance->getTransferTo()); + }} diff --git a/tests/Unit/Model/RecordingStateEnumTest.php b/tests/Unit/Model/RecordingStateEnumTest.php new file mode 100644 index 0000000..52e27e6 --- /dev/null +++ b/tests/Unit/Model/RecordingStateEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['paused', 'recording'], + array_column(RecordingStateEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/RecordingTranscriptionClipTest.php b/tests/Unit/Model/RecordingTranscriptionClipTest.php new file mode 100644 index 0000000..5a63910 --- /dev/null +++ b/tests/Unit/Model/RecordingTranscriptionClipTest.php @@ -0,0 +1,112 @@ + 1, + 'text' => 'test_string', + 'confidence' => 1.5, + 'start_time_seconds' => 1.5, + 'end_time_seconds' => 1.5 + ]); + } + + /** + * Test "RecordingTranscriptionClip" + */ + public function testRecordingTranscriptionClip() + { + $this->assertInstanceOf(RecordingTranscriptionClip::class, self::$instance); + } + + /** + * Test attribute "speaker" + */ + public function testPropertySpeaker() + { + $this->assertIsInt(self::$instance->getSpeaker()); + $this->assertEquals(1, self::$instance->getSpeaker()); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "confidence" + */ + public function testPropertyConfidence() + { + $this->assertIsFloat(self::$instance->getConfidence()); + $this->assertEquals(1.5, self::$instance->getConfidence()); + } + + /** + * Test attribute "start_time_seconds" + */ + public function testPropertyStartTimeSeconds() + { + $this->assertIsFloat(self::$instance->getStartTimeSeconds()); + $this->assertEquals(1.5, self::$instance->getStartTimeSeconds()); + } + + /** + * Test attribute "end_time_seconds" + */ + public function testPropertyEndTimeSeconds() + { + $this->assertIsFloat(self::$instance->getEndTimeSeconds()); + $this->assertEquals(1.5, self::$instance->getEndTimeSeconds()); + }} diff --git a/tests/Unit/Model/RecordingTranscriptionMetadataTest.php b/tests/Unit/Model/RecordingTranscriptionMetadataTest.php new file mode 100644 index 0000000..377a83d --- /dev/null +++ b/tests/Unit/Model/RecordingTranscriptionMetadataTest.php @@ -0,0 +1,102 @@ + 'test_string', + 'status' => 'test_string', + 'completed_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'url' => 'test_string' + ]); + } + + /** + * Test "RecordingTranscriptionMetadata" + */ + public function testRecordingTranscriptionMetadata() + { + $this->assertInstanceOf(RecordingTranscriptionMetadata::class, self::$instance); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + $this->assertIsString(self::$instance->getId()); + $this->assertEquals('test_string', self::$instance->getId()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertIsString(self::$instance->getStatus()); + $this->assertEquals('test_string', self::$instance->getStatus()); + } + + /** + * Test attribute "completed_time" + */ + public function testPropertyCompletedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getCompletedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getCompletedTime()); + } + + /** + * Test attribute "url" + */ + public function testPropertyUrl() + { + $this->assertIsString(self::$instance->getUrl()); + $this->assertEquals('test_string', self::$instance->getUrl()); + }} diff --git a/tests/Unit/Model/RecordingTranscriptionsTest.php b/tests/Unit/Model/RecordingTranscriptionsTest.php new file mode 100644 index 0000000..df486ac --- /dev/null +++ b/tests/Unit/Model/RecordingTranscriptionsTest.php @@ -0,0 +1,84 @@ + [new Transcription([])], + 'clips' => [new RecordingTranscriptionClip([])] + ]); + } + + /** + * Test "RecordingTranscriptions" + */ + public function testRecordingTranscriptions() + { + $this->assertInstanceOf(RecordingTranscriptions::class, self::$instance); + } + + /** + * Test attribute "transcripts" + */ + public function testPropertyTranscripts() + { + $this->assertIsArray(self::$instance->getTranscripts()); + $this->assertInstanceOf(Transcription::class, self::$instance->getTranscripts()[0]); + } + + /** + * Test attribute "clips" + */ + public function testPropertyClips() + { + $this->assertIsArray(self::$instance->getClips()); + $this->assertInstanceOf(RecordingTranscriptionClip::class, self::$instance->getClips()[0]); + }} diff --git a/tests/Unit/Model/RedirectCallbackTest.php b/tests/Unit/Model/RedirectCallbackTest.php new file mode 100644 index 0000000..8b710cd --- /dev/null +++ b/tests/Unit/Model/RedirectCallbackTest.php @@ -0,0 +1,223 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'parent_call_id' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string', + 'transfer_caller_id' => 'test_string', + 'transfer_to' => 'test_string' + ]); + } + + /** + * Test "RedirectCallback" + */ + public function testRedirectCallback() + { + $this->assertInstanceOf(RedirectCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "parent_call_id" + */ + public function testPropertyParentCallId() + { + $this->assertIsString(self::$instance->getParentCallId()); + $this->assertEquals('test_string', self::$instance->getParentCallId()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "transfer_caller_id" + */ + public function testPropertyTransferCallerId() + { + $this->assertIsString(self::$instance->getTransferCallerId()); + $this->assertEquals('test_string', self::$instance->getTransferCallerId()); + } + + /** + * Test attribute "transfer_to" + */ + public function testPropertyTransferTo() + { + $this->assertIsString(self::$instance->getTransferTo()); + $this->assertEquals('test_string', self::$instance->getTransferTo()); + }} diff --git a/tests/Unit/Model/RedirectMethodEnumTest.php b/tests/Unit/Model/RedirectMethodEnumTest.php new file mode 100644 index 0000000..ce0feb8 --- /dev/null +++ b/tests/Unit/Model/RedirectMethodEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['GET', 'POST'], + array_column(RedirectMethodEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/SipConnectionMetadataTest.php b/tests/Unit/Model/SipConnectionMetadataTest.php new file mode 100644 index 0000000..0adf3f3 --- /dev/null +++ b/tests/Unit/Model/SipConnectionMetadataTest.php @@ -0,0 +1,102 @@ + 'test_string', + 'port' => 1, + 'credentials' => new SipCredentials([]), + 'uui_header' => 'test_string' + ]); + } + + /** + * Test "SipConnectionMetadata" + */ + public function testSipConnectionMetadata() + { + $this->assertInstanceOf(SipConnectionMetadata::class, self::$instance); + } + + /** + * Test attribute "ip_address" + */ + public function testPropertyIpAddress() + { + $this->assertIsString(self::$instance->getIpAddress()); + $this->assertEquals('test_string', self::$instance->getIpAddress()); + } + + /** + * Test attribute "port" + */ + public function testPropertyPort() + { + $this->assertIsInt(self::$instance->getPort()); + $this->assertEquals(1, self::$instance->getPort()); + } + + /** + * Test attribute "credentials" + */ + public function testPropertyCredentials() + { + $this->assertInstanceOf(SipCredentials::class, self::$instance->getCredentials()); + } + + /** + * Test attribute "uui_header" + */ + public function testPropertyUuiHeader() + { + $this->assertIsString(self::$instance->getUuiHeader()); + $this->assertEquals('test_string', self::$instance->getUuiHeader()); + }} diff --git a/tests/Unit/Model/SipCredentialsTest.php b/tests/Unit/Model/SipCredentialsTest.php new file mode 100644 index 0000000..c1598e5 --- /dev/null +++ b/tests/Unit/Model/SipCredentialsTest.php @@ -0,0 +1,82 @@ + 'test_string', + 'password' => 'test_string' + ]); + } + + /** + * Test "SipCredentials" + */ + public function testSipCredentials() + { + $this->assertInstanceOf(SipCredentials::class, self::$instance); + } + + /** + * Test attribute "username" + */ + public function testPropertyUsername() + { + $this->assertIsString(self::$instance->getUsername()); + $this->assertEquals('test_string', self::$instance->getUsername()); + } + + /** + * Test attribute "password" + */ + public function testPropertyPassword() + { + $this->assertIsString(self::$instance->getPassword()); + $this->assertEquals('test_string', self::$instance->getPassword()); + }} diff --git a/tests/Unit/Model/SmsMessageContentTest.php b/tests/Unit/Model/SmsMessageContentTest.php new file mode 100644 index 0000000..2b9fb71 --- /dev/null +++ b/tests/Unit/Model/SmsMessageContentTest.php @@ -0,0 +1,72 @@ + 'test_string' + ]); + } + + /** + * Test "SmsMessageContent" + */ + public function testSmsMessageContent() + { + $this->assertInstanceOf(SmsMessageContent::class, self::$instance); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + }} diff --git a/tests/Unit/Model/StandaloneCardOrientationEnumTest.php b/tests/Unit/Model/StandaloneCardOrientationEnumTest.php new file mode 100644 index 0000000..41cf48f --- /dev/null +++ b/tests/Unit/Model/StandaloneCardOrientationEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['HORIZONTAL', 'VERTICAL'], + array_column(StandaloneCardOrientationEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/StatusCallbackMessageTest.php b/tests/Unit/Model/StatusCallbackMessageTest.php new file mode 100644 index 0000000..5d9405d --- /dev/null +++ b/tests/Unit/Model/StatusCallbackMessageTest.php @@ -0,0 +1,195 @@ + 'test_string', + 'owner' => 'test_string', + 'application_id' => 'test_string', + 'time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'segment_count' => 1, + 'direction' => MessageDirectionEnum::IN, + 'to' => ['test_string'], + 'from' => 'test_string', + 'text' => 'test_string', + 'tag' => 'test_string', + 'media' => ['test_string'], + 'priority' => PriorityEnum::_DEFAULT, + 'channel' => MultiChannelMessageChannelEnum::RBM + ]); + } + + /** + * Test "StatusCallbackMessage" + */ + public function testStatusCallbackMessage() + { + $this->assertInstanceOf(StatusCallbackMessage::class, self::$instance); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + $this->assertIsString(self::$instance->getId()); + $this->assertEquals('test_string', self::$instance->getId()); + } + + /** + * Test attribute "owner" + */ + public function testPropertyOwner() + { + $this->assertIsString(self::$instance->getOwner()); + $this->assertEquals('test_string', self::$instance->getOwner()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "time" + */ + public function testPropertyTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getTime()); + } + + /** + * Test attribute "segment_count" + */ + public function testPropertySegmentCount() + { + $this->assertIsInt(self::$instance->getSegmentCount()); + $this->assertEquals(1, self::$instance->getSegmentCount()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(MessageDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(MessageDirectionEnum::IN, self::$instance->getDirection()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsArray(self::$instance->getTo()); + $this->assertEquals(['test_string'], self::$instance->getTo()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "media" + */ + public function testPropertyMedia() + { + $this->assertIsArray(self::$instance->getMedia()); + $this->assertEquals(['test_string'], self::$instance->getMedia()); + } + + /** + * Test attribute "priority" + */ + public function testPropertyPriority() + { + $this->assertInstanceOf(PriorityEnum::class, self::$instance->getPriority()); + $this->assertSame(PriorityEnum::_DEFAULT, self::$instance->getPriority()); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + $this->assertInstanceOf(MultiChannelMessageChannelEnum::class, self::$instance->getChannel()); + $this->assertSame(MultiChannelMessageChannelEnum::RBM, self::$instance->getChannel()); + }} diff --git a/tests/Unit/Model/StatusCallbackTest.php b/tests/Unit/Model/StatusCallbackTest.php new file mode 100644 index 0000000..b606ede --- /dev/null +++ b/tests/Unit/Model/StatusCallbackTest.php @@ -0,0 +1,143 @@ + new \DateTime('2024-01-01T00:00:00+00:00'), + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'type' => StatusCallbackTypeEnum::MESSAGE_SENDING, + 'to' => 'test_string', + 'description' => 'test_string', + 'message' => new StatusCallbackMessage([]), + 'error_code' => 1, + 'carrier_name' => 'test_string' + ]); + } + + /** + * Test "StatusCallback" + */ + public function testStatusCallback() + { + $this->assertInstanceOf(StatusCallback::class, self::$instance); + } + + /** + * Test attribute "time" + */ + public function testPropertyTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getTime()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(StatusCallbackTypeEnum::class, self::$instance->getType()); + $this->assertSame(StatusCallbackTypeEnum::MESSAGE_SENDING, self::$instance->getType()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + } + + /** + * Test attribute "message" + */ + public function testPropertyMessage() + { + $this->assertInstanceOf(StatusCallbackMessage::class, self::$instance->getMessage()); + } + + /** + * Test attribute "error_code" + */ + public function testPropertyErrorCode() + { + $this->assertIsInt(self::$instance->getErrorCode()); + $this->assertEquals(1, self::$instance->getErrorCode()); + } + + /** + * Test attribute "carrier_name" + */ + public function testPropertyCarrierName() + { + $this->assertIsString(self::$instance->getCarrierName()); + $this->assertEquals('test_string', self::$instance->getCarrierName()); + }} diff --git a/tests/Unit/Model/StatusCallbackTypeEnumTest.php b/tests/Unit/Model/StatusCallbackTypeEnumTest.php new file mode 100644 index 0000000..d83ac2d --- /dev/null +++ b/tests/Unit/Model/StatusCallbackTypeEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['message-sending', 'message-sent', 'message-delivered', 'message-failed', 'message-read'], + array_column(StatusCallbackTypeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/StirShakenTest.php b/tests/Unit/Model/StirShakenTest.php new file mode 100644 index 0000000..517bf38 --- /dev/null +++ b/tests/Unit/Model/StirShakenTest.php @@ -0,0 +1,92 @@ + 'test_string', + 'attestation_indicator' => 'test_string', + 'originating_id' => 'test_string' + ]); + } + + /** + * Test "StirShaken" + */ + public function testStirShaken() + { + $this->assertInstanceOf(StirShaken::class, self::$instance); + } + + /** + * Test attribute "verstat" + */ + public function testPropertyVerstat() + { + $this->assertIsString(self::$instance->getVerstat()); + $this->assertEquals('test_string', self::$instance->getVerstat()); + } + + /** + * Test attribute "attestation_indicator" + */ + public function testPropertyAttestationIndicator() + { + $this->assertIsString(self::$instance->getAttestationIndicator()); + $this->assertEquals('test_string', self::$instance->getAttestationIndicator()); + } + + /** + * Test attribute "originating_id" + */ + public function testPropertyOriginatingId() + { + $this->assertIsString(self::$instance->getOriginatingId()); + $this->assertEquals('test_string', self::$instance->getOriginatingId()); + }} diff --git a/tests/Unit/Model/SyncLookupRequestTest.php b/tests/Unit/Model/SyncLookupRequestTest.php new file mode 100644 index 0000000..e48ce61 --- /dev/null +++ b/tests/Unit/Model/SyncLookupRequestTest.php @@ -0,0 +1,82 @@ + ['test_string'], + 'rcs_agent' => 'test_string' + ]); + } + + /** + * Test "SyncLookupRequest" + */ + public function testSyncLookupRequest() + { + $this->assertInstanceOf(SyncLookupRequest::class, self::$instance); + } + + /** + * Test attribute "phone_numbers" + */ + public function testPropertyPhoneNumbers() + { + $this->assertIsArray(self::$instance->getPhoneNumbers()); + $this->assertEquals(['test_string'], self::$instance->getPhoneNumbers()); + } + + /** + * Test attribute "rcs_agent" + */ + public function testPropertyRcsAgent() + { + $this->assertIsString(self::$instance->getRcsAgent()); + $this->assertEquals('test_string', self::$instance->getRcsAgent()); + }} diff --git a/tests/Unit/Model/TelephoneNumberTest.php b/tests/Unit/Model/TelephoneNumberTest.php new file mode 100644 index 0000000..12fc804 --- /dev/null +++ b/tests/Unit/Model/TelephoneNumberTest.php @@ -0,0 +1,72 @@ + 'test_string' + ]); + } + + /** + * Test "TelephoneNumber" + */ + public function testTelephoneNumber() + { + $this->assertInstanceOf(TelephoneNumber::class, self::$instance); + } + + /** + * Test attribute "telephone_number" + */ + public function testPropertyTelephoneNumber() + { + $this->assertIsString(self::$instance->getTelephoneNumber()); + $this->assertEquals('test_string', self::$instance->getTelephoneNumber()); + }} diff --git a/tests/Unit/Model/TfvBasicAuthenticationTest.php b/tests/Unit/Model/TfvBasicAuthenticationTest.php new file mode 100644 index 0000000..daa979d --- /dev/null +++ b/tests/Unit/Model/TfvBasicAuthenticationTest.php @@ -0,0 +1,82 @@ + 'test_string', + 'password' => 'test_string' + ]); + } + + /** + * Test "TfvBasicAuthentication" + */ + public function testTfvBasicAuthentication() + { + $this->assertInstanceOf(TfvBasicAuthentication::class, self::$instance); + } + + /** + * Test attribute "username" + */ + public function testPropertyUsername() + { + $this->assertIsString(self::$instance->getUsername()); + $this->assertEquals('test_string', self::$instance->getUsername()); + } + + /** + * Test attribute "password" + */ + public function testPropertyPassword() + { + $this->assertIsString(self::$instance->getPassword()); + $this->assertEquals('test_string', self::$instance->getPassword()); + }} diff --git a/tests/Unit/Model/TfvCallbackStatusEnumTest.php b/tests/Unit/Model/TfvCallbackStatusEnumTest.php new file mode 100644 index 0000000..69d4559 --- /dev/null +++ b/tests/Unit/Model/TfvCallbackStatusEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['VERIFIED', 'UNVERIFIED'], + array_column(TfvCallbackStatusEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/TfvErrorTest.php b/tests/Unit/Model/TfvErrorTest.php new file mode 100644 index 0000000..032e5ad --- /dev/null +++ b/tests/Unit/Model/TfvErrorTest.php @@ -0,0 +1,92 @@ + 'test_string', + 'description' => 'test_string', + 'errors' => (object) ['key' => 'value'] + ]); + } + + /** + * Test "TfvError" + */ + public function testTfvError() + { + $this->assertInstanceOf(TfvError::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertIsString(self::$instance->getType()); + $this->assertEquals('test_string', self::$instance->getType()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsObject(self::$instance->getErrors()); + $this->assertEquals((object) ['key' => 'value'], self::$instance->getErrors()); + }} diff --git a/tests/Unit/Model/TfvStatusEnumTest.php b/tests/Unit/Model/TfvStatusEnumTest.php new file mode 100644 index 0000000..7dc7d77 --- /dev/null +++ b/tests/Unit/Model/TfvStatusEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['VERIFIED', 'UNVERIFIED', 'PENDING'], + array_column(TfvStatusEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/TfvStatusTest.php b/tests/Unit/Model/TfvStatusTest.php new file mode 100644 index 0000000..b60d3f0 --- /dev/null +++ b/tests/Unit/Model/TfvStatusTest.php @@ -0,0 +1,194 @@ + 'test_string', + 'status' => TfvStatusEnum::VERIFIED, + 'internal_ticket_number' => 'test_string', + 'decline_reason_description' => 'test_string', + 'denial_status_code' => 1, + 'additional_denial_reasons' => [new AdditionalDenialReason([])], + 'resubmit_allowed' => true, + 'created_date_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'modified_date_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'submission' => new TfvSubmissionInfo([]), + 'blocked' => true, + 'blocked_reason' => 'test_string', + 'cv_token' => 'test_string' + ]); + } + + /** + * Test "TfvStatus" + */ + public function testTfvStatus() + { + $this->assertInstanceOf(TfvStatus::class, self::$instance); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + $this->assertIsString(self::$instance->getPhoneNumber()); + $this->assertEquals('test_string', self::$instance->getPhoneNumber()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(TfvStatusEnum::class, self::$instance->getStatus()); + $this->assertSame(TfvStatusEnum::VERIFIED, self::$instance->getStatus()); + } + + /** + * Test attribute "internal_ticket_number" + */ + public function testPropertyInternalTicketNumber() + { + $this->assertIsString(self::$instance->getInternalTicketNumber()); + $this->assertEquals('test_string', self::$instance->getInternalTicketNumber()); + } + + /** + * Test attribute "decline_reason_description" + */ + public function testPropertyDeclineReasonDescription() + { + $this->assertIsString(self::$instance->getDeclineReasonDescription()); + $this->assertEquals('test_string', self::$instance->getDeclineReasonDescription()); + } + + /** + * Test attribute "denial_status_code" + */ + public function testPropertyDenialStatusCode() + { + $this->assertIsInt(self::$instance->getDenialStatusCode()); + $this->assertEquals(1, self::$instance->getDenialStatusCode()); + } + + /** + * Test attribute "additional_denial_reasons" + */ + public function testPropertyAdditionalDenialReasons() + { + $this->assertIsArray(self::$instance->getAdditionalDenialReasons()); + $this->assertInstanceOf(AdditionalDenialReason::class, self::$instance->getAdditionalDenialReasons()[0]); + } + + /** + * Test attribute "resubmit_allowed" + */ + public function testPropertyResubmitAllowed() + { + $this->assertIsBool(self::$instance->getResubmitAllowed()); + $this->assertTrue(self::$instance->getResubmitAllowed()); + } + + /** + * Test attribute "created_date_time" + */ + public function testPropertyCreatedDateTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getCreatedDateTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getCreatedDateTime()); + } + + /** + * Test attribute "modified_date_time" + */ + public function testPropertyModifiedDateTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getModifiedDateTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getModifiedDateTime()); + } + + /** + * Test attribute "submission" + */ + public function testPropertySubmission() + { + $this->assertInstanceOf(TfvSubmissionInfo::class, self::$instance->getSubmission()); + } + + /** + * Test attribute "blocked" + */ + public function testPropertyBlocked() + { + $this->assertIsBool(self::$instance->getBlocked()); + $this->assertTrue(self::$instance->getBlocked()); + } + + /** + * Test attribute "blocked_reason" + */ + public function testPropertyBlockedReason() + { + $this->assertIsString(self::$instance->getBlockedReason()); + $this->assertEquals('test_string', self::$instance->getBlockedReason()); + } + + /** + * Test attribute "cv_token" + */ + public function testPropertyCvToken() + { + $this->assertIsString(self::$instance->getCvToken()); + $this->assertEquals('test_string', self::$instance->getCvToken()); + }} diff --git a/tests/Unit/Model/TfvSubmissionInfoTest.php b/tests/Unit/Model/TfvSubmissionInfoTest.php new file mode 100644 index 0000000..d333443 --- /dev/null +++ b/tests/Unit/Model/TfvSubmissionInfoTest.php @@ -0,0 +1,224 @@ + new Address([]), + 'business_contact' => new Contact([]), + 'message_volume' => 1, + 'use_case' => 'test_string', + 'use_case_summary' => 'test_string', + 'production_message_content' => 'test_string', + 'opt_in_workflow' => new OptInWorkflow([]), + 'additional_information' => 'test_string', + 'isv_reseller' => 'test_string', + 'privacy_policy_url' => 'test_string', + 'terms_and_conditions_url' => 'test_string', + 'business_dba' => 'test_string', + 'business_registration_number' => 'test_string', + 'business_registration_type' => BusinessRegistrationTypeEnum::EIN, + 'business_registration_issuing_country' => 'test_string', + 'business_entity_type' => BusinessEntityTypeEnum::SOLE_PROPRIETOR + ]); + } + + /** + * Test "TfvSubmissionInfo" + */ + public function testTfvSubmissionInfo() + { + $this->assertInstanceOf(TfvSubmissionInfo::class, self::$instance); + } + + /** + * Test attribute "business_address" + */ + public function testPropertyBusinessAddress() + { + $this->assertInstanceOf(Address::class, self::$instance->getBusinessAddress()); + } + + /** + * Test attribute "business_contact" + */ + public function testPropertyBusinessContact() + { + $this->assertInstanceOf(Contact::class, self::$instance->getBusinessContact()); + } + + /** + * Test attribute "message_volume" + */ + public function testPropertyMessageVolume() + { + $this->assertIsInt(self::$instance->getMessageVolume()); + $this->assertEquals(1, self::$instance->getMessageVolume()); + } + + /** + * Test attribute "use_case" + */ + public function testPropertyUseCase() + { + $this->assertIsString(self::$instance->getUseCase()); + $this->assertEquals('test_string', self::$instance->getUseCase()); + } + + /** + * Test attribute "use_case_summary" + */ + public function testPropertyUseCaseSummary() + { + $this->assertIsString(self::$instance->getUseCaseSummary()); + $this->assertEquals('test_string', self::$instance->getUseCaseSummary()); + } + + /** + * Test attribute "production_message_content" + */ + public function testPropertyProductionMessageContent() + { + $this->assertIsString(self::$instance->getProductionMessageContent()); + $this->assertEquals('test_string', self::$instance->getProductionMessageContent()); + } + + /** + * Test attribute "opt_in_workflow" + */ + public function testPropertyOptInWorkflow() + { + $this->assertInstanceOf(OptInWorkflow::class, self::$instance->getOptInWorkflow()); + } + + /** + * Test attribute "additional_information" + */ + public function testPropertyAdditionalInformation() + { + $this->assertIsString(self::$instance->getAdditionalInformation()); + $this->assertEquals('test_string', self::$instance->getAdditionalInformation()); + } + + /** + * Test attribute "isv_reseller" + */ + public function testPropertyIsvReseller() + { + $this->assertIsString(self::$instance->getIsvReseller()); + $this->assertEquals('test_string', self::$instance->getIsvReseller()); + } + + /** + * Test attribute "privacy_policy_url" + */ + public function testPropertyPrivacyPolicyUrl() + { + $this->assertIsString(self::$instance->getPrivacyPolicyUrl()); + $this->assertEquals('test_string', self::$instance->getPrivacyPolicyUrl()); + } + + /** + * Test attribute "terms_and_conditions_url" + */ + public function testPropertyTermsAndConditionsUrl() + { + $this->assertIsString(self::$instance->getTermsAndConditionsUrl()); + $this->assertEquals('test_string', self::$instance->getTermsAndConditionsUrl()); + } + + /** + * Test attribute "business_dba" + */ + public function testPropertyBusinessDba() + { + $this->assertIsString(self::$instance->getBusinessDba()); + $this->assertEquals('test_string', self::$instance->getBusinessDba()); + } + + /** + * Test attribute "business_registration_number" + */ + public function testPropertyBusinessRegistrationNumber() + { + $this->assertIsString(self::$instance->getBusinessRegistrationNumber()); + $this->assertEquals('test_string', self::$instance->getBusinessRegistrationNumber()); + } + + /** + * Test attribute "business_registration_type" + */ + public function testPropertyBusinessRegistrationType() + { + $this->assertInstanceOf(BusinessRegistrationTypeEnum::class, self::$instance->getBusinessRegistrationType()); + $this->assertSame(BusinessRegistrationTypeEnum::EIN, self::$instance->getBusinessRegistrationType()); + } + + /** + * Test attribute "business_registration_issuing_country" + */ + public function testPropertyBusinessRegistrationIssuingCountry() + { + $this->assertIsString(self::$instance->getBusinessRegistrationIssuingCountry()); + $this->assertEquals('test_string', self::$instance->getBusinessRegistrationIssuingCountry()); + } + + /** + * Test attribute "business_entity_type" + */ + public function testPropertyBusinessEntityType() + { + $this->assertInstanceOf(BusinessEntityTypeEnum::class, self::$instance->getBusinessEntityType()); + $this->assertSame(BusinessEntityTypeEnum::SOLE_PROPRIETOR, self::$instance->getBusinessEntityType()); + }} diff --git a/tests/Unit/Model/TfvSubmissionWrapperTest.php b/tests/Unit/Model/TfvSubmissionWrapperTest.php new file mode 100644 index 0000000..5c74b3d --- /dev/null +++ b/tests/Unit/Model/TfvSubmissionWrapperTest.php @@ -0,0 +1,72 @@ + new VerificationUpdateRequest([]) + ]); + } + + /** + * Test "TfvSubmissionWrapper" + */ + public function testTfvSubmissionWrapper() + { + $this->assertInstanceOf(TfvSubmissionWrapper::class, self::$instance); + } + + /** + * Test attribute "submission" + */ + public function testPropertySubmission() + { + $this->assertInstanceOf(VerificationUpdateRequest::class, self::$instance->getSubmission()); + }} diff --git a/tests/Unit/Model/ThumbnailAlignmentEnumTest.php b/tests/Unit/Model/ThumbnailAlignmentEnumTest.php new file mode 100644 index 0000000..f6adc1b --- /dev/null +++ b/tests/Unit/Model/ThumbnailAlignmentEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['LEFT', 'RIGHT'], + array_column(ThumbnailAlignmentEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/TranscribeRecordingTest.php b/tests/Unit/Model/TranscribeRecordingTest.php new file mode 100644 index 0000000..5590968 --- /dev/null +++ b/tests/Unit/Model/TranscribeRecordingTest.php @@ -0,0 +1,133 @@ + 'test_string', + 'callback_method' => CallbackMethodEnum::GET, + 'username' => 'test_string', + 'password' => 'test_string', + 'tag' => 'test_string', + 'callback_timeout' => 1.5, + 'detect_language' => true + ]); + } + + /** + * Test "TranscribeRecording" + */ + public function testTranscribeRecording() + { + $this->assertInstanceOf(TranscribeRecording::class, self::$instance); + } + + /** + * Test attribute "callback_url" + */ + public function testPropertyCallbackUrl() + { + $this->assertIsString(self::$instance->getCallbackUrl()); + $this->assertEquals('test_string', self::$instance->getCallbackUrl()); + } + + /** + * Test attribute "callback_method" + */ + public function testPropertyCallbackMethod() + { + $this->assertInstanceOf(CallbackMethodEnum::class, self::$instance->getCallbackMethod()); + $this->assertSame(CallbackMethodEnum::GET, self::$instance->getCallbackMethod()); + } + + /** + * Test attribute "username" + */ + public function testPropertyUsername() + { + $this->assertIsString(self::$instance->getUsername()); + $this->assertEquals('test_string', self::$instance->getUsername()); + } + + /** + * Test attribute "password" + */ + public function testPropertyPassword() + { + $this->assertIsString(self::$instance->getPassword()); + $this->assertEquals('test_string', self::$instance->getPassword()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "callback_timeout" + */ + public function testPropertyCallbackTimeout() + { + $this->assertIsFloat(self::$instance->getCallbackTimeout()); + $this->assertEquals(1.5, self::$instance->getCallbackTimeout()); + } + + /** + * Test attribute "detect_language" + */ + public function testPropertyDetectLanguage() + { + $this->assertIsBool(self::$instance->getDetectLanguage()); + $this->assertTrue(self::$instance->getDetectLanguage()); + }} diff --git a/tests/Unit/Model/TranscriptionAvailableCallbackTest.php b/tests/Unit/Model/TranscriptionAvailableCallbackTest.php new file mode 100644 index 0000000..13b9b40 --- /dev/null +++ b/tests/Unit/Model/TranscriptionAvailableCallbackTest.php @@ -0,0 +1,274 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'media_url' => 'test_string', + 'parent_call_id' => 'test_string', + 'recording_id' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'end_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'duration' => 'test_string', + 'file_format' => FileFormatEnum::MP3, + 'tag' => 'test_string', + 'transcription' => new Transcription([]), + 'transfer_caller_id' => 'test_string', + 'transfer_to' => 'test_string' + ]); + } + + /** + * Test "TranscriptionAvailableCallback" + */ + public function testTranscriptionAvailableCallback() + { + $this->assertInstanceOf(TranscriptionAvailableCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "media_url" + */ + public function testPropertyMediaUrl() + { + $this->assertIsString(self::$instance->getMediaUrl()); + $this->assertEquals('test_string', self::$instance->getMediaUrl()); + } + + /** + * Test attribute "parent_call_id" + */ + public function testPropertyParentCallId() + { + $this->assertIsString(self::$instance->getParentCallId()); + $this->assertEquals('test_string', self::$instance->getParentCallId()); + } + + /** + * Test attribute "recording_id" + */ + public function testPropertyRecordingId() + { + $this->assertIsString(self::$instance->getRecordingId()); + $this->assertEquals('test_string', self::$instance->getRecordingId()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "end_time" + */ + public function testPropertyEndTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEndTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEndTime()); + } + + /** + * Test attribute "duration" + */ + public function testPropertyDuration() + { + $this->assertIsString(self::$instance->getDuration()); + $this->assertEquals('test_string', self::$instance->getDuration()); + } + + /** + * Test attribute "file_format" + */ + public function testPropertyFileFormat() + { + $this->assertInstanceOf(FileFormatEnum::class, self::$instance->getFileFormat()); + $this->assertSame(FileFormatEnum::MP3, self::$instance->getFileFormat()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "transcription" + */ + public function testPropertyTranscription() + { + $this->assertInstanceOf(Transcription::class, self::$instance->getTranscription()); + } + + /** + * Test attribute "transfer_caller_id" + */ + public function testPropertyTransferCallerId() + { + $this->assertIsString(self::$instance->getTransferCallerId()); + $this->assertEquals('test_string', self::$instance->getTransferCallerId()); + } + + /** + * Test attribute "transfer_to" + */ + public function testPropertyTransferTo() + { + $this->assertIsString(self::$instance->getTransferTo()); + $this->assertEquals('test_string', self::$instance->getTransferTo()); + }} diff --git a/tests/Unit/Model/TranscriptionTest.php b/tests/Unit/Model/TranscriptionTest.php new file mode 100644 index 0000000..80fb444 --- /dev/null +++ b/tests/Unit/Model/TranscriptionTest.php @@ -0,0 +1,92 @@ + 1, + 'text' => 'test_string', + 'confidence' => 1.5 + ]); + } + + /** + * Test "Transcription" + */ + public function testTranscription() + { + $this->assertInstanceOf(Transcription::class, self::$instance); + } + + /** + * Test attribute "speaker" + */ + public function testPropertySpeaker() + { + $this->assertIsInt(self::$instance->getSpeaker()); + $this->assertEquals(1, self::$instance->getSpeaker()); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + $this->assertIsString(self::$instance->getText()); + $this->assertEquals('test_string', self::$instance->getText()); + } + + /** + * Test attribute "confidence" + */ + public function testPropertyConfidence() + { + $this->assertIsFloat(self::$instance->getConfidence()); + $this->assertEquals(1.5, self::$instance->getConfidence()); + }} diff --git a/tests/Unit/Model/TransferAnswerCallbackTest.php b/tests/Unit/Model/TransferAnswerCallbackTest.php new file mode 100644 index 0000000..c2b6839 --- /dev/null +++ b/tests/Unit/Model/TransferAnswerCallbackTest.php @@ -0,0 +1,213 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string', + 'transfer_caller_id' => 'test_string', + 'transfer_to' => 'test_string' + ]); + } + + /** + * Test "TransferAnswerCallback" + */ + public function testTransferAnswerCallback() + { + $this->assertInstanceOf(TransferAnswerCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "transfer_caller_id" + */ + public function testPropertyTransferCallerId() + { + $this->assertIsString(self::$instance->getTransferCallerId()); + $this->assertEquals('test_string', self::$instance->getTransferCallerId()); + } + + /** + * Test attribute "transfer_to" + */ + public function testPropertyTransferTo() + { + $this->assertIsString(self::$instance->getTransferTo()); + $this->assertEquals('test_string', self::$instance->getTransferTo()); + }} diff --git a/tests/Unit/Model/TransferCompleteCallbackTest.php b/tests/Unit/Model/TransferCompleteCallbackTest.php new file mode 100644 index 0000000..d809011 --- /dev/null +++ b/tests/Unit/Model/TransferCompleteCallbackTest.php @@ -0,0 +1,243 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string', + 'transfer_caller_id' => 'test_string', + 'transfer_to' => 'test_string', + 'cause' => 'test_string', + 'error_message' => 'test_string', + 'error_id' => 'test_string' + ]); + } + + /** + * Test "TransferCompleteCallback" + */ + public function testTransferCompleteCallback() + { + $this->assertInstanceOf(TransferCompleteCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "transfer_caller_id" + */ + public function testPropertyTransferCallerId() + { + $this->assertIsString(self::$instance->getTransferCallerId()); + $this->assertEquals('test_string', self::$instance->getTransferCallerId()); + } + + /** + * Test attribute "transfer_to" + */ + public function testPropertyTransferTo() + { + $this->assertIsString(self::$instance->getTransferTo()); + $this->assertEquals('test_string', self::$instance->getTransferTo()); + } + + /** + * Test attribute "cause" + */ + public function testPropertyCause() + { + $this->assertIsString(self::$instance->getCause()); + $this->assertEquals('test_string', self::$instance->getCause()); + } + + /** + * Test attribute "error_message" + */ + public function testPropertyErrorMessage() + { + $this->assertIsString(self::$instance->getErrorMessage()); + $this->assertEquals('test_string', self::$instance->getErrorMessage()); + } + + /** + * Test attribute "error_id" + */ + public function testPropertyErrorId() + { + $this->assertIsString(self::$instance->getErrorId()); + $this->assertEquals('test_string', self::$instance->getErrorId()); + }} diff --git a/tests/Unit/Model/TransferDisconnectCallbackTest.php b/tests/Unit/Model/TransferDisconnectCallbackTest.php new file mode 100644 index 0000000..71a6c8d --- /dev/null +++ b/tests/Unit/Model/TransferDisconnectCallbackTest.php @@ -0,0 +1,263 @@ + 'test_string', + 'event_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'account_id' => 'test_string', + 'application_id' => 'test_string', + 'from' => 'test_string', + 'to' => 'test_string', + 'direction' => CallDirectionEnum::INBOUND, + 'call_id' => 'test_string', + 'call_url' => 'test_string', + 'parent_call_id' => 'test_string', + 'enqueued_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'start_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'answer_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'end_time' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'tag' => 'test_string', + 'transfer_caller_id' => 'test_string', + 'transfer_to' => 'test_string', + 'cause' => 'test_string', + 'error_message' => 'test_string', + 'error_id' => 'test_string' + ]); + } + + /** + * Test "TransferDisconnectCallback" + */ + public function testTransferDisconnectCallback() + { + $this->assertInstanceOf(TransferDisconnectCallback::class, self::$instance); + } + + /** + * Test attribute "event_type" + */ + public function testPropertyEventType() + { + $this->assertIsString(self::$instance->getEventType()); + $this->assertEquals('test_string', self::$instance->getEventType()); + } + + /** + * Test attribute "event_time" + */ + public function testPropertyEventTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEventTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEventTime()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "application_id" + */ + public function testPropertyApplicationId() + { + $this->assertIsString(self::$instance->getApplicationId()); + $this->assertEquals('test_string', self::$instance->getApplicationId()); + } + + /** + * Test attribute "from" + */ + public function testPropertyFrom() + { + $this->assertIsString(self::$instance->getFrom()); + $this->assertEquals('test_string', self::$instance->getFrom()); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "direction" + */ + public function testPropertyDirection() + { + $this->assertInstanceOf(CallDirectionEnum::class, self::$instance->getDirection()); + $this->assertSame(CallDirectionEnum::INBOUND, self::$instance->getDirection()); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + } + + /** + * Test attribute "call_url" + */ + public function testPropertyCallUrl() + { + $this->assertIsString(self::$instance->getCallUrl()); + $this->assertEquals('test_string', self::$instance->getCallUrl()); + } + + /** + * Test attribute "parent_call_id" + */ + public function testPropertyParentCallId() + { + $this->assertIsString(self::$instance->getParentCallId()); + $this->assertEquals('test_string', self::$instance->getParentCallId()); + } + + /** + * Test attribute "enqueued_time" + */ + public function testPropertyEnqueuedTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEnqueuedTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEnqueuedTime()); + } + + /** + * Test attribute "start_time" + */ + public function testPropertyStartTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getStartTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getStartTime()); + } + + /** + * Test attribute "answer_time" + */ + public function testPropertyAnswerTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getAnswerTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getAnswerTime()); + } + + /** + * Test attribute "end_time" + */ + public function testPropertyEndTime() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getEndTime()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getEndTime()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + } + + /** + * Test attribute "transfer_caller_id" + */ + public function testPropertyTransferCallerId() + { + $this->assertIsString(self::$instance->getTransferCallerId()); + $this->assertEquals('test_string', self::$instance->getTransferCallerId()); + } + + /** + * Test attribute "transfer_to" + */ + public function testPropertyTransferTo() + { + $this->assertIsString(self::$instance->getTransferTo()); + $this->assertEquals('test_string', self::$instance->getTransferTo()); + } + + /** + * Test attribute "cause" + */ + public function testPropertyCause() + { + $this->assertIsString(self::$instance->getCause()); + $this->assertEquals('test_string', self::$instance->getCause()); + } + + /** + * Test attribute "error_message" + */ + public function testPropertyErrorMessage() + { + $this->assertIsString(self::$instance->getErrorMessage()); + $this->assertEquals('test_string', self::$instance->getErrorMessage()); + } + + /** + * Test attribute "error_id" + */ + public function testPropertyErrorId() + { + $this->assertIsString(self::$instance->getErrorId()); + $this->assertEquals('test_string', self::$instance->getErrorId()); + }} diff --git a/tests/Unit/Model/UpdateCallRecordingTest.php b/tests/Unit/Model/UpdateCallRecordingTest.php new file mode 100644 index 0000000..83c4150 --- /dev/null +++ b/tests/Unit/Model/UpdateCallRecordingTest.php @@ -0,0 +1,73 @@ + RecordingStateEnum::PAUSED + ]); + } + + /** + * Test "UpdateCallRecording" + */ + public function testUpdateCallRecording() + { + $this->assertInstanceOf(UpdateCallRecording::class, self::$instance); + } + + /** + * Test attribute "state" + */ + public function testPropertyState() + { + $this->assertInstanceOf(RecordingStateEnum::class, self::$instance->getState()); + $this->assertSame(RecordingStateEnum::PAUSED, self::$instance->getState()); + }} diff --git a/tests/Unit/Model/UpdateCallTest.php b/tests/Unit/Model/UpdateCallTest.php new file mode 100644 index 0000000..7a3745d --- /dev/null +++ b/tests/Unit/Model/UpdateCallTest.php @@ -0,0 +1,164 @@ + CallStateEnum::ACTIVE, + 'redirect_url' => 'test_string', + 'redirect_method' => RedirectMethodEnum::GET, + 'username' => 'test_string', + 'password' => 'test_string', + 'redirect_fallback_url' => 'test_string', + 'redirect_fallback_method' => RedirectMethodEnum::GET, + 'fallback_username' => 'test_string', + 'fallback_password' => 'test_string', + 'tag' => 'test_string' + ]); + } + + /** + * Test "UpdateCall" + */ + public function testUpdateCall() + { + $this->assertInstanceOf(UpdateCall::class, self::$instance); + } + + /** + * Test attribute "state" + */ + public function testPropertyState() + { + $this->assertInstanceOf(CallStateEnum::class, self::$instance->getState()); + $this->assertSame(CallStateEnum::ACTIVE, self::$instance->getState()); + } + + /** + * Test attribute "redirect_url" + */ + public function testPropertyRedirectUrl() + { + $this->assertIsString(self::$instance->getRedirectUrl()); + $this->assertEquals('test_string', self::$instance->getRedirectUrl()); + } + + /** + * Test attribute "redirect_method" + */ + public function testPropertyRedirectMethod() + { + $this->assertInstanceOf(RedirectMethodEnum::class, self::$instance->getRedirectMethod()); + $this->assertSame(RedirectMethodEnum::GET, self::$instance->getRedirectMethod()); + } + + /** + * Test attribute "username" + */ + public function testPropertyUsername() + { + $this->assertIsString(self::$instance->getUsername()); + $this->assertEquals('test_string', self::$instance->getUsername()); + } + + /** + * Test attribute "password" + */ + public function testPropertyPassword() + { + $this->assertIsString(self::$instance->getPassword()); + $this->assertEquals('test_string', self::$instance->getPassword()); + } + + /** + * Test attribute "redirect_fallback_url" + */ + public function testPropertyRedirectFallbackUrl() + { + $this->assertIsString(self::$instance->getRedirectFallbackUrl()); + $this->assertEquals('test_string', self::$instance->getRedirectFallbackUrl()); + } + + /** + * Test attribute "redirect_fallback_method" + */ + public function testPropertyRedirectFallbackMethod() + { + $this->assertInstanceOf(RedirectMethodEnum::class, self::$instance->getRedirectFallbackMethod()); + $this->assertSame(RedirectMethodEnum::GET, self::$instance->getRedirectFallbackMethod()); + } + + /** + * Test attribute "fallback_username" + */ + public function testPropertyFallbackUsername() + { + $this->assertIsString(self::$instance->getFallbackUsername()); + $this->assertEquals('test_string', self::$instance->getFallbackUsername()); + } + + /** + * Test attribute "fallback_password" + */ + public function testPropertyFallbackPassword() + { + $this->assertIsString(self::$instance->getFallbackPassword()); + $this->assertEquals('test_string', self::$instance->getFallbackPassword()); + } + + /** + * Test attribute "tag" + */ + public function testPropertyTag() + { + $this->assertIsString(self::$instance->getTag()); + $this->assertEquals('test_string', self::$instance->getTag()); + }} diff --git a/tests/Unit/Model/UpdateConferenceMemberTest.php b/tests/Unit/Model/UpdateConferenceMemberTest.php new file mode 100644 index 0000000..85e9c59 --- /dev/null +++ b/tests/Unit/Model/UpdateConferenceMemberTest.php @@ -0,0 +1,92 @@ + true, + 'hold' => true, + 'call_ids_to_coach' => ['test_string'] + ]); + } + + /** + * Test "UpdateConferenceMember" + */ + public function testUpdateConferenceMember() + { + $this->assertInstanceOf(UpdateConferenceMember::class, self::$instance); + } + + /** + * Test attribute "mute" + */ + public function testPropertyMute() + { + $this->assertIsBool(self::$instance->getMute()); + $this->assertTrue(self::$instance->getMute()); + } + + /** + * Test attribute "hold" + */ + public function testPropertyHold() + { + $this->assertIsBool(self::$instance->getHold()); + $this->assertTrue(self::$instance->getHold()); + } + + /** + * Test attribute "call_ids_to_coach" + */ + public function testPropertyCallIdsToCoach() + { + $this->assertIsArray(self::$instance->getCallIdsToCoach()); + $this->assertEquals(['test_string'], self::$instance->getCallIdsToCoach()); + }} diff --git a/tests/Unit/Model/UpdateConferenceTest.php b/tests/Unit/Model/UpdateConferenceTest.php new file mode 100644 index 0000000..e8c5701 --- /dev/null +++ b/tests/Unit/Model/UpdateConferenceTest.php @@ -0,0 +1,154 @@ + ConferenceStateEnum::ACTIVE, + 'redirect_url' => 'test_string', + 'redirect_method' => RedirectMethodEnum::GET, + 'username' => 'test_string', + 'password' => 'test_string', + 'redirect_fallback_url' => 'test_string', + 'redirect_fallback_method' => RedirectMethodEnum::GET, + 'fallback_username' => 'test_string', + 'fallback_password' => 'test_string' + ]); + } + + /** + * Test "UpdateConference" + */ + public function testUpdateConference() + { + $this->assertInstanceOf(UpdateConference::class, self::$instance); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(ConferenceStateEnum::class, self::$instance->getStatus()); + $this->assertSame(ConferenceStateEnum::ACTIVE, self::$instance->getStatus()); + } + + /** + * Test attribute "redirect_url" + */ + public function testPropertyRedirectUrl() + { + $this->assertIsString(self::$instance->getRedirectUrl()); + $this->assertEquals('test_string', self::$instance->getRedirectUrl()); + } + + /** + * Test attribute "redirect_method" + */ + public function testPropertyRedirectMethod() + { + $this->assertInstanceOf(RedirectMethodEnum::class, self::$instance->getRedirectMethod()); + $this->assertSame(RedirectMethodEnum::GET, self::$instance->getRedirectMethod()); + } + + /** + * Test attribute "username" + */ + public function testPropertyUsername() + { + $this->assertIsString(self::$instance->getUsername()); + $this->assertEquals('test_string', self::$instance->getUsername()); + } + + /** + * Test attribute "password" + */ + public function testPropertyPassword() + { + $this->assertIsString(self::$instance->getPassword()); + $this->assertEquals('test_string', self::$instance->getPassword()); + } + + /** + * Test attribute "redirect_fallback_url" + */ + public function testPropertyRedirectFallbackUrl() + { + $this->assertIsString(self::$instance->getRedirectFallbackUrl()); + $this->assertEquals('test_string', self::$instance->getRedirectFallbackUrl()); + } + + /** + * Test attribute "redirect_fallback_method" + */ + public function testPropertyRedirectFallbackMethod() + { + $this->assertInstanceOf(RedirectMethodEnum::class, self::$instance->getRedirectFallbackMethod()); + $this->assertSame(RedirectMethodEnum::GET, self::$instance->getRedirectFallbackMethod()); + } + + /** + * Test attribute "fallback_username" + */ + public function testPropertyFallbackUsername() + { + $this->assertIsString(self::$instance->getFallbackUsername()); + $this->assertEquals('test_string', self::$instance->getFallbackUsername()); + } + + /** + * Test attribute "fallback_password" + */ + public function testPropertyFallbackPassword() + { + $this->assertIsString(self::$instance->getFallbackPassword()); + $this->assertEquals('test_string', self::$instance->getFallbackPassword()); + }} diff --git a/tests/Unit/Model/VerificationDenialWebhookTest.php b/tests/Unit/Model/VerificationDenialWebhookTest.php new file mode 100644 index 0000000..6645872 --- /dev/null +++ b/tests/Unit/Model/VerificationDenialWebhookTest.php @@ -0,0 +1,163 @@ + 'test_string', + 'additional_denial_reasons' => [new AdditionalDenialReason([])], + 'decline_reason_description' => 'test_string', + 'denial_status_code' => 1, + 'internal_ticket_number' => 'test_string', + 'phone_number' => 'test_string', + 'resubmit_allowed' => true, + 'status' => 'test_string', + 'blocked' => true, + 'blocked_reason' => 'test_string' + ]); + } + + /** + * Test "VerificationDenialWebhook" + */ + public function testVerificationDenialWebhook() + { + $this->assertInstanceOf(VerificationDenialWebhook::class, self::$instance); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "additional_denial_reasons" + */ + public function testPropertyAdditionalDenialReasons() + { + $this->assertIsArray(self::$instance->getAdditionalDenialReasons()); + $this->assertInstanceOf(AdditionalDenialReason::class, self::$instance->getAdditionalDenialReasons()[0]); + } + + /** + * Test attribute "decline_reason_description" + */ + public function testPropertyDeclineReasonDescription() + { + $this->assertIsString(self::$instance->getDeclineReasonDescription()); + $this->assertEquals('test_string', self::$instance->getDeclineReasonDescription()); + } + + /** + * Test attribute "denial_status_code" + */ + public function testPropertyDenialStatusCode() + { + $this->assertIsInt(self::$instance->getDenialStatusCode()); + $this->assertEquals(1, self::$instance->getDenialStatusCode()); + } + + /** + * Test attribute "internal_ticket_number" + */ + public function testPropertyInternalTicketNumber() + { + $this->assertIsString(self::$instance->getInternalTicketNumber()); + $this->assertEquals('test_string', self::$instance->getInternalTicketNumber()); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + $this->assertIsString(self::$instance->getPhoneNumber()); + $this->assertEquals('test_string', self::$instance->getPhoneNumber()); + } + + /** + * Test attribute "resubmit_allowed" + */ + public function testPropertyResubmitAllowed() + { + $this->assertIsBool(self::$instance->getResubmitAllowed()); + $this->assertTrue(self::$instance->getResubmitAllowed()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertIsString(self::$instance->getStatus()); + $this->assertEquals('test_string', self::$instance->getStatus()); + } + + /** + * Test attribute "blocked" + */ + public function testPropertyBlocked() + { + $this->assertIsBool(self::$instance->getBlocked()); + $this->assertTrue(self::$instance->getBlocked()); + } + + /** + * Test attribute "blocked_reason" + */ + public function testPropertyBlockedReason() + { + $this->assertIsString(self::$instance->getBlockedReason()); + $this->assertEquals('test_string', self::$instance->getBlockedReason()); + }} diff --git a/tests/Unit/Model/VerificationRequestTest.php b/tests/Unit/Model/VerificationRequestTest.php new file mode 100644 index 0000000..63ce096 --- /dev/null +++ b/tests/Unit/Model/VerificationRequestTest.php @@ -0,0 +1,264 @@ + new Address([]), + 'business_contact' => new Contact([]), + 'message_volume' => 1, + 'phone_numbers' => ['test_string'], + 'use_case' => 'test_string', + 'use_case_summary' => 'test_string', + 'production_message_content' => 'test_string', + 'opt_in_workflow' => new OptInWorkflow([]), + 'additional_information' => 'test_string', + 'isv_reseller' => 'test_string', + 'privacy_policy_url' => 'test_string', + 'terms_and_conditions_url' => 'test_string', + 'business_dba' => 'test_string', + 'business_registration_number' => 'test_string', + 'business_registration_type' => BusinessRegistrationTypeEnum::EIN, + 'business_registration_issuing_country' => 'test_string', + 'business_entity_type' => BusinessEntityTypeEnum::SOLE_PROPRIETOR, + 'help_message_response' => 'test_string', + 'age_gated_content' => true, + 'cv_token' => 'test_string' + ]); + } + + /** + * Test "VerificationRequest" + */ + public function testVerificationRequest() + { + $this->assertInstanceOf(VerificationRequest::class, self::$instance); + } + + /** + * Test attribute "business_address" + */ + public function testPropertyBusinessAddress() + { + $this->assertInstanceOf(Address::class, self::$instance->getBusinessAddress()); + } + + /** + * Test attribute "business_contact" + */ + public function testPropertyBusinessContact() + { + $this->assertInstanceOf(Contact::class, self::$instance->getBusinessContact()); + } + + /** + * Test attribute "message_volume" + */ + public function testPropertyMessageVolume() + { + $this->assertIsInt(self::$instance->getMessageVolume()); + $this->assertEquals(1, self::$instance->getMessageVolume()); + } + + /** + * Test attribute "phone_numbers" + */ + public function testPropertyPhoneNumbers() + { + $this->assertIsArray(self::$instance->getPhoneNumbers()); + $this->assertEquals(['test_string'], self::$instance->getPhoneNumbers()); + } + + /** + * Test attribute "use_case" + */ + public function testPropertyUseCase() + { + $this->assertIsString(self::$instance->getUseCase()); + $this->assertEquals('test_string', self::$instance->getUseCase()); + } + + /** + * Test attribute "use_case_summary" + */ + public function testPropertyUseCaseSummary() + { + $this->assertIsString(self::$instance->getUseCaseSummary()); + $this->assertEquals('test_string', self::$instance->getUseCaseSummary()); + } + + /** + * Test attribute "production_message_content" + */ + public function testPropertyProductionMessageContent() + { + $this->assertIsString(self::$instance->getProductionMessageContent()); + $this->assertEquals('test_string', self::$instance->getProductionMessageContent()); + } + + /** + * Test attribute "opt_in_workflow" + */ + public function testPropertyOptInWorkflow() + { + $this->assertInstanceOf(OptInWorkflow::class, self::$instance->getOptInWorkflow()); + } + + /** + * Test attribute "additional_information" + */ + public function testPropertyAdditionalInformation() + { + $this->assertIsString(self::$instance->getAdditionalInformation()); + $this->assertEquals('test_string', self::$instance->getAdditionalInformation()); + } + + /** + * Test attribute "isv_reseller" + */ + public function testPropertyIsvReseller() + { + $this->assertIsString(self::$instance->getIsvReseller()); + $this->assertEquals('test_string', self::$instance->getIsvReseller()); + } + + /** + * Test attribute "privacy_policy_url" + */ + public function testPropertyPrivacyPolicyUrl() + { + $this->assertIsString(self::$instance->getPrivacyPolicyUrl()); + $this->assertEquals('test_string', self::$instance->getPrivacyPolicyUrl()); + } + + /** + * Test attribute "terms_and_conditions_url" + */ + public function testPropertyTermsAndConditionsUrl() + { + $this->assertIsString(self::$instance->getTermsAndConditionsUrl()); + $this->assertEquals('test_string', self::$instance->getTermsAndConditionsUrl()); + } + + /** + * Test attribute "business_dba" + */ + public function testPropertyBusinessDba() + { + $this->assertIsString(self::$instance->getBusinessDba()); + $this->assertEquals('test_string', self::$instance->getBusinessDba()); + } + + /** + * Test attribute "business_registration_number" + */ + public function testPropertyBusinessRegistrationNumber() + { + $this->assertIsString(self::$instance->getBusinessRegistrationNumber()); + $this->assertEquals('test_string', self::$instance->getBusinessRegistrationNumber()); + } + + /** + * Test attribute "business_registration_type" + */ + public function testPropertyBusinessRegistrationType() + { + $this->assertInstanceOf(BusinessRegistrationTypeEnum::class, self::$instance->getBusinessRegistrationType()); + $this->assertSame(BusinessRegistrationTypeEnum::EIN, self::$instance->getBusinessRegistrationType()); + } + + /** + * Test attribute "business_registration_issuing_country" + */ + public function testPropertyBusinessRegistrationIssuingCountry() + { + $this->assertIsString(self::$instance->getBusinessRegistrationIssuingCountry()); + $this->assertEquals('test_string', self::$instance->getBusinessRegistrationIssuingCountry()); + } + + /** + * Test attribute "business_entity_type" + */ + public function testPropertyBusinessEntityType() + { + $this->assertInstanceOf(BusinessEntityTypeEnum::class, self::$instance->getBusinessEntityType()); + $this->assertSame(BusinessEntityTypeEnum::SOLE_PROPRIETOR, self::$instance->getBusinessEntityType()); + } + + /** + * Test attribute "help_message_response" + */ + public function testPropertyHelpMessageResponse() + { + $this->assertIsString(self::$instance->getHelpMessageResponse()); + $this->assertEquals('test_string', self::$instance->getHelpMessageResponse()); + } + + /** + * Test attribute "age_gated_content" + */ + public function testPropertyAgeGatedContent() + { + $this->assertIsBool(self::$instance->getAgeGatedContent()); + $this->assertTrue(self::$instance->getAgeGatedContent()); + } + + /** + * Test attribute "cv_token" + */ + public function testPropertyCvToken() + { + $this->assertIsString(self::$instance->getCvToken()); + $this->assertEquals('test_string', self::$instance->getCvToken()); + }} diff --git a/tests/Unit/Model/VerificationUpdateRequestTest.php b/tests/Unit/Model/VerificationUpdateRequestTest.php new file mode 100644 index 0000000..a2224f0 --- /dev/null +++ b/tests/Unit/Model/VerificationUpdateRequestTest.php @@ -0,0 +1,254 @@ + new Address([]), + 'business_contact' => new Contact([]), + 'message_volume' => 1, + 'use_case' => 'test_string', + 'use_case_summary' => 'test_string', + 'production_message_content' => 'test_string', + 'opt_in_workflow' => new OptInWorkflow([]), + 'additional_information' => 'test_string', + 'isv_reseller' => 'test_string', + 'privacy_policy_url' => 'test_string', + 'terms_and_conditions_url' => 'test_string', + 'business_dba' => 'test_string', + 'business_registration_number' => 'test_string', + 'business_registration_type' => BusinessRegistrationTypeEnum::EIN, + 'business_entity_type' => BusinessEntityTypeEnum::SOLE_PROPRIETOR, + 'business_registration_issuing_country' => 'test_string', + 'help_message_response' => 'test_string', + 'age_gated_content' => true, + 'cv_token' => 'test_string' + ]); + } + + /** + * Test "VerificationUpdateRequest" + */ + public function testVerificationUpdateRequest() + { + $this->assertInstanceOf(VerificationUpdateRequest::class, self::$instance); + } + + /** + * Test attribute "business_address" + */ + public function testPropertyBusinessAddress() + { + $this->assertInstanceOf(Address::class, self::$instance->getBusinessAddress()); + } + + /** + * Test attribute "business_contact" + */ + public function testPropertyBusinessContact() + { + $this->assertInstanceOf(Contact::class, self::$instance->getBusinessContact()); + } + + /** + * Test attribute "message_volume" + */ + public function testPropertyMessageVolume() + { + $this->assertIsInt(self::$instance->getMessageVolume()); + $this->assertEquals(1, self::$instance->getMessageVolume()); + } + + /** + * Test attribute "use_case" + */ + public function testPropertyUseCase() + { + $this->assertIsString(self::$instance->getUseCase()); + $this->assertEquals('test_string', self::$instance->getUseCase()); + } + + /** + * Test attribute "use_case_summary" + */ + public function testPropertyUseCaseSummary() + { + $this->assertIsString(self::$instance->getUseCaseSummary()); + $this->assertEquals('test_string', self::$instance->getUseCaseSummary()); + } + + /** + * Test attribute "production_message_content" + */ + public function testPropertyProductionMessageContent() + { + $this->assertIsString(self::$instance->getProductionMessageContent()); + $this->assertEquals('test_string', self::$instance->getProductionMessageContent()); + } + + /** + * Test attribute "opt_in_workflow" + */ + public function testPropertyOptInWorkflow() + { + $this->assertInstanceOf(OptInWorkflow::class, self::$instance->getOptInWorkflow()); + } + + /** + * Test attribute "additional_information" + */ + public function testPropertyAdditionalInformation() + { + $this->assertIsString(self::$instance->getAdditionalInformation()); + $this->assertEquals('test_string', self::$instance->getAdditionalInformation()); + } + + /** + * Test attribute "isv_reseller" + */ + public function testPropertyIsvReseller() + { + $this->assertIsString(self::$instance->getIsvReseller()); + $this->assertEquals('test_string', self::$instance->getIsvReseller()); + } + + /** + * Test attribute "privacy_policy_url" + */ + public function testPropertyPrivacyPolicyUrl() + { + $this->assertIsString(self::$instance->getPrivacyPolicyUrl()); + $this->assertEquals('test_string', self::$instance->getPrivacyPolicyUrl()); + } + + /** + * Test attribute "terms_and_conditions_url" + */ + public function testPropertyTermsAndConditionsUrl() + { + $this->assertIsString(self::$instance->getTermsAndConditionsUrl()); + $this->assertEquals('test_string', self::$instance->getTermsAndConditionsUrl()); + } + + /** + * Test attribute "business_dba" + */ + public function testPropertyBusinessDba() + { + $this->assertIsString(self::$instance->getBusinessDba()); + $this->assertEquals('test_string', self::$instance->getBusinessDba()); + } + + /** + * Test attribute "business_registration_number" + */ + public function testPropertyBusinessRegistrationNumber() + { + $this->assertIsString(self::$instance->getBusinessRegistrationNumber()); + $this->assertEquals('test_string', self::$instance->getBusinessRegistrationNumber()); + } + + /** + * Test attribute "business_registration_type" + */ + public function testPropertyBusinessRegistrationType() + { + $this->assertInstanceOf(BusinessRegistrationTypeEnum::class, self::$instance->getBusinessRegistrationType()); + $this->assertSame(BusinessRegistrationTypeEnum::EIN, self::$instance->getBusinessRegistrationType()); + } + + /** + * Test attribute "business_entity_type" + */ + public function testPropertyBusinessEntityType() + { + $this->assertInstanceOf(BusinessEntityTypeEnum::class, self::$instance->getBusinessEntityType()); + $this->assertSame(BusinessEntityTypeEnum::SOLE_PROPRIETOR, self::$instance->getBusinessEntityType()); + } + + /** + * Test attribute "business_registration_issuing_country" + */ + public function testPropertyBusinessRegistrationIssuingCountry() + { + $this->assertIsString(self::$instance->getBusinessRegistrationIssuingCountry()); + $this->assertEquals('test_string', self::$instance->getBusinessRegistrationIssuingCountry()); + } + + /** + * Test attribute "help_message_response" + */ + public function testPropertyHelpMessageResponse() + { + $this->assertIsString(self::$instance->getHelpMessageResponse()); + $this->assertEquals('test_string', self::$instance->getHelpMessageResponse()); + } + + /** + * Test attribute "age_gated_content" + */ + public function testPropertyAgeGatedContent() + { + $this->assertIsBool(self::$instance->getAgeGatedContent()); + $this->assertTrue(self::$instance->getAgeGatedContent()); + } + + /** + * Test attribute "cv_token" + */ + public function testPropertyCvToken() + { + $this->assertIsString(self::$instance->getCvToken()); + $this->assertEquals('test_string', self::$instance->getCvToken()); + }} diff --git a/tests/Unit/Model/VerificationWebhookTest.php b/tests/Unit/Model/VerificationWebhookTest.php new file mode 100644 index 0000000..51a6415 --- /dev/null +++ b/tests/Unit/Model/VerificationWebhookTest.php @@ -0,0 +1,103 @@ + 'test_string', + 'phone_number' => 'test_string', + 'status' => TfvCallbackStatusEnum::VERIFIED, + 'internal_ticket_number' => 'test_string' + ]); + } + + /** + * Test "VerificationWebhook" + */ + public function testVerificationWebhook() + { + $this->assertInstanceOf(VerificationWebhook::class, self::$instance); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "phone_number" + */ + public function testPropertyPhoneNumber() + { + $this->assertIsString(self::$instance->getPhoneNumber()); + $this->assertEquals('test_string', self::$instance->getPhoneNumber()); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + $this->assertInstanceOf(TfvCallbackStatusEnum::class, self::$instance->getStatus()); + $this->assertSame(TfvCallbackStatusEnum::VERIFIED, self::$instance->getStatus()); + } + + /** + * Test attribute "internal_ticket_number" + */ + public function testPropertyInternalTicketNumber() + { + $this->assertIsString(self::$instance->getInternalTicketNumber()); + $this->assertEquals('test_string', self::$instance->getInternalTicketNumber()); + }} diff --git a/tests/Unit/Model/VerifyCodeRequestTest.php b/tests/Unit/Model/VerifyCodeRequestTest.php new file mode 100644 index 0000000..72b3b7f --- /dev/null +++ b/tests/Unit/Model/VerifyCodeRequestTest.php @@ -0,0 +1,102 @@ + 'test_string', + 'scope' => 'test_string', + 'expiration_time_in_minutes' => 1.5, + 'code' => 'test_string' + ]); + } + + /** + * Test "VerifyCodeRequest" + */ + public function testVerifyCodeRequest() + { + $this->assertInstanceOf(VerifyCodeRequest::class, self::$instance); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + $this->assertIsString(self::$instance->getTo()); + $this->assertEquals('test_string', self::$instance->getTo()); + } + + /** + * Test attribute "scope" + */ + public function testPropertyScope() + { + $this->assertIsString(self::$instance->getScope()); + $this->assertEquals('test_string', self::$instance->getScope()); + } + + /** + * Test attribute "expiration_time_in_minutes" + */ + public function testPropertyExpirationTimeInMinutes() + { + $this->assertIsFloat(self::$instance->getExpirationTimeInMinutes()); + $this->assertEquals(1.5, self::$instance->getExpirationTimeInMinutes()); + } + + /** + * Test attribute "code" + */ + public function testPropertyCode() + { + $this->assertIsString(self::$instance->getCode()); + $this->assertEquals('test_string', self::$instance->getCode()); + }} diff --git a/tests/Unit/Model/VerifyCodeResponseTest.php b/tests/Unit/Model/VerifyCodeResponseTest.php new file mode 100644 index 0000000..2c8d4a0 --- /dev/null +++ b/tests/Unit/Model/VerifyCodeResponseTest.php @@ -0,0 +1,72 @@ + true + ]); + } + + /** + * Test "VerifyCodeResponse" + */ + public function testVerifyCodeResponse() + { + $this->assertInstanceOf(VerifyCodeResponse::class, self::$instance); + } + + /** + * Test attribute "valid" + */ + public function testPropertyValid() + { + $this->assertIsBool(self::$instance->getValid()); + $this->assertTrue(self::$instance->getValid()); + }} diff --git a/tests/Unit/Model/VoiceApiErrorTest.php b/tests/Unit/Model/VoiceApiErrorTest.php new file mode 100644 index 0000000..04c8f85 --- /dev/null +++ b/tests/Unit/Model/VoiceApiErrorTest.php @@ -0,0 +1,92 @@ + 'test_string', + 'description' => 'test_string', + 'id' => 'test_string' + ]); + } + + /** + * Test "VoiceApiError" + */ + public function testVoiceApiError() + { + $this->assertInstanceOf(VoiceApiError::class, self::$instance); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertIsString(self::$instance->getType()); + $this->assertEquals('test_string', self::$instance->getType()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + $this->assertIsString(self::$instance->getId()); + $this->assertEquals('test_string', self::$instance->getId()); + }} diff --git a/tests/Unit/Model/VoiceCodeResponseTest.php b/tests/Unit/Model/VoiceCodeResponseTest.php new file mode 100644 index 0000000..5ad055b --- /dev/null +++ b/tests/Unit/Model/VoiceCodeResponseTest.php @@ -0,0 +1,72 @@ + 'test_string' + ]); + } + + /** + * Test "VoiceCodeResponse" + */ + public function testVoiceCodeResponse() + { + $this->assertInstanceOf(VoiceCodeResponse::class, self::$instance); + } + + /** + * Test attribute "call_id" + */ + public function testPropertyCallId() + { + $this->assertIsString(self::$instance->getCallId()); + $this->assertEquals('test_string', self::$instance->getCallId()); + }} diff --git a/tests/Unit/Model/WebhookSubscriptionBasicAuthenticationTest.php b/tests/Unit/Model/WebhookSubscriptionBasicAuthenticationTest.php new file mode 100644 index 0000000..37a290b --- /dev/null +++ b/tests/Unit/Model/WebhookSubscriptionBasicAuthenticationTest.php @@ -0,0 +1,82 @@ + 'test_string', + 'password' => 'test_string' + ]); + } + + /** + * Test "WebhookSubscriptionBasicAuthentication" + */ + public function testWebhookSubscriptionBasicAuthentication() + { + $this->assertInstanceOf(WebhookSubscriptionBasicAuthentication::class, self::$instance); + } + + /** + * Test attribute "username" + */ + public function testPropertyUsername() + { + $this->assertIsString(self::$instance->getUsername()); + $this->assertEquals('test_string', self::$instance->getUsername()); + } + + /** + * Test attribute "password" + */ + public function testPropertyPassword() + { + $this->assertIsString(self::$instance->getPassword()); + $this->assertEquals('test_string', self::$instance->getPassword()); + }} diff --git a/tests/Unit/Model/WebhookSubscriptionErrorTest.php b/tests/Unit/Model/WebhookSubscriptionErrorTest.php new file mode 100644 index 0000000..965f70f --- /dev/null +++ b/tests/Unit/Model/WebhookSubscriptionErrorTest.php @@ -0,0 +1,93 @@ + 1, + 'description' => 'test_string', + 'telephone_numbers' => [new TelephoneNumber([])] + ]); + } + + /** + * Test "WebhookSubscriptionError" + */ + public function testWebhookSubscriptionError() + { + $this->assertInstanceOf(WebhookSubscriptionError::class, self::$instance); + } + + /** + * Test attribute "code" + */ + public function testPropertyCode() + { + $this->assertIsInt(self::$instance->getCode()); + $this->assertEquals(1, self::$instance->getCode()); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + $this->assertIsString(self::$instance->getDescription()); + $this->assertEquals('test_string', self::$instance->getDescription()); + } + + /** + * Test attribute "telephone_numbers" + */ + public function testPropertyTelephoneNumbers() + { + $this->assertIsArray(self::$instance->getTelephoneNumbers()); + $this->assertInstanceOf(TelephoneNumber::class, self::$instance->getTelephoneNumbers()[0]); + }} diff --git a/tests/Unit/Model/WebhookSubscriptionRequestSchemaTest.php b/tests/Unit/Model/WebhookSubscriptionRequestSchemaTest.php new file mode 100644 index 0000000..8176d3d --- /dev/null +++ b/tests/Unit/Model/WebhookSubscriptionRequestSchemaTest.php @@ -0,0 +1,92 @@ + new TfvBasicAuthentication([]), + 'callback_url' => 'test_string', + 'shared_secret_key' => 'test_string' + ]); + } + + /** + * Test "WebhookSubscriptionRequestSchema" + */ + public function testWebhookSubscriptionRequestSchema() + { + $this->assertInstanceOf(WebhookSubscriptionRequestSchema::class, self::$instance); + } + + /** + * Test attribute "basic_authentication" + */ + public function testPropertyBasicAuthentication() + { + $this->assertInstanceOf(TfvBasicAuthentication::class, self::$instance->getBasicAuthentication()); + } + + /** + * Test attribute "callback_url" + */ + public function testPropertyCallbackUrl() + { + $this->assertIsString(self::$instance->getCallbackUrl()); + $this->assertEquals('test_string', self::$instance->getCallbackUrl()); + } + + /** + * Test attribute "shared_secret_key" + */ + public function testPropertySharedSecretKey() + { + $this->assertIsString(self::$instance->getSharedSecretKey()); + $this->assertEquals('test_string', self::$instance->getSharedSecretKey()); + }} diff --git a/tests/Unit/Model/WebhookSubscriptionTest.php b/tests/Unit/Model/WebhookSubscriptionTest.php new file mode 100644 index 0000000..2c71cd3 --- /dev/null +++ b/tests/Unit/Model/WebhookSubscriptionTest.php @@ -0,0 +1,133 @@ + 'test_string', + 'account_id' => 'test_string', + 'callback_url' => 'test_string', + 'type' => WebhookSubscriptionTypeEnum::TOLLFREE_VERIFICATION_STATUS, + 'basic_authentication' => new WebhookSubscriptionBasicAuthentication([]), + 'created_date' => new \DateTime('2024-01-01T00:00:00+00:00'), + 'modified_date' => new \DateTime('2024-01-01T00:00:00+00:00') + ]); + } + + /** + * Test "WebhookSubscription" + */ + public function testWebhookSubscription() + { + $this->assertInstanceOf(WebhookSubscription::class, self::$instance); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + $this->assertIsString(self::$instance->getId()); + $this->assertEquals('test_string', self::$instance->getId()); + } + + /** + * Test attribute "account_id" + */ + public function testPropertyAccountId() + { + $this->assertIsString(self::$instance->getAccountId()); + $this->assertEquals('test_string', self::$instance->getAccountId()); + } + + /** + * Test attribute "callback_url" + */ + public function testPropertyCallbackUrl() + { + $this->assertIsString(self::$instance->getCallbackUrl()); + $this->assertEquals('test_string', self::$instance->getCallbackUrl()); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + $this->assertInstanceOf(WebhookSubscriptionTypeEnum::class, self::$instance->getType()); + $this->assertSame(WebhookSubscriptionTypeEnum::TOLLFREE_VERIFICATION_STATUS, self::$instance->getType()); + } + + /** + * Test attribute "basic_authentication" + */ + public function testPropertyBasicAuthentication() + { + $this->assertInstanceOf(WebhookSubscriptionBasicAuthentication::class, self::$instance->getBasicAuthentication()); + } + + /** + * Test attribute "created_date" + */ + public function testPropertyCreatedDate() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getCreatedDate()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getCreatedDate()); + } + + /** + * Test attribute "modified_date" + */ + public function testPropertyModifiedDate() + { + $this->assertInstanceOf(\DateTime::class, self::$instance->getModifiedDate()); + $this->assertEquals(new \DateTime('2024-01-01T00:00:00+00:00'), self::$instance->getModifiedDate()); + }} diff --git a/tests/Unit/Model/WebhookSubscriptionTypeEnumTest.php b/tests/Unit/Model/WebhookSubscriptionTypeEnumTest.php new file mode 100644 index 0000000..c51d4d4 --- /dev/null +++ b/tests/Unit/Model/WebhookSubscriptionTypeEnumTest.php @@ -0,0 +1,56 @@ +assertSame( + ['TOLLFREE_VERIFICATION_STATUS', 'MESSAGING_PORTOUT_APPROVAL_STATUS'], + array_column(WebhookSubscriptionTypeEnum::cases(), 'value') + ); + } +} diff --git a/tests/Unit/Model/WebhookSubscriptionsListBodyTest.php b/tests/Unit/Model/WebhookSubscriptionsListBodyTest.php new file mode 100644 index 0000000..fcad228 --- /dev/null +++ b/tests/Unit/Model/WebhookSubscriptionsListBodyTest.php @@ -0,0 +1,94 @@ + new LinksObject([]), + 'errors' => [new WebhookSubscriptionError([])], + 'data' => [new WebhookSubscription([])] + ]); + } + + /** + * Test "WebhookSubscriptionsListBody" + */ + public function testWebhookSubscriptionsListBody() + { + $this->assertInstanceOf(WebhookSubscriptionsListBody::class, self::$instance); + } + + /** + * Test attribute "links" + */ + public function testPropertyLinks() + { + $this->assertInstanceOf(LinksObject::class, self::$instance->getLinks()); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + $this->assertIsArray(self::$instance->getErrors()); + $this->assertInstanceOf(WebhookSubscriptionError::class, self::$instance->getErrors()[0]); + } + + /** + * Test attribute "data" + */ + public function testPropertyData() + { + $this->assertIsArray(self::$instance->getData()); + $this->assertInstanceOf(WebhookSubscription::class, self::$instance->getData()[0]); + }} diff --git a/tests/Utils/CallCleanup.php b/tests/Utils/CallCleanup.php new file mode 100644 index 0000000..4275b4c --- /dev/null +++ b/tests/Utils/CallCleanup.php @@ -0,0 +1,44 @@ +getCallStateWithHttpInfo($accountId, $callId); + if (strcasecmp($call_state->getState(), 'disconnected') !== 0) { + $api->updateCallWithHttpInfo( + $accountId, + $callId, + new UpdateCall(['state' => CallStateEnum::COMPLETED]) + ); + } + } + } +} diff --git a/tests/Utils/Manteca.php b/tests/Utils/Manteca.php new file mode 100644 index 0000000..a8bfae3 --- /dev/null +++ b/tests/Utils/Manteca.php @@ -0,0 +1,72 @@ +post("{$base_url}/tests", [ + 'json' => [ + 'os' => $os, + 'language' => $language, + 'type' => $type, + ], + 'http_errors' => false, + ]); + + if ($response->getStatusCode() >= 300) { + throw new \RuntimeException( + "Failed to create Manteca test: [{$response->getStatusCode()}] " . (string) $response->getBody() + ); + } + + return (string) $response->getBody(); + } + + /** + * Fetch the status of a Manteca test. + * + * @param string $testId The Manteca test ID + * + * @return array Decoded status body (e.g. callRecorded, callTranscribed) + */ + public static function getStatus(string $testId): array + { + $base_url = getenv("MANTECA_BASE_URL"); + + $response = (new Client())->get("{$base_url}/tests/{$testId}", [ + 'http_errors' => false, + ]); + + if ($response->getStatusCode() >= 300) { + throw new \RuntimeException( + "Failed to get Manteca test status: [{$response->getStatusCode()}] " . (string) $response->getBody() + ); + } + + return json_decode((string) $response->getBody(), true); + } +} diff --git a/tests/WebRtcBxmlTest.php b/tests/WebRtcBxmlTest.php deleted file mode 100644 index 64aa7ed..0000000 --- a/tests/WebRtcBxmlTest.php +++ /dev/null @@ -1,26 +0,0 @@ -sip:sipx.webrtc.bandwidth.com:5060'; - $actual = BandwidthLib\WebRtc\Utils\WebRtcTransfer::generateBxml('asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4'); - $this->assertEquals($expected, $actual); - } - - public function testGenerateTransferBxmlVerb() { - $expected = 'sip:sipx.webrtc.bandwidth.com:5060'; - $actual = BandwidthLib\WebRtc\Utils\WebRtcTransfer::generateTransferBxmlVerb('asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4'); - $this->assertEquals($expected, $actual); - } -}