From f80de67f677e0876fa21247031929dd17a12fa39 Mon Sep 17 00:00:00 2001 From: Sudhanshu Moghe Date: Tue, 20 Jan 2026 15:04:51 -0500 Subject: [PATCH] Refactor Bandwidth SDK models to use System.Text.Json for serialization and deserialization - Updated StatusCallbackTypeEnum to include JSON converters and improved enum handling. - Refactored StirShaken model to utilize Option for nullable properties and added custom JSON converter. - Modified SyncLookupRequest to implement Option for phone numbers and added JSON serialization logic. - Added README.md for library usage instructions and configuration details. --- .openapi-generator-ignore | 63 + .openapi-generator/FILES | 416 +- .openapi-generator/VERSION | 2 +- Bandwidth.Standard.sln | 10 +- README.md | 368 +- api/openapi.yaml | 3667 ++++++++++++----- bandwidth.yml | 866 +++- docs/EndpointsApi.md | 241 ++ docs/scripts/git_push.ps1 | 75 + docs/scripts/git_push.sh | 49 + src/Bandwidth.Standard/Api/EndpointsApi.cs | 3489 ++++++++++++++++ src/Bandwidth.Standard/Api/IApi.cs | 15 + src/Bandwidth.Standard/Client/ApiException.cs | 52 +- src/Bandwidth.Standard/Client/ApiFactory.cs | 49 + .../Client/ApiResponseEventArgs.cs | 24 + .../Client/ApiResponse`1.cs | 484 +++ src/Bandwidth.Standard/Client/BasicToken.cs | 42 + src/Bandwidth.Standard/Client/ClientUtils.cs | 314 +- .../Client/CookieContainer.cs | 18 + .../Client/DateTimeJsonConverter.cs | 78 + .../Client/DateTimeNullableJsonConverter.cs | 83 + .../Client/ExceptionEventArgs.cs | 24 + .../Client/HostConfiguration.cs | 386 ++ .../Client/JsonSerializerOptionsProvider.cs | 25 + src/Bandwidth.Standard/Client/OAuthToken.cs | 37 + src/Bandwidth.Standard/Client/Option.cs | 52 + .../Client/RateLimitProvider`1.cs | 57 + src/Bandwidth.Standard/Client/TokenBase.cs | 69 + .../Client/TokenContainer`1.cs | 35 + .../Client/TokenProvider`1.cs | 43 + .../Extensions/IHostBuilderExtensions.cs | 42 + .../IHttpClientBuilderExtensions.cs | 78 + .../IServiceCollectionExtensions.cs | 62 + src/Bandwidth.Standard/Model/Endpoint.cs | 331 ++ .../Model/EndpointDirectionEnum.cs | 188 + src/Bandwidth.Standard/Model/EndpointEvent.cs | 383 ++ .../Model/EndpointEventTypeEnum.cs | 174 + .../Model/EndpointResponse.cs | 211 + .../Model/EndpointStatusEnum.cs | 174 + .../Model/EndpointTypeEnum.cs | 160 + src/Bandwidth.Standard/Model/Endpoints.cs | 299 ++ src/Bandwidth.Standard/Model/Error.cs | 182 +- src/Bandwidth.Standard/Model/ErrorObject.cs | 182 +- src/Bandwidth.Standard/Model/ErrorResponse.cs | 210 + src/Bandwidth.Standard/Model/ErrorSource.cs | 210 +- src/Bandwidth.Standard/Model/Page.cs | 269 ++ src/Bandwidth.Standard/Model/PageInfo.cs | 218 +- src/Bandwidth.Standard/Model/PriorityEnum.cs | 144 +- .../Model/ProductTypeEnum.cs | 214 +- .../Model/SipConnectionMetadata.cs | 259 ++ .../Model/SipCredentials.cs | 200 + .../Model/SmsMessageContent.cs | 131 +- .../Model/StandaloneCardOrientationEnum.cs | 144 +- .../Model/StatusCallback.cs | 344 +- .../Model/StatusCallbackMessage.cs | 466 ++- .../Model/StatusCallbackTypeEnum.cs | 180 +- src/Bandwidth.Standard/Model/StirShaken.cs | 188 +- .../Model/SyncLookupRequest.cs | 130 +- src/Bandwidth.Standard/README.md | 119 + 59 files changed, 14535 insertions(+), 2490 deletions(-) create mode 100644 docs/EndpointsApi.md create mode 100644 docs/scripts/git_push.ps1 create mode 100644 docs/scripts/git_push.sh create mode 100644 src/Bandwidth.Standard/Api/EndpointsApi.cs create mode 100644 src/Bandwidth.Standard/Api/IApi.cs create mode 100644 src/Bandwidth.Standard/Client/ApiFactory.cs create mode 100644 src/Bandwidth.Standard/Client/ApiResponseEventArgs.cs create mode 100644 src/Bandwidth.Standard/Client/ApiResponse`1.cs create mode 100644 src/Bandwidth.Standard/Client/BasicToken.cs create mode 100644 src/Bandwidth.Standard/Client/CookieContainer.cs create mode 100644 src/Bandwidth.Standard/Client/DateTimeJsonConverter.cs create mode 100644 src/Bandwidth.Standard/Client/DateTimeNullableJsonConverter.cs create mode 100644 src/Bandwidth.Standard/Client/ExceptionEventArgs.cs create mode 100644 src/Bandwidth.Standard/Client/HostConfiguration.cs create mode 100644 src/Bandwidth.Standard/Client/JsonSerializerOptionsProvider.cs create mode 100644 src/Bandwidth.Standard/Client/OAuthToken.cs create mode 100644 src/Bandwidth.Standard/Client/Option.cs create mode 100644 src/Bandwidth.Standard/Client/RateLimitProvider`1.cs create mode 100644 src/Bandwidth.Standard/Client/TokenBase.cs create mode 100644 src/Bandwidth.Standard/Client/TokenContainer`1.cs create mode 100644 src/Bandwidth.Standard/Client/TokenProvider`1.cs create mode 100644 src/Bandwidth.Standard/Extensions/IHostBuilderExtensions.cs create mode 100644 src/Bandwidth.Standard/Extensions/IHttpClientBuilderExtensions.cs create mode 100644 src/Bandwidth.Standard/Extensions/IServiceCollectionExtensions.cs create mode 100644 src/Bandwidth.Standard/Model/Endpoint.cs create mode 100644 src/Bandwidth.Standard/Model/EndpointDirectionEnum.cs create mode 100644 src/Bandwidth.Standard/Model/EndpointEvent.cs create mode 100644 src/Bandwidth.Standard/Model/EndpointEventTypeEnum.cs create mode 100644 src/Bandwidth.Standard/Model/EndpointResponse.cs create mode 100644 src/Bandwidth.Standard/Model/EndpointStatusEnum.cs create mode 100644 src/Bandwidth.Standard/Model/EndpointTypeEnum.cs create mode 100644 src/Bandwidth.Standard/Model/Endpoints.cs create mode 100644 src/Bandwidth.Standard/Model/ErrorResponse.cs create mode 100644 src/Bandwidth.Standard/Model/Page.cs create mode 100644 src/Bandwidth.Standard/Model/SipConnectionMetadata.cs create mode 100644 src/Bandwidth.Standard/Model/SipCredentials.cs create mode 100644 src/Bandwidth.Standard/README.md diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore index 199237d8..a78ea5dd 100644 --- a/.openapi-generator-ignore +++ b/.openapi-generator-ignore @@ -26,3 +26,66 @@ src/Bandwidth.Standard.Test/Bandwidth.Standard.Test.csproj src/Bandwidth.Standard.Test/ src/Bandwidth.Standard/Bandwidth.Standard.csproj + +# Ignore ALL existing files - only allow endpoint-related files to be generated +# API files +src/Bandwidth.Standard/Api/CallsApi.cs +src/Bandwidth.Standard/Api/ConferencesApi.cs +src/Bandwidth.Standard/Api/MediaApi.cs +src/Bandwidth.Standard/Api/MessagesApi.cs +src/Bandwidth.Standard/Api/MFAApi.cs +src/Bandwidth.Standard/Api/MultiChannelApi.cs +src/Bandwidth.Standard/Api/PhoneNumberLookupApi.cs +src/Bandwidth.Standard/Api/RecordingsApi.cs +src/Bandwidth.Standard/Api/StatisticsApi.cs +src/Bandwidth.Standard/Api/TollFreeVerificationApi.cs +src/Bandwidth.Standard/Api/TranscriptionsApi.cs + +# Model files - ignore everything except Endpoint-related +src/Bandwidth.Standard/Model/[A-C]*.cs +src/Bandwidth.Standard/Model/D[a-m]*.cs +src/Bandwidth.Standard/Model/D[o-z]*.cs +src/Bandwidth.Standard/Model/E[a-m]*.cs +src/Bandwidth.Standard/Model/E[o-q]*.cs +src/Bandwidth.Standard/Model/E[s-z]*.cs +src/Bandwidth.Standard/Model/[F-O]*.cs +src/Bandwidth.Standard/Model/Q*.cs +src/Bandwidth.Standard/Model/R*.cs +src/Bandwidth.Standard/Model/T*.cs +src/Bandwidth.Standard/Model/U*.cs +src/Bandwidth.Standard/Model/V*.cs +src/Bandwidth.Standard/Model/[W-Z]*.cs +src/Bandwidth.Standard/Model/Bxml/ + +# Docs - ignore everything except Endpoint-related +# Ignore subdirectories that generator creates +docs/apis/ +docs/models/ + +# Ignore all existing API docs (flat structure) +docs/CallsApi.md +docs/ConferencesApi.md +docs/MediaApi.md +docs/MessagesApi.md +docs/MFAApi.md +docs/MultiChannelApi.md +docs/PhoneNumberLookupApi.md +docs/RecordingsApi.md +docs/StatisticsApi.md +docs/TollFreeVerificationApi.md +docs/TranscriptionsApi.md + +# Ignore all existing model docs +docs/[A-C]*.md +docs/D[a-m]*.md +docs/D[o-z]*.md +docs/E[a-m]*.md +docs/E[o-q]*.md +docs/E[s-z]*.md +docs/[F-O]*.md +docs/Q*.md +docs/R*.md +docs/T*.md +docs/U*.md +docs/V*.md +docs/[W-Z]*.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 9fa5c7fe..66aba2b6 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -2,362 +2,49 @@ Bandwidth.Standard.sln README.md api/openapi.yaml appveyor.yml -docs/AccountStatistics.md -docs/AdditionalDenialReason.md -docs/Address.md -docs/AnswerCallback.md -docs/AsyncLookupRequest.md -docs/BlockedWebhook.md -docs/BridgeCompleteCallback.md -docs/BridgeTargetCompleteCallback.md -docs/BusinessEntityTypeEnum.md -docs/BusinessRegistrationTypeEnum.md -docs/CallDirectionEnum.md -docs/CallRecordingMetadata.md -docs/CallState.md -docs/CallStateEnum.md -docs/CallTranscription.md -docs/CallTranscriptionDetectedLanguageEnum.md -docs/CallTranscriptionMetadata.md -docs/CallTranscriptionResponse.md -docs/CallTranscriptionTrackEnum.md -docs/Callback.md -docs/CallbackMethodEnum.md -docs/CallsApi.md -docs/CardWidthEnum.md -docs/CodeRequest.md -docs/CompletedLookupStatusEnum.md -docs/Conference.md -docs/ConferenceCompletedCallback.md -docs/ConferenceCreatedCallback.md -docs/ConferenceMember.md -docs/ConferenceMemberExitCallback.md -docs/ConferenceMemberJoinCallback.md -docs/ConferenceRecordingAvailableCallback.md -docs/ConferenceRecordingMetadata.md -docs/ConferenceRedirectCallback.md -docs/ConferenceStateEnum.md -docs/ConferencesApi.md -docs/Contact.md -docs/CreateAsyncBulkLookupResponse.md -docs/CreateAsyncBulkLookupResponseData.md -docs/CreateCall.md -docs/CreateCallResponse.md -docs/CreateMessageRequestError.md -docs/CreateMultiChannelMessageResponse.md -docs/CreateSyncLookupResponse.md -docs/CreateSyncLookupResponseData.md -docs/DeactivationEventEnum.md -docs/DisconnectCallback.md -docs/Diversion.md -docs/DtmfCallback.md -docs/Error.md -docs/ErrorObject.md -docs/ErrorSource.md -docs/FailureWebhook.md -docs/FieldError.md -docs/FileFormatEnum.md -docs/GatherCallback.md -docs/GetAsyncBulkLookupResponse.md -docs/GetAsyncBulkLookupResponseData.md -docs/InProgressLookupStatusEnum.md -docs/InboundCallback.md -docs/InboundCallbackMessage.md -docs/InboundCallbackTypeEnum.md -docs/InitiateCallback.md -docs/LatestMessageDeliveryStatusEnum.md -docs/LineTypeEnum.md -docs/Link.md -docs/LinkSchema.md -docs/LinksObject.md -docs/ListMessageDirectionEnum.md -docs/ListMessageItem.md -docs/LookupErrorResponse.md -docs/LookupErrorSchema.md -docs/LookupErrorSchemaMeta.md -docs/LookupResult.md -docs/MFAApi.md -docs/MachineDetectionCompleteCallback.md -docs/MachineDetectionConfiguration.md -docs/MachineDetectionModeEnum.md -docs/MachineDetectionResult.md -docs/Media.md -docs/MediaApi.md -docs/Message.md -docs/MessageDirectionEnum.md -docs/MessageRequest.md -docs/MessageStatusEnum.md -docs/MessageTypeEnum.md -docs/MessagesApi.md -docs/MessagesList.md -docs/MessagingCodeResponse.md -docs/MessagingRequestError.md -docs/MfaForbiddenRequestError.md -docs/MfaRequestError.md -docs/MfaUnauthorizedRequestError.md -docs/MmsMessageContent.md -docs/MmsMessageContentFile.md -docs/MultiChannelAction.md -docs/MultiChannelActionCalendarEvent.md -docs/MultiChannelApi.md -docs/MultiChannelChannelListMMSObject.md -docs/MultiChannelChannelListMMSResponseObject.md -docs/MultiChannelChannelListObjectBase.md -docs/MultiChannelChannelListOwnerObject.md -docs/MultiChannelChannelListRBMObject.md -docs/MultiChannelChannelListRBMObjectAllOfContent.md -docs/MultiChannelChannelListRBMResponseObject.md -docs/MultiChannelChannelListRequestObject.md -docs/MultiChannelChannelListResponseObject.md -docs/MultiChannelChannelListSMSObject.md -docs/MultiChannelChannelListSMSResponseObject.md -docs/MultiChannelError.md -docs/MultiChannelMessageChannelEnum.md -docs/MultiChannelMessageContent.md -docs/MultiChannelMessageRequest.md -docs/MultiChannelMessageResponseData.md -docs/OptInWorkflow.md -docs/PageInfo.md -docs/PhoneNumberLookupApi.md -docs/PriorityEnum.md -docs/ProductTypeEnum.md -docs/RbmActionBase.md -docs/RbmActionDial.md -docs/RbmActionOpenUrl.md -docs/RbmActionTypeEnum.md -docs/RbmActionViewLocation.md -docs/RbmCardContent.md -docs/RbmCardContentMedia.md -docs/RbmLocationResponse.md -docs/RbmMediaHeightEnum.md -docs/RbmMessageCarouselCard.md -docs/RbmMessageContentFile.md -docs/RbmMessageContentRichCard.md -docs/RbmMessageContentText.md -docs/RbmMessageMedia.md -docs/RbmOpenUrlEnum.md -docs/RbmStandaloneCard.md -docs/RbmSuggestionResponse.md -docs/RbmWebViewEnum.md -docs/RecordingAvailableCallback.md -docs/RecordingCompleteCallback.md -docs/RecordingStateEnum.md -docs/RecordingTranscriptionMetadata.md -docs/RecordingTranscriptions.md -docs/RecordingsApi.md -docs/RedirectCallback.md -docs/RedirectMethodEnum.md -docs/SmsMessageContent.md -docs/StandaloneCardOrientationEnum.md -docs/StatisticsApi.md -docs/StatusCallback.md -docs/StatusCallbackMessage.md -docs/StatusCallbackTypeEnum.md -docs/StirShaken.md -docs/SyncLookupRequest.md -docs/TelephoneNumber.md -docs/TfvBasicAuthentication.md -docs/TfvCallbackStatusEnum.md -docs/TfvError.md -docs/TfvStatus.md -docs/TfvStatusEnum.md -docs/TfvSubmissionInfo.md -docs/TfvSubmissionWrapper.md -docs/ThumbnailAlignmentEnum.md -docs/TollFreeVerificationApi.md -docs/TranscribeRecording.md -docs/Transcription.md -docs/TranscriptionAvailableCallback.md -docs/TranscriptionsApi.md -docs/TransferAnswerCallback.md -docs/TransferCompleteCallback.md -docs/TransferDisconnectCallback.md -docs/UpdateCall.md -docs/UpdateCallRecording.md -docs/UpdateConference.md -docs/UpdateConferenceMember.md -docs/VerificationDenialWebhook.md -docs/VerificationRequest.md -docs/VerificationUpdateRequest.md -docs/VerificationWebhook.md -docs/VerifyCodeRequest.md -docs/VerifyCodeResponse.md -docs/VoiceApiError.md -docs/VoiceCodeResponse.md -docs/WebhookSubscription.md -docs/WebhookSubscriptionBasicAuthentication.md -docs/WebhookSubscriptionRequestSchema.md -docs/WebhookSubscriptionTypeEnum.md -docs/WebhookSubscriptionsListBody.md -git_push.sh -src/Bandwidth.Standard/Api/CallsApi.cs -src/Bandwidth.Standard/Api/ConferencesApi.cs -src/Bandwidth.Standard/Api/MFAApi.cs -src/Bandwidth.Standard/Api/MediaApi.cs -src/Bandwidth.Standard/Api/MessagesApi.cs -src/Bandwidth.Standard/Api/MultiChannelApi.cs -src/Bandwidth.Standard/Api/PhoneNumberLookupApi.cs -src/Bandwidth.Standard/Api/RecordingsApi.cs -src/Bandwidth.Standard/Api/StatisticsApi.cs -src/Bandwidth.Standard/Api/TollFreeVerificationApi.cs -src/Bandwidth.Standard/Api/TranscriptionsApi.cs -src/Bandwidth.Standard/Client/ApiClient.cs +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Bandwidth.Standard/Api/EndpointsApi.cs +src/Bandwidth.Standard/Api/IApi.cs src/Bandwidth.Standard/Client/ApiException.cs -src/Bandwidth.Standard/Client/ApiResponse.cs -src/Bandwidth.Standard/Client/Auth/OAuthAuthenticator.cs -src/Bandwidth.Standard/Client/Auth/OAuthFlow.cs -src/Bandwidth.Standard/Client/Auth/TokenResponse.cs +src/Bandwidth.Standard/Client/ApiFactory.cs +src/Bandwidth.Standard/Client/ApiResponseEventArgs.cs +src/Bandwidth.Standard/Client/ApiResponse`1.cs +src/Bandwidth.Standard/Client/BasicToken.cs src/Bandwidth.Standard/Client/ClientUtils.cs -src/Bandwidth.Standard/Client/Configuration.cs -src/Bandwidth.Standard/Client/ExceptionFactory.cs -src/Bandwidth.Standard/Client/GlobalConfiguration.cs -src/Bandwidth.Standard/Client/HttpMethod.cs -src/Bandwidth.Standard/Client/IApiAccessor.cs -src/Bandwidth.Standard/Client/IAsynchronousClient.cs -src/Bandwidth.Standard/Client/IReadableConfiguration.cs -src/Bandwidth.Standard/Client/ISynchronousClient.cs -src/Bandwidth.Standard/Client/Multimap.cs -src/Bandwidth.Standard/Client/OpenAPIDateConverter.cs -src/Bandwidth.Standard/Client/RequestOptions.cs -src/Bandwidth.Standard/Client/RetryConfiguration.cs -src/Bandwidth.Standard/Model/AbstractOpenAPISchema.cs -src/Bandwidth.Standard/Model/AccountStatistics.cs -src/Bandwidth.Standard/Model/AdditionalDenialReason.cs -src/Bandwidth.Standard/Model/Address.cs -src/Bandwidth.Standard/Model/AnswerCallback.cs -src/Bandwidth.Standard/Model/AsyncLookupRequest.cs -src/Bandwidth.Standard/Model/BlockedWebhook.cs -src/Bandwidth.Standard/Model/BridgeCompleteCallback.cs -src/Bandwidth.Standard/Model/BridgeTargetCompleteCallback.cs -src/Bandwidth.Standard/Model/BusinessEntityTypeEnum.cs -src/Bandwidth.Standard/Model/BusinessRegistrationTypeEnum.cs -src/Bandwidth.Standard/Model/CallDirectionEnum.cs -src/Bandwidth.Standard/Model/CallRecordingMetadata.cs -src/Bandwidth.Standard/Model/CallState.cs -src/Bandwidth.Standard/Model/CallStateEnum.cs -src/Bandwidth.Standard/Model/CallTranscription.cs -src/Bandwidth.Standard/Model/CallTranscriptionDetectedLanguageEnum.cs -src/Bandwidth.Standard/Model/CallTranscriptionMetadata.cs -src/Bandwidth.Standard/Model/CallTranscriptionResponse.cs -src/Bandwidth.Standard/Model/CallTranscriptionTrackEnum.cs -src/Bandwidth.Standard/Model/Callback.cs -src/Bandwidth.Standard/Model/CallbackMethodEnum.cs -src/Bandwidth.Standard/Model/CardWidthEnum.cs -src/Bandwidth.Standard/Model/CodeRequest.cs -src/Bandwidth.Standard/Model/CompletedLookupStatusEnum.cs -src/Bandwidth.Standard/Model/Conference.cs -src/Bandwidth.Standard/Model/ConferenceCompletedCallback.cs -src/Bandwidth.Standard/Model/ConferenceCreatedCallback.cs -src/Bandwidth.Standard/Model/ConferenceMember.cs -src/Bandwidth.Standard/Model/ConferenceMemberExitCallback.cs -src/Bandwidth.Standard/Model/ConferenceMemberJoinCallback.cs -src/Bandwidth.Standard/Model/ConferenceRecordingAvailableCallback.cs -src/Bandwidth.Standard/Model/ConferenceRecordingMetadata.cs -src/Bandwidth.Standard/Model/ConferenceRedirectCallback.cs -src/Bandwidth.Standard/Model/ConferenceStateEnum.cs -src/Bandwidth.Standard/Model/Contact.cs -src/Bandwidth.Standard/Model/CreateAsyncBulkLookupResponse.cs -src/Bandwidth.Standard/Model/CreateAsyncBulkLookupResponseData.cs -src/Bandwidth.Standard/Model/CreateCall.cs -src/Bandwidth.Standard/Model/CreateCallResponse.cs -src/Bandwidth.Standard/Model/CreateMessageRequestError.cs -src/Bandwidth.Standard/Model/CreateMultiChannelMessageResponse.cs -src/Bandwidth.Standard/Model/CreateSyncLookupResponse.cs -src/Bandwidth.Standard/Model/CreateSyncLookupResponseData.cs -src/Bandwidth.Standard/Model/DeactivationEventEnum.cs -src/Bandwidth.Standard/Model/DisconnectCallback.cs -src/Bandwidth.Standard/Model/Diversion.cs -src/Bandwidth.Standard/Model/DtmfCallback.cs +src/Bandwidth.Standard/Client/CookieContainer.cs +src/Bandwidth.Standard/Client/DateTimeJsonConverter.cs +src/Bandwidth.Standard/Client/DateTimeNullableJsonConverter.cs +src/Bandwidth.Standard/Client/ExceptionEventArgs.cs +src/Bandwidth.Standard/Client/HostConfiguration.cs +src/Bandwidth.Standard/Client/JsonSerializerOptionsProvider.cs +src/Bandwidth.Standard/Client/OAuthToken.cs +src/Bandwidth.Standard/Client/Option.cs +src/Bandwidth.Standard/Client/RateLimitProvider`1.cs +src/Bandwidth.Standard/Client/TokenBase.cs +src/Bandwidth.Standard/Client/TokenContainer`1.cs +src/Bandwidth.Standard/Client/TokenProvider`1.cs +src/Bandwidth.Standard/Extensions/IHostBuilderExtensions.cs +src/Bandwidth.Standard/Extensions/IHttpClientBuilderExtensions.cs +src/Bandwidth.Standard/Extensions/IServiceCollectionExtensions.cs +src/Bandwidth.Standard/Model/Endpoint.cs +src/Bandwidth.Standard/Model/EndpointDirectionEnum.cs +src/Bandwidth.Standard/Model/EndpointEvent.cs +src/Bandwidth.Standard/Model/EndpointEventTypeEnum.cs +src/Bandwidth.Standard/Model/EndpointResponse.cs +src/Bandwidth.Standard/Model/EndpointStatusEnum.cs +src/Bandwidth.Standard/Model/EndpointTypeEnum.cs +src/Bandwidth.Standard/Model/Endpoints.cs src/Bandwidth.Standard/Model/Error.cs src/Bandwidth.Standard/Model/ErrorObject.cs +src/Bandwidth.Standard/Model/ErrorResponse.cs src/Bandwidth.Standard/Model/ErrorSource.cs -src/Bandwidth.Standard/Model/FailureWebhook.cs -src/Bandwidth.Standard/Model/FieldError.cs -src/Bandwidth.Standard/Model/FileFormatEnum.cs -src/Bandwidth.Standard/Model/GatherCallback.cs -src/Bandwidth.Standard/Model/GetAsyncBulkLookupResponse.cs -src/Bandwidth.Standard/Model/GetAsyncBulkLookupResponseData.cs -src/Bandwidth.Standard/Model/InProgressLookupStatusEnum.cs -src/Bandwidth.Standard/Model/InboundCallback.cs -src/Bandwidth.Standard/Model/InboundCallbackMessage.cs -src/Bandwidth.Standard/Model/InboundCallbackTypeEnum.cs -src/Bandwidth.Standard/Model/InitiateCallback.cs -src/Bandwidth.Standard/Model/LatestMessageDeliveryStatusEnum.cs -src/Bandwidth.Standard/Model/LineTypeEnum.cs -src/Bandwidth.Standard/Model/Link.cs -src/Bandwidth.Standard/Model/LinkSchema.cs -src/Bandwidth.Standard/Model/LinksObject.cs -src/Bandwidth.Standard/Model/ListMessageDirectionEnum.cs -src/Bandwidth.Standard/Model/ListMessageItem.cs -src/Bandwidth.Standard/Model/LookupErrorResponse.cs -src/Bandwidth.Standard/Model/LookupErrorSchema.cs -src/Bandwidth.Standard/Model/LookupErrorSchemaMeta.cs -src/Bandwidth.Standard/Model/LookupResult.cs -src/Bandwidth.Standard/Model/MachineDetectionCompleteCallback.cs -src/Bandwidth.Standard/Model/MachineDetectionConfiguration.cs -src/Bandwidth.Standard/Model/MachineDetectionModeEnum.cs -src/Bandwidth.Standard/Model/MachineDetectionResult.cs -src/Bandwidth.Standard/Model/Media.cs -src/Bandwidth.Standard/Model/Message.cs -src/Bandwidth.Standard/Model/MessageDirectionEnum.cs -src/Bandwidth.Standard/Model/MessageRequest.cs -src/Bandwidth.Standard/Model/MessageStatusEnum.cs -src/Bandwidth.Standard/Model/MessageTypeEnum.cs -src/Bandwidth.Standard/Model/MessagesList.cs -src/Bandwidth.Standard/Model/MessagingCodeResponse.cs -src/Bandwidth.Standard/Model/MessagingRequestError.cs -src/Bandwidth.Standard/Model/MfaForbiddenRequestError.cs -src/Bandwidth.Standard/Model/MfaRequestError.cs -src/Bandwidth.Standard/Model/MfaUnauthorizedRequestError.cs -src/Bandwidth.Standard/Model/MmsMessageContent.cs -src/Bandwidth.Standard/Model/MmsMessageContentFile.cs -src/Bandwidth.Standard/Model/MultiChannelAction.cs -src/Bandwidth.Standard/Model/MultiChannelActionCalendarEvent.cs -src/Bandwidth.Standard/Model/MultiChannelChannelListMMSObject.cs -src/Bandwidth.Standard/Model/MultiChannelChannelListMMSResponseObject.cs -src/Bandwidth.Standard/Model/MultiChannelChannelListObjectBase.cs -src/Bandwidth.Standard/Model/MultiChannelChannelListOwnerObject.cs -src/Bandwidth.Standard/Model/MultiChannelChannelListRBMObject.cs -src/Bandwidth.Standard/Model/MultiChannelChannelListRBMObjectAllOfContent.cs -src/Bandwidth.Standard/Model/MultiChannelChannelListRBMResponseObject.cs -src/Bandwidth.Standard/Model/MultiChannelChannelListRequestObject.cs -src/Bandwidth.Standard/Model/MultiChannelChannelListResponseObject.cs -src/Bandwidth.Standard/Model/MultiChannelChannelListSMSObject.cs -src/Bandwidth.Standard/Model/MultiChannelChannelListSMSResponseObject.cs -src/Bandwidth.Standard/Model/MultiChannelError.cs -src/Bandwidth.Standard/Model/MultiChannelMessageChannelEnum.cs -src/Bandwidth.Standard/Model/MultiChannelMessageContent.cs -src/Bandwidth.Standard/Model/MultiChannelMessageRequest.cs -src/Bandwidth.Standard/Model/MultiChannelMessageResponseData.cs -src/Bandwidth.Standard/Model/OptInWorkflow.cs +src/Bandwidth.Standard/Model/Page.cs src/Bandwidth.Standard/Model/PageInfo.cs src/Bandwidth.Standard/Model/PriorityEnum.cs src/Bandwidth.Standard/Model/ProductTypeEnum.cs -src/Bandwidth.Standard/Model/RbmActionBase.cs -src/Bandwidth.Standard/Model/RbmActionDial.cs -src/Bandwidth.Standard/Model/RbmActionOpenUrl.cs -src/Bandwidth.Standard/Model/RbmActionTypeEnum.cs -src/Bandwidth.Standard/Model/RbmActionViewLocation.cs -src/Bandwidth.Standard/Model/RbmCardContent.cs -src/Bandwidth.Standard/Model/RbmCardContentMedia.cs -src/Bandwidth.Standard/Model/RbmLocationResponse.cs -src/Bandwidth.Standard/Model/RbmMediaHeightEnum.cs -src/Bandwidth.Standard/Model/RbmMessageCarouselCard.cs -src/Bandwidth.Standard/Model/RbmMessageContentFile.cs -src/Bandwidth.Standard/Model/RbmMessageContentRichCard.cs -src/Bandwidth.Standard/Model/RbmMessageContentText.cs -src/Bandwidth.Standard/Model/RbmMessageMedia.cs -src/Bandwidth.Standard/Model/RbmOpenUrlEnum.cs -src/Bandwidth.Standard/Model/RbmStandaloneCard.cs -src/Bandwidth.Standard/Model/RbmSuggestionResponse.cs -src/Bandwidth.Standard/Model/RbmWebViewEnum.cs -src/Bandwidth.Standard/Model/RecordingAvailableCallback.cs -src/Bandwidth.Standard/Model/RecordingCompleteCallback.cs -src/Bandwidth.Standard/Model/RecordingStateEnum.cs -src/Bandwidth.Standard/Model/RecordingTranscriptionMetadata.cs -src/Bandwidth.Standard/Model/RecordingTranscriptions.cs -src/Bandwidth.Standard/Model/RedirectCallback.cs -src/Bandwidth.Standard/Model/RedirectMethodEnum.cs +src/Bandwidth.Standard/Model/SipConnectionMetadata.cs +src/Bandwidth.Standard/Model/SipCredentials.cs src/Bandwidth.Standard/Model/SmsMessageContent.cs src/Bandwidth.Standard/Model/StandaloneCardOrientationEnum.cs src/Bandwidth.Standard/Model/StatusCallback.cs @@ -365,35 +52,4 @@ src/Bandwidth.Standard/Model/StatusCallbackMessage.cs src/Bandwidth.Standard/Model/StatusCallbackTypeEnum.cs src/Bandwidth.Standard/Model/StirShaken.cs src/Bandwidth.Standard/Model/SyncLookupRequest.cs -src/Bandwidth.Standard/Model/TelephoneNumber.cs -src/Bandwidth.Standard/Model/TfvBasicAuthentication.cs -src/Bandwidth.Standard/Model/TfvCallbackStatusEnum.cs -src/Bandwidth.Standard/Model/TfvError.cs -src/Bandwidth.Standard/Model/TfvStatus.cs -src/Bandwidth.Standard/Model/TfvStatusEnum.cs -src/Bandwidth.Standard/Model/TfvSubmissionInfo.cs -src/Bandwidth.Standard/Model/TfvSubmissionWrapper.cs -src/Bandwidth.Standard/Model/ThumbnailAlignmentEnum.cs -src/Bandwidth.Standard/Model/TranscribeRecording.cs -src/Bandwidth.Standard/Model/Transcription.cs -src/Bandwidth.Standard/Model/TranscriptionAvailableCallback.cs -src/Bandwidth.Standard/Model/TransferAnswerCallback.cs -src/Bandwidth.Standard/Model/TransferCompleteCallback.cs -src/Bandwidth.Standard/Model/TransferDisconnectCallback.cs -src/Bandwidth.Standard/Model/UpdateCall.cs -src/Bandwidth.Standard/Model/UpdateCallRecording.cs -src/Bandwidth.Standard/Model/UpdateConference.cs -src/Bandwidth.Standard/Model/UpdateConferenceMember.cs -src/Bandwidth.Standard/Model/VerificationDenialWebhook.cs -src/Bandwidth.Standard/Model/VerificationRequest.cs -src/Bandwidth.Standard/Model/VerificationUpdateRequest.cs -src/Bandwidth.Standard/Model/VerificationWebhook.cs -src/Bandwidth.Standard/Model/VerifyCodeRequest.cs -src/Bandwidth.Standard/Model/VerifyCodeResponse.cs -src/Bandwidth.Standard/Model/VoiceApiError.cs -src/Bandwidth.Standard/Model/VoiceCodeResponse.cs -src/Bandwidth.Standard/Model/WebhookSubscription.cs -src/Bandwidth.Standard/Model/WebhookSubscriptionBasicAuthentication.cs -src/Bandwidth.Standard/Model/WebhookSubscriptionRequestSchema.cs -src/Bandwidth.Standard/Model/WebhookSubscriptionTypeEnum.cs -src/Bandwidth.Standard/Model/WebhookSubscriptionsListBody.cs +src/Bandwidth.Standard/README.md diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 1985849f..6328c542 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0 +7.17.0 diff --git a/Bandwidth.Standard.sln b/Bandwidth.Standard.sln index 45670746..bc5b9c21 100644 --- a/Bandwidth.Standard.sln +++ b/Bandwidth.Standard.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.Standard", "src\Bandwidth.Standard\Bandwidth.Standard.csproj", "{1B496B75-0E81-41BC-86C2-73D16188960A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.Standard", "src\Bandwidth.Standard\Bandwidth.Standard.csproj", "{D91CCDA0-F131-43F2-A229-AF5A3D89E2F3}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bandwidth.Standard.Test", "src\Bandwidth.Standard.Test\Bandwidth.Standard.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1B496B75-0E81-41BC-86C2-73D16188960A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1B496B75-0E81-41BC-86C2-73D16188960A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1B496B75-0E81-41BC-86C2-73D16188960A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1B496B75-0E81-41BC-86C2-73D16188960A}.Release|Any CPU.Build.0 = Release|Any CPU + {D91CCDA0-F131-43F2-A229-AF5A3D89E2F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D91CCDA0-F131-43F2-A229-AF5A3D89E2F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D91CCDA0-F131-43F2-A229-AF5A3D89E2F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D91CCDA0-F131-43F2-A229-AF5A3D89E2F3}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/README.md b/README.md index 63e41ead..99ada24e 100644 --- a/README.md +++ b/README.md @@ -1,366 +1,2 @@ -# Bandwidth.Standard - the C# library for the Bandwidth - -Bandwidth's Communication APIs - -This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: 1.0.0 -- SDK version: 1.0.0 -- Generator version: 7.7.0 -- Build package: org.openapitools.codegen.languages.CSharpClientCodegen - For more information, please visit [https://dev.bandwidth.com](https://dev.bandwidth.com) - - -## Frameworks supported -- .NET Core >=1.0 -- .NET Framework >=4.6 -- Mono/Xamarin >=vNext - - -## Dependencies - -- [RestSharp](https://www.nuget.org/packages/RestSharp) - 112.0.0 or later -- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 13.0.2 or later -- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later -- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later - -The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: -``` -Install-Package RestSharp -Install-Package Newtonsoft.Json -Install-Package JsonSubTypes -Install-Package System.ComponentModel.Annotations -``` - -NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742). -NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See [RestSharp#1406](https://github.com/restsharp/RestSharp/issues/1406). - - -## Installation -Generate the DLL using your preferred tool (e.g. `dotnet build`) - -Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: -```csharp -using Bandwidth.Standard.Api; -using Bandwidth.Standard.Client; -using Bandwidth.Standard.Model; -``` - -## Usage - -To use the API client with a HTTP proxy, setup a `System.Net.WebProxy` -```csharp -Configuration c = new Configuration(); -System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/"); -webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; -c.Proxy = webProxy; -``` - - -## Getting Started - -```csharp -using System.Collections.Generic; -using System.Diagnostics; -using Bandwidth.Standard.Api; -using Bandwidth.Standard.Client; -using Bandwidth.Standard.Model; - -namespace Example -{ - public class Example - { - public static void Main() - { - - Configuration config = new Configuration(); - config.BasePath = "http://localhost"; - // Configure HTTP basic authorization: Basic - config.Username = "YOUR_USERNAME"; - config.Password = "YOUR_PASSWORD"; - // Configure OAuth2 access token for authorization: OAuth2 - config.AccessToken = "YOUR_ACCESS_TOKEN"; - // Or use clientId/clientSecret for OAuth2 authorization - config.OAuthClientId = "YOUR_CLIENT_ID"; - config.OAuthClientSecret = "YOUR_CLIENT_SECRET"; - - var apiInstance = new CallsApi(config); - var accountId = 9900000; // string | Your Bandwidth Account ID. - var createCall = new CreateCall(); // CreateCall | JSON object containing information to create an outbound call - - try - { - // Create Call - CreateCallResponse result = apiInstance.CreateCall(accountId, createCall); - Debug.WriteLine(result); - } - catch (ApiException e) - { - Debug.Print("Exception when calling CallsApi.CreateCall: " + e.Message ); - Debug.Print("Status Code: "+ e.ErrorCode); - Debug.Print(e.StackTrace); - } - - } - } -} -``` - - -## Documentation for API Endpoints - -All URIs are relative to *http://localhost* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*CallsApi* | [**CreateCall**](docs/CallsApi.md#createcall) | **POST** /accounts/{accountId}/calls | Create Call -*CallsApi* | [**GetCallState**](docs/CallsApi.md#getcallstate) | **GET** /accounts/{accountId}/calls/{callId} | Get Call State Information -*CallsApi* | [**ListCalls**](docs/CallsApi.md#listcalls) | **GET** /accounts/{accountId}/calls | Get Calls -*CallsApi* | [**UpdateCall**](docs/CallsApi.md#updatecall) | **POST** /accounts/{accountId}/calls/{callId} | Update Call -*CallsApi* | [**UpdateCallBxml**](docs/CallsApi.md#updatecallbxml) | **PUT** /accounts/{accountId}/calls/{callId}/bxml | Update Call BXML -*ConferencesApi* | [**DownloadConferenceRecording**](docs/ConferencesApi.md#downloadconferencerecording) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media | Download Conference Recording -*ConferencesApi* | [**GetConference**](docs/ConferencesApi.md#getconference) | **GET** /accounts/{accountId}/conferences/{conferenceId} | Get Conference Information -*ConferencesApi* | [**GetConferenceMember**](docs/ConferencesApi.md#getconferencemember) | **GET** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Get Conference Member -*ConferencesApi* | [**GetConferenceRecording**](docs/ConferencesApi.md#getconferencerecording) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId} | Get Conference Recording Information -*ConferencesApi* | [**ListConferenceRecordings**](docs/ConferencesApi.md#listconferencerecordings) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings | Get Conference Recordings -*ConferencesApi* | [**ListConferences**](docs/ConferencesApi.md#listconferences) | **GET** /accounts/{accountId}/conferences | Get Conferences -*ConferencesApi* | [**UpdateConference**](docs/ConferencesApi.md#updateconference) | **POST** /accounts/{accountId}/conferences/{conferenceId} | Update Conference -*ConferencesApi* | [**UpdateConferenceBxml**](docs/ConferencesApi.md#updateconferencebxml) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/bxml | Update Conference BXML -*ConferencesApi* | [**UpdateConferenceMember**](docs/ConferencesApi.md#updateconferencemember) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Update Conference Member -*MFAApi* | [**GenerateMessagingCode**](docs/MFAApi.md#generatemessagingcode) | **POST** /accounts/{accountId}/code/messaging | Messaging Authentication Code -*MFAApi* | [**GenerateVoiceCode**](docs/MFAApi.md#generatevoicecode) | **POST** /accounts/{accountId}/code/voice | Voice Authentication Code -*MFAApi* | [**VerifyCode**](docs/MFAApi.md#verifycode) | **POST** /accounts/{accountId}/code/verify | Verify Authentication Code -*MediaApi* | [**DeleteMedia**](docs/MediaApi.md#deletemedia) | **DELETE** /users/{accountId}/media/{mediaId} | Delete Media -*MediaApi* | [**GetMedia**](docs/MediaApi.md#getmedia) | **GET** /users/{accountId}/media/{mediaId} | Get Media -*MediaApi* | [**ListMedia**](docs/MediaApi.md#listmedia) | **GET** /users/{accountId}/media | List Media -*MediaApi* | [**UploadMedia**](docs/MediaApi.md#uploadmedia) | **PUT** /users/{accountId}/media/{mediaId} | Upload Media -*MessagesApi* | [**CreateMessage**](docs/MessagesApi.md#createmessage) | **POST** /users/{accountId}/messages | Create Message -*MessagesApi* | [**ListMessages**](docs/MessagesApi.md#listmessages) | **GET** /users/{accountId}/messages | List Messages -*MultiChannelApi* | [**CreateMultiChannelMessage**](docs/MultiChannelApi.md#createmultichannelmessage) | **POST** /users/{accountId}/messages/multiChannel | Create Multi-Channel Message -*PhoneNumberLookupApi* | [**CreateAsyncBulkLookup**](docs/PhoneNumberLookupApi.md#createasyncbulklookup) | **POST** /accounts/{accountId}/phoneNumberLookup/bulk | Create Asynchronous Bulk Number Lookup -*PhoneNumberLookupApi* | [**CreateSyncLookup**](docs/PhoneNumberLookupApi.md#createsynclookup) | **POST** /accounts/{accountId}/phoneNumberLookup | Create Synchronous Number Lookup -*PhoneNumberLookupApi* | [**GetAsyncBulkLookup**](docs/PhoneNumberLookupApi.md#getasyncbulklookup) | **GET** /accounts/{accountId}/phoneNumberLookup/bulk/{requestId} | Get Asynchronous Bulk Number Lookup -*RecordingsApi* | [**DeleteRecording**](docs/RecordingsApi.md#deleterecording) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Delete Recording -*RecordingsApi* | [**DeleteRecordingMedia**](docs/RecordingsApi.md#deleterecordingmedia) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Delete Recording Media -*RecordingsApi* | [**DeleteRecordingTranscription**](docs/RecordingsApi.md#deleterecordingtranscription) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Delete Transcription -*RecordingsApi* | [**DownloadCallRecording**](docs/RecordingsApi.md#downloadcallrecording) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Download Recording -*RecordingsApi* | [**GetCallRecording**](docs/RecordingsApi.md#getcallrecording) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Get Call Recording -*RecordingsApi* | [**GetRecordingTranscription**](docs/RecordingsApi.md#getrecordingtranscription) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Get Transcription -*RecordingsApi* | [**ListAccountCallRecordings**](docs/RecordingsApi.md#listaccountcallrecordings) | **GET** /accounts/{accountId}/recordings | Get Call Recordings -*RecordingsApi* | [**ListCallRecordings**](docs/RecordingsApi.md#listcallrecordings) | **GET** /accounts/{accountId}/calls/{callId}/recordings | List Call Recordings -*RecordingsApi* | [**TranscribeCallRecording**](docs/RecordingsApi.md#transcribecallrecording) | **POST** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Create Transcription Request -*RecordingsApi* | [**UpdateCallRecordingState**](docs/RecordingsApi.md#updatecallrecordingstate) | **PUT** /accounts/{accountId}/calls/{callId}/recording | Update Recording -*StatisticsApi* | [**GetStatistics**](docs/StatisticsApi.md#getstatistics) | **GET** /accounts/{accountId}/statistics | Get Account Statistics -*TollFreeVerificationApi* | [**CreateWebhookSubscription**](docs/TollFreeVerificationApi.md#createwebhooksubscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription -*TollFreeVerificationApi* | [**DeleteVerificationRequest**](docs/TollFreeVerificationApi.md#deleteverificationrequest) | **DELETE** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Delete a Toll-Free Verification Submission -*TollFreeVerificationApi* | [**DeleteWebhookSubscription**](docs/TollFreeVerificationApi.md#deletewebhooksubscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription -*TollFreeVerificationApi* | [**GetTollFreeVerificationStatus**](docs/TollFreeVerificationApi.md#gettollfreeverificationstatus) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status -*TollFreeVerificationApi* | [**ListTollFreeUseCases**](docs/TollFreeVerificationApi.md#listtollfreeusecases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases -*TollFreeVerificationApi* | [**ListWebhookSubscriptions**](docs/TollFreeVerificationApi.md#listwebhooksubscriptions) | **GET** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | List Webhook Subscriptions -*TollFreeVerificationApi* | [**RequestTollFreeVerification**](docs/TollFreeVerificationApi.md#requesttollfreeverification) | **POST** /accounts/{accountId}/tollFreeVerification | Request Toll-Free Verification -*TollFreeVerificationApi* | [**UpdateTollFreeVerificationRequest**](docs/TollFreeVerificationApi.md#updatetollfreeverificationrequest) | **PUT** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Update Toll-Free Verification Request -*TollFreeVerificationApi* | [**UpdateWebhookSubscription**](docs/TollFreeVerificationApi.md#updatewebhooksubscription) | **PUT** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Update Webhook Subscription -*TranscriptionsApi* | [**DeleteRealTimeTranscription**](docs/TranscriptionsApi.md#deleterealtimetranscription) | **DELETE** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Delete Real-time Transcription -*TranscriptionsApi* | [**GetRealTimeTranscription**](docs/TranscriptionsApi.md#getrealtimetranscription) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Get Real-time Transcription -*TranscriptionsApi* | [**ListRealTimeTranscriptions**](docs/TranscriptionsApi.md#listrealtimetranscriptions) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions | List Real-time Transcriptions - - - -## Documentation for Models - - - [Model.AccountStatistics](docs/AccountStatistics.md) - - [Model.AdditionalDenialReason](docs/AdditionalDenialReason.md) - - [Model.Address](docs/Address.md) - - [Model.AnswerCallback](docs/AnswerCallback.md) - - [Model.AsyncLookupRequest](docs/AsyncLookupRequest.md) - - [Model.BlockedWebhook](docs/BlockedWebhook.md) - - [Model.BridgeCompleteCallback](docs/BridgeCompleteCallback.md) - - [Model.BridgeTargetCompleteCallback](docs/BridgeTargetCompleteCallback.md) - - [Model.BusinessEntityTypeEnum](docs/BusinessEntityTypeEnum.md) - - [Model.BusinessRegistrationTypeEnum](docs/BusinessRegistrationTypeEnum.md) - - [Model.CallDirectionEnum](docs/CallDirectionEnum.md) - - [Model.CallRecordingMetadata](docs/CallRecordingMetadata.md) - - [Model.CallState](docs/CallState.md) - - [Model.CallStateEnum](docs/CallStateEnum.md) - - [Model.CallTranscription](docs/CallTranscription.md) - - [Model.CallTranscriptionDetectedLanguageEnum](docs/CallTranscriptionDetectedLanguageEnum.md) - - [Model.CallTranscriptionMetadata](docs/CallTranscriptionMetadata.md) - - [Model.CallTranscriptionResponse](docs/CallTranscriptionResponse.md) - - [Model.CallTranscriptionTrackEnum](docs/CallTranscriptionTrackEnum.md) - - [Model.Callback](docs/Callback.md) - - [Model.CallbackMethodEnum](docs/CallbackMethodEnum.md) - - [Model.CardWidthEnum](docs/CardWidthEnum.md) - - [Model.CodeRequest](docs/CodeRequest.md) - - [Model.CompletedLookupStatusEnum](docs/CompletedLookupStatusEnum.md) - - [Model.Conference](docs/Conference.md) - - [Model.ConferenceCompletedCallback](docs/ConferenceCompletedCallback.md) - - [Model.ConferenceCreatedCallback](docs/ConferenceCreatedCallback.md) - - [Model.ConferenceMember](docs/ConferenceMember.md) - - [Model.ConferenceMemberExitCallback](docs/ConferenceMemberExitCallback.md) - - [Model.ConferenceMemberJoinCallback](docs/ConferenceMemberJoinCallback.md) - - [Model.ConferenceRecordingAvailableCallback](docs/ConferenceRecordingAvailableCallback.md) - - [Model.ConferenceRecordingMetadata](docs/ConferenceRecordingMetadata.md) - - [Model.ConferenceRedirectCallback](docs/ConferenceRedirectCallback.md) - - [Model.ConferenceStateEnum](docs/ConferenceStateEnum.md) - - [Model.Contact](docs/Contact.md) - - [Model.CreateAsyncBulkLookupResponse](docs/CreateAsyncBulkLookupResponse.md) - - [Model.CreateAsyncBulkLookupResponseData](docs/CreateAsyncBulkLookupResponseData.md) - - [Model.CreateCall](docs/CreateCall.md) - - [Model.CreateCallResponse](docs/CreateCallResponse.md) - - [Model.CreateMessageRequestError](docs/CreateMessageRequestError.md) - - [Model.CreateMultiChannelMessageResponse](docs/CreateMultiChannelMessageResponse.md) - - [Model.CreateSyncLookupResponse](docs/CreateSyncLookupResponse.md) - - [Model.CreateSyncLookupResponseData](docs/CreateSyncLookupResponseData.md) - - [Model.DeactivationEventEnum](docs/DeactivationEventEnum.md) - - [Model.DisconnectCallback](docs/DisconnectCallback.md) - - [Model.Diversion](docs/Diversion.md) - - [Model.DtmfCallback](docs/DtmfCallback.md) - - [Model.Error](docs/Error.md) - - [Model.ErrorObject](docs/ErrorObject.md) - - [Model.ErrorSource](docs/ErrorSource.md) - - [Model.FailureWebhook](docs/FailureWebhook.md) - - [Model.FieldError](docs/FieldError.md) - - [Model.FileFormatEnum](docs/FileFormatEnum.md) - - [Model.GatherCallback](docs/GatherCallback.md) - - [Model.GetAsyncBulkLookupResponse](docs/GetAsyncBulkLookupResponse.md) - - [Model.GetAsyncBulkLookupResponseData](docs/GetAsyncBulkLookupResponseData.md) - - [Model.InProgressLookupStatusEnum](docs/InProgressLookupStatusEnum.md) - - [Model.InboundCallback](docs/InboundCallback.md) - - [Model.InboundCallbackMessage](docs/InboundCallbackMessage.md) - - [Model.InboundCallbackTypeEnum](docs/InboundCallbackTypeEnum.md) - - [Model.InitiateCallback](docs/InitiateCallback.md) - - [Model.LatestMessageDeliveryStatusEnum](docs/LatestMessageDeliveryStatusEnum.md) - - [Model.LineTypeEnum](docs/LineTypeEnum.md) - - [Model.Link](docs/Link.md) - - [Model.LinkSchema](docs/LinkSchema.md) - - [Model.LinksObject](docs/LinksObject.md) - - [Model.ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) - - [Model.ListMessageItem](docs/ListMessageItem.md) - - [Model.LookupErrorResponse](docs/LookupErrorResponse.md) - - [Model.LookupErrorSchema](docs/LookupErrorSchema.md) - - [Model.LookupErrorSchemaMeta](docs/LookupErrorSchemaMeta.md) - - [Model.LookupResult](docs/LookupResult.md) - - [Model.MachineDetectionCompleteCallback](docs/MachineDetectionCompleteCallback.md) - - [Model.MachineDetectionConfiguration](docs/MachineDetectionConfiguration.md) - - [Model.MachineDetectionModeEnum](docs/MachineDetectionModeEnum.md) - - [Model.MachineDetectionResult](docs/MachineDetectionResult.md) - - [Model.Media](docs/Media.md) - - [Model.Message](docs/Message.md) - - [Model.MessageDirectionEnum](docs/MessageDirectionEnum.md) - - [Model.MessageRequest](docs/MessageRequest.md) - - [Model.MessageStatusEnum](docs/MessageStatusEnum.md) - - [Model.MessageTypeEnum](docs/MessageTypeEnum.md) - - [Model.MessagesList](docs/MessagesList.md) - - [Model.MessagingCodeResponse](docs/MessagingCodeResponse.md) - - [Model.MessagingRequestError](docs/MessagingRequestError.md) - - [Model.MfaForbiddenRequestError](docs/MfaForbiddenRequestError.md) - - [Model.MfaRequestError](docs/MfaRequestError.md) - - [Model.MfaUnauthorizedRequestError](docs/MfaUnauthorizedRequestError.md) - - [Model.MmsMessageContent](docs/MmsMessageContent.md) - - [Model.MmsMessageContentFile](docs/MmsMessageContentFile.md) - - [Model.MultiChannelAction](docs/MultiChannelAction.md) - - [Model.MultiChannelActionCalendarEvent](docs/MultiChannelActionCalendarEvent.md) - - [Model.MultiChannelChannelListMMSObject](docs/MultiChannelChannelListMMSObject.md) - - [Model.MultiChannelChannelListMMSResponseObject](docs/MultiChannelChannelListMMSResponseObject.md) - - [Model.MultiChannelChannelListObjectBase](docs/MultiChannelChannelListObjectBase.md) - - [Model.MultiChannelChannelListOwnerObject](docs/MultiChannelChannelListOwnerObject.md) - - [Model.MultiChannelChannelListRBMObject](docs/MultiChannelChannelListRBMObject.md) - - [Model.MultiChannelChannelListRBMObjectAllOfContent](docs/MultiChannelChannelListRBMObjectAllOfContent.md) - - [Model.MultiChannelChannelListRBMResponseObject](docs/MultiChannelChannelListRBMResponseObject.md) - - [Model.MultiChannelChannelListRequestObject](docs/MultiChannelChannelListRequestObject.md) - - [Model.MultiChannelChannelListResponseObject](docs/MultiChannelChannelListResponseObject.md) - - [Model.MultiChannelChannelListSMSObject](docs/MultiChannelChannelListSMSObject.md) - - [Model.MultiChannelChannelListSMSResponseObject](docs/MultiChannelChannelListSMSResponseObject.md) - - [Model.MultiChannelError](docs/MultiChannelError.md) - - [Model.MultiChannelMessageChannelEnum](docs/MultiChannelMessageChannelEnum.md) - - [Model.MultiChannelMessageContent](docs/MultiChannelMessageContent.md) - - [Model.MultiChannelMessageRequest](docs/MultiChannelMessageRequest.md) - - [Model.MultiChannelMessageResponseData](docs/MultiChannelMessageResponseData.md) - - [Model.OptInWorkflow](docs/OptInWorkflow.md) - - [Model.PageInfo](docs/PageInfo.md) - - [Model.PriorityEnum](docs/PriorityEnum.md) - - [Model.ProductTypeEnum](docs/ProductTypeEnum.md) - - [Model.RbmActionBase](docs/RbmActionBase.md) - - [Model.RbmActionDial](docs/RbmActionDial.md) - - [Model.RbmActionOpenUrl](docs/RbmActionOpenUrl.md) - - [Model.RbmActionTypeEnum](docs/RbmActionTypeEnum.md) - - [Model.RbmActionViewLocation](docs/RbmActionViewLocation.md) - - [Model.RbmCardContent](docs/RbmCardContent.md) - - [Model.RbmCardContentMedia](docs/RbmCardContentMedia.md) - - [Model.RbmLocationResponse](docs/RbmLocationResponse.md) - - [Model.RbmMediaHeightEnum](docs/RbmMediaHeightEnum.md) - - [Model.RbmMessageCarouselCard](docs/RbmMessageCarouselCard.md) - - [Model.RbmMessageContentFile](docs/RbmMessageContentFile.md) - - [Model.RbmMessageContentRichCard](docs/RbmMessageContentRichCard.md) - - [Model.RbmMessageContentText](docs/RbmMessageContentText.md) - - [Model.RbmMessageMedia](docs/RbmMessageMedia.md) - - [Model.RbmOpenUrlEnum](docs/RbmOpenUrlEnum.md) - - [Model.RbmStandaloneCard](docs/RbmStandaloneCard.md) - - [Model.RbmSuggestionResponse](docs/RbmSuggestionResponse.md) - - [Model.RbmWebViewEnum](docs/RbmWebViewEnum.md) - - [Model.RecordingAvailableCallback](docs/RecordingAvailableCallback.md) - - [Model.RecordingCompleteCallback](docs/RecordingCompleteCallback.md) - - [Model.RecordingStateEnum](docs/RecordingStateEnum.md) - - [Model.RecordingTranscriptionMetadata](docs/RecordingTranscriptionMetadata.md) - - [Model.RecordingTranscriptions](docs/RecordingTranscriptions.md) - - [Model.RedirectCallback](docs/RedirectCallback.md) - - [Model.RedirectMethodEnum](docs/RedirectMethodEnum.md) - - [Model.SmsMessageContent](docs/SmsMessageContent.md) - - [Model.StandaloneCardOrientationEnum](docs/StandaloneCardOrientationEnum.md) - - [Model.StatusCallback](docs/StatusCallback.md) - - [Model.StatusCallbackMessage](docs/StatusCallbackMessage.md) - - [Model.StatusCallbackTypeEnum](docs/StatusCallbackTypeEnum.md) - - [Model.StirShaken](docs/StirShaken.md) - - [Model.SyncLookupRequest](docs/SyncLookupRequest.md) - - [Model.TelephoneNumber](docs/TelephoneNumber.md) - - [Model.TfvBasicAuthentication](docs/TfvBasicAuthentication.md) - - [Model.TfvCallbackStatusEnum](docs/TfvCallbackStatusEnum.md) - - [Model.TfvError](docs/TfvError.md) - - [Model.TfvStatus](docs/TfvStatus.md) - - [Model.TfvStatusEnum](docs/TfvStatusEnum.md) - - [Model.TfvSubmissionInfo](docs/TfvSubmissionInfo.md) - - [Model.TfvSubmissionWrapper](docs/TfvSubmissionWrapper.md) - - [Model.ThumbnailAlignmentEnum](docs/ThumbnailAlignmentEnum.md) - - [Model.TranscribeRecording](docs/TranscribeRecording.md) - - [Model.Transcription](docs/Transcription.md) - - [Model.TranscriptionAvailableCallback](docs/TranscriptionAvailableCallback.md) - - [Model.TransferAnswerCallback](docs/TransferAnswerCallback.md) - - [Model.TransferCompleteCallback](docs/TransferCompleteCallback.md) - - [Model.TransferDisconnectCallback](docs/TransferDisconnectCallback.md) - - [Model.UpdateCall](docs/UpdateCall.md) - - [Model.UpdateCallRecording](docs/UpdateCallRecording.md) - - [Model.UpdateConference](docs/UpdateConference.md) - - [Model.UpdateConferenceMember](docs/UpdateConferenceMember.md) - - [Model.VerificationDenialWebhook](docs/VerificationDenialWebhook.md) - - [Model.VerificationRequest](docs/VerificationRequest.md) - - [Model.VerificationUpdateRequest](docs/VerificationUpdateRequest.md) - - [Model.VerificationWebhook](docs/VerificationWebhook.md) - - [Model.VerifyCodeRequest](docs/VerifyCodeRequest.md) - - [Model.VerifyCodeResponse](docs/VerifyCodeResponse.md) - - [Model.VoiceApiError](docs/VoiceApiError.md) - - [Model.VoiceCodeResponse](docs/VoiceCodeResponse.md) - - [Model.WebhookSubscription](docs/WebhookSubscription.md) - - [Model.WebhookSubscriptionBasicAuthentication](docs/WebhookSubscriptionBasicAuthentication.md) - - [Model.WebhookSubscriptionRequestSchema](docs/WebhookSubscriptionRequestSchema.md) - - [Model.WebhookSubscriptionTypeEnum](docs/WebhookSubscriptionTypeEnum.md) - - [Model.WebhookSubscriptionsListBody](docs/WebhookSubscriptionsListBody.md) - - - -## Documentation for Authorization - - -Authentication schemes defined for the API: - -### Basic - -- **Type**: HTTP basic authentication - - -### OAuth2 - -- **Type**: OAuth -- **Flow**: application -- **Authorization URL**: https://api.bandwidth.com/api/v1/oauth2/token -- **Scopes**: N/A - +# Created with Openapi Generator +See the project's [REAMDE](src/Bandwidth.Standard/README.md) \ No newline at end of file diff --git a/api/openapi.yaml b/api/openapi.yaml index 9cd4e5ce..1e36dacc 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -24,6 +24,7 @@ tags: - name: MFA - name: Phone Number Lookup - name: Toll-Free Verification +- name: Endpoints paths: /users/{accountId}/media: get: @@ -54,7 +55,7 @@ paths: application/json: schema: items: - $ref: '#/components/schemas/media' + $ref: "#/components/schemas/media" type: array description: OK headers: @@ -68,49 +69,49 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Bad Request "401": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unauthorized "403": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Forbidden "404": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Found "406": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Acceptable "415": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unsupported Media Type "429": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Too Many Requests "500": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Internal Server Error summary: List Media tags: @@ -153,49 +154,49 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Bad Request "401": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unauthorized "403": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Forbidden "404": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Found "406": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Acceptable "415": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unsupported Media Type "429": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Too Many Requests "500": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Internal Server Error summary: Delete Media tags: @@ -235,49 +236,49 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Bad Request "401": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unauthorized "403": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Forbidden "404": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Found "406": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Acceptable "415": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unsupported Media Type "429": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Too Many Requests "500": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Internal Server Error summary: Get Media tags: @@ -329,7 +330,7 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/uploadMediaRequest' + $ref: "#/components/requestBodies/uploadMediaRequest" responses: "204": description: No Content @@ -337,49 +338,49 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Bad Request "401": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unauthorized "403": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Forbidden "404": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Found "406": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Acceptable "415": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unsupported Media Type "429": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Too Many Requests "500": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Internal Server Error summary: Upload Media tags: @@ -445,7 +446,7 @@ paths: name: messageStatus required: false schema: - $ref: '#/components/schemas/messageStatusEnum' + $ref: "#/components/schemas/messageStatusEnum" style: form - description: The direction of the message. One of INBOUND OUTBOUND. explode: true @@ -453,7 +454,7 @@ paths: name: messageDirection required: false schema: - $ref: '#/components/schemas/listMessageDirectionEnum' + $ref: "#/components/schemas/listMessageDirectionEnum" style: form - description: The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need @@ -472,7 +473,7 @@ paths: name: messageType required: false schema: - $ref: '#/components/schemas/messageTypeEnum' + $ref: "#/components/schemas/messageTypeEnum" style: form - description: The error code of the message. example: 9902 @@ -539,7 +540,7 @@ paths: name: product required: false schema: - $ref: '#/components/schemas/productTypeEnum' + $ref: "#/components/schemas/productTypeEnum" style: form - description: Location Id associated with the message. example: 123ABC @@ -673,49 +674,49 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/messagesList' + $ref: "#/components/schemas/messagesList" description: OK "400": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Bad Request "401": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unauthorized "403": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Forbidden "404": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Found "415": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unsupported Media Type "429": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Too Many Requests "500": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Internal Server Error summary: List Messages tags: @@ -723,7 +724,7 @@ paths: post: callbacks: statusCallback: - $ref: '#/components/callbacks/statusCallback' + $ref: "#/components/callbacks/statusCallback" description: Endpoint for sending text messages and picture messages using V2 messaging. operationId: createMessage @@ -738,67 +739,67 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/createMessageRequest' + $ref: "#/components/requestBodies/createMessageRequest" responses: "202": content: application/json: schema: - $ref: '#/components/schemas/message' + $ref: "#/components/schemas/message" description: Accepted "400": content: application/json: schema: - $ref: '#/components/schemas/createMessageRequestError' + $ref: "#/components/schemas/createMessageRequestError" description: Bad Request "401": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unauthorized "403": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Forbidden "404": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Found "405": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Method Not Allowed "406": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Acceptable "415": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unsupported Media Type "429": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Too Many Requests "500": content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Internal Server Error summary: Create Message tags: @@ -810,7 +811,7 @@ paths: post: callbacks: statusCallback: - $ref: '#/components/callbacks/statusCallback' + $ref: "#/components/callbacks/statusCallback" description: Endpoint for sending Multi-Channel messages. operationId: createMultiChannelMessage parameters: @@ -824,13 +825,13 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/createMultiChannelMessageRequest' + $ref: "#/components/requestBodies/createMultiChannelMessageRequest" responses: "202": content: application/json: schema: - $ref: '#/components/schemas/createMultiChannelMessageResponse' + $ref: "#/components/schemas/createMultiChannelMessageResponse" description: Accepted "400": content: @@ -845,7 +846,7 @@ paths: source: field: "channelList[0].from" schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Bad Request "401": content: @@ -858,7 +859,7 @@ paths: description: Authentication Failed source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Unauthorized "403": content: @@ -871,7 +872,7 @@ paths: description: Access Denied source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Forbidden "404": content: @@ -884,7 +885,7 @@ paths: description: Resource not found. source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Not Found "405": content: @@ -897,7 +898,7 @@ paths: description: Method 'PUT' not supported for this resource. source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Method Not Allowed "406": description: Not Acceptable @@ -914,7 +915,7 @@ paths: source: header: Content-Type schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Unsupported Media Type "429": content: @@ -928,7 +929,7 @@ paths: Please retry later. source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Too Many Requests "500": content: @@ -941,14 +942,14 @@ paths: description: Internal server error. No further information available source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Internal Server Error summary: Create Multi-Channel Message tags: - Multi-Channel x-badges: - name: Beta - color: '#076EA8' + color: "#076EA8" servers: - description: Production url: https://messaging.bandwidth.com/api/v2 @@ -1047,7 +1048,7 @@ paths: application/json: schema: items: - $ref: '#/components/schemas/callState' + $ref: "#/components/schemas/callState" type: array description: OK "400": @@ -1055,63 +1056,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -1125,9 +1126,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Calls tags: @@ -1151,16 +1152,16 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/createCallRequest' + $ref: "#/components/requestBodies/createCallRequest" responses: "201": content: application/json: examples: createCall Response: - $ref: '#/components/examples/createCallResponseExample' + $ref: "#/components/examples/createCallResponseExample" schema: - $ref: '#/components/schemas/createCallResponse' + $ref: "#/components/schemas/createCallResponse" description: Created headers: Location: @@ -1174,63 +1175,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -1244,9 +1245,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Create Call tags: @@ -1285,70 +1286,70 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/callState' + $ref: "#/components/schemas/callState" description: OK "400": content: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -1362,9 +1363,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Call State Information tags: @@ -1393,7 +1394,7 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/updateCallRequest' + $ref: "#/components/requestBodies/updateCallRequest" responses: "200": description: OK @@ -1402,72 +1403,72 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "409": content: application/json: examples: conflictErrorExample: - $ref: '#/components/examples/voiceConflictErrorExample' + $ref: "#/components/examples/voiceConflictErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Conflict "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -1481,9 +1482,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Update Call tags: @@ -1515,7 +1516,7 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/updateCallBxmlRequest' + $ref: "#/components/requestBodies/updateCallBxmlRequest" responses: "204": description: Call BXML was successfully replaced. @@ -1524,72 +1525,72 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "409": content: application/json: examples: conflictErrorExample: - $ref: '#/components/examples/voiceConflictErrorExample' + $ref: "#/components/examples/voiceConflictErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Conflict "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -1603,9 +1604,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Update Call BXML tags: @@ -1689,10 +1690,10 @@ paths: application/json: examples: listConferences Response: - $ref: '#/components/examples/listConferencesResponseExample' + $ref: "#/components/examples/listConferencesResponseExample" schema: items: - $ref: '#/components/schemas/conference' + $ref: "#/components/schemas/conference" type: array description: OK "400": @@ -1700,63 +1701,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -1770,9 +1771,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Conferences tags: @@ -1808,70 +1809,70 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/conference' + $ref: "#/components/schemas/conference" description: OK "400": content: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -1885,9 +1886,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Conference Information tags: @@ -1915,7 +1916,7 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/updateConferenceRequest' + $ref: "#/components/requestBodies/updateConferenceRequest" responses: "204": description: Conference was successfully modified. @@ -1924,63 +1925,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -1994,9 +1995,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Update Conference tags: @@ -2028,7 +2029,7 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/updateConferenceBxmlRequest' + $ref: "#/components/requestBodies/updateConferenceBxmlRequest" responses: "204": description: Conference successfully modified. @@ -2037,63 +2038,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -2107,9 +2108,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Update Conference BXML tags: @@ -2154,70 +2155,70 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/conferenceMember' + $ref: "#/components/schemas/conferenceMember" description: OK "400": content: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -2231,9 +2232,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Conference Member tags: @@ -2270,7 +2271,7 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/updateConferenceMemberRequest' + $ref: "#/components/requestBodies/updateConferenceMemberRequest" responses: "204": description: Conference member was successfully modified. @@ -2279,63 +2280,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -2349,9 +2350,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Update Conference Member tags: @@ -2389,7 +2390,7 @@ paths: application/json: schema: items: - $ref: '#/components/schemas/conferenceRecordingMetadata' + $ref: "#/components/schemas/conferenceRecordingMetadata" type: array description: OK "400": @@ -2397,63 +2398,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -2467,9 +2468,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Conference Recordings tags: @@ -2514,70 +2515,70 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/conferenceRecordingMetadata' + $ref: "#/components/schemas/conferenceRecordingMetadata" description: OK "400": content: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -2591,9 +2592,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Conference Recording Information tags: @@ -2650,63 +2651,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -2720,9 +2721,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Download Conference Recording tags: @@ -2792,7 +2793,7 @@ paths: application/json: schema: items: - $ref: '#/components/schemas/callRecordingMetadata' + $ref: "#/components/schemas/callRecordingMetadata" type: array description: OK "400": @@ -2800,63 +2801,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -2870,9 +2871,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Call Recordings tags: @@ -2904,7 +2905,7 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/updateCallRecordingRequest' + $ref: "#/components/requestBodies/updateCallRecordingRequest" responses: "200": description: OK @@ -2913,63 +2914,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -2983,9 +2984,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Update Recording tags: @@ -3024,7 +3025,7 @@ paths: application/json: schema: items: - $ref: '#/components/schemas/callRecordingMetadata' + $ref: "#/components/schemas/callRecordingMetadata" type: array description: OK "400": @@ -3032,63 +3033,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -3102,9 +3103,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: List Call Recordings tags: @@ -3155,63 +3156,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -3225,9 +3226,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Delete Recording tags: @@ -3268,70 +3269,70 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/callRecordingMetadata' + $ref: "#/components/schemas/callRecordingMetadata" description: OK "400": content: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -3345,9 +3346,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Call Recording tags: @@ -3395,63 +3396,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -3465,9 +3466,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Delete Recording Media tags: @@ -3520,63 +3521,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -3590,9 +3591,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Download Recording tags: @@ -3643,63 +3644,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -3713,9 +3714,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Delete Transcription tags: @@ -3760,70 +3761,70 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/recordingTranscriptions' + $ref: "#/components/schemas/recordingTranscriptions" description: OK "400": content: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -3837,9 +3838,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Transcription tags: @@ -3879,7 +3880,7 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/transcribeRecordingRequest' + $ref: "#/components/requestBodies/transcribeRecordingRequest" responses: "204": description: Transcription was successfully requested. @@ -3888,63 +3889,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -3958,9 +3959,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Create Transcription Request tags: @@ -3987,70 +3988,70 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/accountStatistics' + $ref: "#/components/schemas/accountStatistics" description: OK "400": content: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -4064,9 +4065,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Account Statistics tags: @@ -4102,70 +4103,70 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/callTranscriptionMetadataList' + $ref: "#/components/schemas/callTranscriptionMetadataList" description: OK "400": content: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -4179,9 +4180,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: List Real-time Transcriptions tags: @@ -4232,63 +4233,63 @@ paths: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -4302,9 +4303,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Delete Real-time Transcription tags: @@ -4346,70 +4347,70 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/callTranscriptionResponse' + $ref: "#/components/schemas/callTranscriptionResponse" description: OK "400": content: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request "401": content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized "403": content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden "404": content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found "405": content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed "415": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type "429": content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -4423,9 +4424,9 @@ paths: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error summary: Get Real-time Transcription tags: @@ -4448,37 +4449,37 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/codeRequest' + $ref: "#/components/requestBodies/codeRequest" responses: "200": content: application/json: schema: - $ref: '#/components/schemas/voiceCodeResponse' + $ref: "#/components/schemas/voiceCodeResponse" description: OK "400": content: application/json: schema: - $ref: '#/components/schemas/mfaRequestError' + $ref: "#/components/schemas/mfaRequestError" description: Bad Request "401": content: application/json: schema: - $ref: '#/components/schemas/mfaUnauthorizedRequestError' + $ref: "#/components/schemas/mfaUnauthorizedRequestError" description: Unauthorized "403": content: application/json: schema: - $ref: '#/components/schemas/mfaForbiddenRequestError' + $ref: "#/components/schemas/mfaForbiddenRequestError" description: Forbidden "500": content: application/json: schema: - $ref: '#/components/schemas/mfaRequestError' + $ref: "#/components/schemas/mfaRequestError" description: Internal Server Error summary: Voice Authentication Code tags: @@ -4501,37 +4502,37 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/codeRequest' + $ref: "#/components/requestBodies/codeRequest" responses: "200": content: application/json: schema: - $ref: '#/components/schemas/messagingCodeResponse' + $ref: "#/components/schemas/messagingCodeResponse" description: OK "400": content: application/json: schema: - $ref: '#/components/schemas/mfaRequestError' + $ref: "#/components/schemas/mfaRequestError" description: Bad Request "401": content: application/json: schema: - $ref: '#/components/schemas/mfaUnauthorizedRequestError' + $ref: "#/components/schemas/mfaUnauthorizedRequestError" description: Unauthorized "403": content: application/json: schema: - $ref: '#/components/schemas/mfaForbiddenRequestError' + $ref: "#/components/schemas/mfaForbiddenRequestError" description: Forbidden "500": content: application/json: schema: - $ref: '#/components/schemas/mfaRequestError' + $ref: "#/components/schemas/mfaRequestError" description: Internal Server Error summary: Messaging Authentication Code tags: @@ -4554,43 +4555,43 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/codeVerify' + $ref: "#/components/requestBodies/codeVerify" responses: "200": content: application/json: schema: - $ref: '#/components/schemas/verifyCodeResponse' + $ref: "#/components/schemas/verifyCodeResponse" description: OK "400": content: application/json: schema: - $ref: '#/components/schemas/mfaRequestError' + $ref: "#/components/schemas/mfaRequestError" description: Bad Request "401": content: application/json: schema: - $ref: '#/components/schemas/mfaUnauthorizedRequestError' + $ref: "#/components/schemas/mfaUnauthorizedRequestError" description: Unauthorized "403": content: application/json: schema: - $ref: '#/components/schemas/mfaForbiddenRequestError' + $ref: "#/components/schemas/mfaForbiddenRequestError" description: Forbidden "429": content: application/json: schema: - $ref: '#/components/schemas/mfaRequestError' + $ref: "#/components/schemas/mfaRequestError" description: Too Many Requests "500": content: application/json: schema: - $ref: '#/components/schemas/mfaRequestError' + $ref: "#/components/schemas/mfaRequestError" description: Internal Server Error summary: Verify Authentication Code tags: @@ -4614,43 +4615,43 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/createSyncLookupRequest' + $ref: "#/components/requestBodies/createSyncLookupRequest" responses: "200": content: application/json: examples: lookupCompleteWithDniExample: - $ref: '#/components/examples/lookupCompleteWithDniExample' + $ref: "#/components/examples/lookupCompleteWithDniExample" lookupCompleteExample: - $ref: '#/components/examples/lookupCompleteExample' + $ref: "#/components/examples/lookupCompleteExample" lookupPartialExample: - $ref: '#/components/examples/lookupPartialExample' + $ref: "#/components/examples/lookupPartialExample" lookupFailedExample: - $ref: '#/components/examples/lookupFailedExample' + $ref: "#/components/examples/lookupFailedExample" schema: - $ref: '#/components/schemas/createSyncLookupResponse' + $ref: "#/components/schemas/createSyncLookupResponse" description: OK default: content: application/json: examples: badRequest: - $ref: '#/components/examples/badRequestExample' + $ref: "#/components/examples/badRequestExample" unauthorized: - $ref: '#/components/examples/unauthorizedExample' + $ref: "#/components/examples/unauthorizedExample" forbidden: - $ref: '#/components/examples/forbiddenExample' + $ref: "#/components/examples/forbiddenExample" mediaType: - $ref: '#/components/examples/unsupportedMediaTypeExample' + $ref: "#/components/examples/unsupportedMediaTypeExample" notFound: - $ref: '#/components/examples/notFoundExample' + $ref: "#/components/examples/notFoundExample" tooManyRequests: - $ref: '#/components/examples/tooManyRequestsExample' + $ref: "#/components/examples/tooManyRequestsExample" internalServer: - $ref: '#/components/examples/internalServerErrorExample' + $ref: "#/components/examples/internalServerErrorExample" schema: - $ref: '#/components/schemas/lookupErrorResponse' + $ref: "#/components/schemas/lookupErrorResponse" description: Bad Request summary: Create Synchronous Number Lookup tags: @@ -4676,37 +4677,37 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/createAsyncBulkLookupRequest' + $ref: "#/components/requestBodies/createAsyncBulkLookupRequest" responses: "202": content: application/json: examples: lookupInProgressExample: - $ref: '#/components/examples/lookupInProgressExample' + $ref: "#/components/examples/lookupInProgressExample" schema: - $ref: '#/components/schemas/createAsyncBulkLookupResponse' + $ref: "#/components/schemas/createAsyncBulkLookupResponse" description: Accepted default: content: application/json: examples: badRequest: - $ref: '#/components/examples/badRequestExample' + $ref: "#/components/examples/badRequestExample" unauthorized: - $ref: '#/components/examples/unauthorizedExample' + $ref: "#/components/examples/unauthorizedExample" forbidden: - $ref: '#/components/examples/forbiddenExample' + $ref: "#/components/examples/forbiddenExample" mediaType: - $ref: '#/components/examples/unsupportedMediaTypeExample' + $ref: "#/components/examples/unsupportedMediaTypeExample" notFound: - $ref: '#/components/examples/notFoundExample' + $ref: "#/components/examples/notFoundExample" tooManyRequests: - $ref: '#/components/examples/tooManyRequestsExample' + $ref: "#/components/examples/tooManyRequestsExample" internalServer: - $ref: '#/components/examples/internalServerErrorExample' + $ref: "#/components/examples/internalServerErrorExample" schema: - $ref: '#/components/schemas/lookupErrorResponse' + $ref: "#/components/schemas/lookupErrorResponse" description: Bad Request summary: Create Asynchronous Bulk Number Lookup tags: @@ -4745,38 +4746,38 @@ paths: application/json: examples: lookupCompleteWithDniExample: - $ref: '#/components/examples/lookupCompleteWithDniExample' + $ref: "#/components/examples/lookupCompleteWithDniExample" lookupCompleteExample: - $ref: '#/components/examples/lookupCompleteExample' + $ref: "#/components/examples/lookupCompleteExample" lookupInProgressExample: - $ref: '#/components/examples/lookupInProgressExample' + $ref: "#/components/examples/lookupInProgressExample" lookupPartialExample: - $ref: '#/components/examples/lookupPartialExample' + $ref: "#/components/examples/lookupPartialExample" lookupFailedExample: - $ref: '#/components/examples/lookupFailedExample' + $ref: "#/components/examples/lookupFailedExample" schema: - $ref: '#/components/schemas/getAsyncBulkLookupResponse' + $ref: "#/components/schemas/getAsyncBulkLookupResponse" description: OK default: content: application/json: examples: badRequest: - $ref: '#/components/examples/badRequestExample' + $ref: "#/components/examples/badRequestExample" unauthorized: - $ref: '#/components/examples/unauthorizedExample' + $ref: "#/components/examples/unauthorizedExample" forbidden: - $ref: '#/components/examples/forbiddenExample' + $ref: "#/components/examples/forbiddenExample" mediaType: - $ref: '#/components/examples/unsupportedMediaTypeExample' + $ref: "#/components/examples/unsupportedMediaTypeExample" notFound: - $ref: '#/components/examples/notFoundExample' + $ref: "#/components/examples/notFoundExample" tooManyRequests: - $ref: '#/components/examples/tooManyRequestsExample' + $ref: "#/components/examples/tooManyRequestsExample" internalServer: - $ref: '#/components/examples/internalServerErrorExample' + $ref: "#/components/examples/internalServerErrorExample" schema: - $ref: '#/components/schemas/lookupErrorResponse' + $ref: "#/components/schemas/lookupErrorResponse" description: Bad Request summary: Get Asynchronous Bulk Number Lookup tags: @@ -4788,7 +4789,7 @@ paths: post: callbacks: tfVerificationStatus: - $ref: '#/components/callbacks/tfVerificationStatus' + $ref: "#/components/callbacks/tfVerificationStatus" description: Submit a request for verification of a toll-free phone number. operationId: requestTollFreeVerification parameters: @@ -4802,7 +4803,7 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/requestTollFreeVerificationRequest' + $ref: "#/components/requestBodies/requestTollFreeVerificationRequest" responses: "202": description: Accepted @@ -4817,7 +4818,7 @@ paths: address. optInWorkflowImageURLs: Entries must be a valid array of objects. schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request "401": content: @@ -4826,7 +4827,7 @@ paths: description: Client is providing incorrect or invalid credentials. type: unauthorized schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Unauthorized "403": content: @@ -4835,7 +4836,7 @@ paths: description: Client is not authorized for the action. type: forbidden schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Forbidden "405": content: @@ -4844,7 +4845,7 @@ paths: description: Method is not allowed. type: Method Not Allowed schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Method Not Allowed "429": content: @@ -4853,7 +4854,7 @@ paths: description: Throttling error. Too many requests. type: Too Many Requests schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Too Many Requests "500": content: @@ -4862,7 +4863,7 @@ paths: description: Internal Server Error. type: Internal Server Error schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Internal Server Error "503": content: @@ -4871,7 +4872,7 @@ paths: description: Service Unavailable Error. type: Service Unavailable schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Service Unavailable summary: Request Toll-Free Verification tags: @@ -4900,7 +4901,7 @@ paths: name: phoneNumber required: true schema: - $ref: '#/components/schemas/tfPhoneNumber' + $ref: "#/components/schemas/tfPhoneNumber" style: simple responses: "204": @@ -4912,7 +4913,7 @@ paths: description: Cannot process request. type: bad request schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request "401": content: @@ -4921,7 +4922,7 @@ paths: description: Client is providing incorrect or invalid credentials. type: unauthorized schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Unauthorized "403": content: @@ -4930,7 +4931,7 @@ paths: description: Client is not authorized for the action. type: forbidden schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Forbidden "404": content: @@ -4939,7 +4940,7 @@ paths: description: Cannot find the requested resource. type: Not Found schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Cannot find the requested resource. "405": content: @@ -4948,7 +4949,7 @@ paths: description: Method is not allowed. type: Method Not Allowed schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Method Not Allowed "429": content: @@ -4957,7 +4958,7 @@ paths: description: Throttling error. Too many requests. type: Too Many Requests schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Too Many Requests "500": content: @@ -4966,7 +4967,7 @@ paths: description: Internal Server Error. type: Internal Server Error schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Internal Server Error "503": content: @@ -4975,7 +4976,7 @@ paths: description: Service Unavailable Error. type: Service Unavailable schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Service Unavailable summary: Delete a Toll-Free Verification Submission tags: @@ -5002,14 +5003,14 @@ paths: name: phoneNumber required: true schema: - $ref: '#/components/schemas/tfPhoneNumber' + $ref: "#/components/schemas/tfPhoneNumber" style: simple responses: "200": content: application/json: schema: - $ref: '#/components/schemas/tfvStatus' + $ref: "#/components/schemas/tfvStatus" description: OK "400": content: @@ -5018,7 +5019,7 @@ paths: description: Cannot process request. type: bad request schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request "401": content: @@ -5027,7 +5028,7 @@ paths: description: Client is providing incorrect or invalid credentials. type: unauthorized schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Unauthorized "403": content: @@ -5036,7 +5037,7 @@ paths: description: Client is not authorized for the action. type: forbidden schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Forbidden "404": content: @@ -5045,7 +5046,7 @@ paths: description: Cannot find the requested resource. type: Not Found schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Cannot find the requested resource. "405": content: @@ -5054,7 +5055,7 @@ paths: description: Method is not allowed. type: Method Not Allowed schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Method Not Allowed "429": content: @@ -5063,7 +5064,7 @@ paths: description: Throttling error. Too many requests. type: Too Many Requests schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Too Many Requests "500": content: @@ -5072,7 +5073,7 @@ paths: description: Internal Server Error. type: Internal Server Error schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Internal Server Error "503": content: @@ -5081,7 +5082,7 @@ paths: description: Service Unavailable Error. type: Service Unavailable schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Service Unavailable summary: Get Toll-Free Verification Status tags: @@ -5089,7 +5090,7 @@ paths: put: callbacks: tfVerificationStatus: - $ref: '#/components/callbacks/tfVerificationStatus' + $ref: "#/components/callbacks/tfVerificationStatus" 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). @@ -5111,10 +5112,10 @@ paths: name: phoneNumber required: true schema: - $ref: '#/components/schemas/tfPhoneNumber' + $ref: "#/components/schemas/tfPhoneNumber" style: simple requestBody: - $ref: '#/components/requestBodies/updateTollFreeVerificationRequestRequest' + $ref: "#/components/requestBodies/updateTollFreeVerificationRequestRequest" responses: "202": description: Accepted @@ -5129,7 +5130,7 @@ paths: address. optInWorkflowImageURLs: Entries must be a valid array of objects. schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request "401": content: @@ -5138,7 +5139,7 @@ paths: description: Client is providing incorrect or invalid credentials. type: unauthorized schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Unauthorized "403": content: @@ -5147,7 +5148,7 @@ paths: description: Client is not authorized for the action. type: forbidden schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Forbidden "405": content: @@ -5156,7 +5157,7 @@ paths: description: Method is not allowed. type: Method Not Allowed schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Method Not Allowed "429": content: @@ -5165,7 +5166,7 @@ paths: description: Throttling error. Too many requests. type: Too Many Requests schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Too Many Requests "500": content: @@ -5174,7 +5175,7 @@ paths: description: Internal Server Error. type: Internal Server Error schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Internal Server Error "503": content: @@ -5183,7 +5184,7 @@ paths: description: Service Unavailable Error. type: Service Unavailable schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Service Unavailable summary: Update Toll-Free Verification Request tags: @@ -5212,7 +5213,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/webhookSubscriptionsListBody' + $ref: "#/components/schemas/webhookSubscriptionsListBody" description: OK "400": content: @@ -5225,7 +5226,7 @@ paths: address. optInWorkflowImageURLs: Entries must be a valid array of objects. schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request "401": content: @@ -5234,7 +5235,7 @@ paths: description: Client is providing incorrect or invalid credentials. type: unauthorized schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Unauthorized "403": content: @@ -5243,7 +5244,7 @@ paths: description: Client is not authorized for the action. type: forbidden schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Forbidden "405": content: @@ -5252,7 +5253,7 @@ paths: description: Method is not allowed. type: Method Not Allowed schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Method Not Allowed "429": content: @@ -5261,7 +5262,7 @@ paths: description: Throttling error. Too many requests. type: Too Many Requests schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Too Many Requests "500": content: @@ -5270,7 +5271,7 @@ paths: description: Internal Server Error. type: Internal Server Error schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Internal Server Error "503": content: @@ -5279,7 +5280,7 @@ paths: description: Service Unavailable Error. type: Service Unavailable schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Service Unavailable summary: List Webhook Subscriptions tags: @@ -5301,13 +5302,13 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/webhookSubscriptionRequest' + $ref: "#/components/requestBodies/webhookSubscriptionRequest" responses: "201": content: application/json: schema: - $ref: '#/components/schemas/webhookSubscription' + $ref: "#/components/schemas/webhookSubscription" description: Created "400": content: @@ -5316,7 +5317,7 @@ paths: description: Cannot process request. type: bad request schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request "401": content: @@ -5325,7 +5326,7 @@ paths: description: Client is providing incorrect or invalid credentials. type: unauthorized schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Unauthorized "403": content: @@ -5334,7 +5335,7 @@ paths: description: Client is not authorized for the action. type: forbidden schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Forbidden "404": content: @@ -5343,7 +5344,7 @@ paths: description: Cannot find the requested resource. type: Not Found schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Cannot find the requested resource. "405": content: @@ -5352,7 +5353,7 @@ paths: description: Method is not allowed. type: Method Not Allowed schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Method Not Allowed "429": content: @@ -5361,7 +5362,7 @@ paths: description: Throttling error. Too many requests. type: Too Many Requests schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Too Many Requests "500": content: @@ -5370,7 +5371,7 @@ paths: description: Internal Server Error. type: Internal Server Error schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Internal Server Error "503": content: @@ -5379,7 +5380,7 @@ paths: description: Service Unavailable Error. type: Service Unavailable schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Service Unavailable summary: Create Webhook Subscription tags: @@ -5420,7 +5421,7 @@ paths: description: Cannot process request. type: bad request schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request "401": content: @@ -5429,7 +5430,7 @@ paths: description: Client is providing incorrect or invalid credentials. type: unauthorized schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Unauthorized "403": content: @@ -5438,7 +5439,7 @@ paths: description: Client is not authorized for the action. type: forbidden schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Forbidden "404": content: @@ -5447,7 +5448,7 @@ paths: description: Cannot find the requested resource. type: Not Found schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Cannot find the requested resource. "405": content: @@ -5456,7 +5457,7 @@ paths: description: Method is not allowed. type: Method Not Allowed schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Method Not Allowed "429": content: @@ -5465,7 +5466,7 @@ paths: description: Throttling error. Too many requests. type: Too Many Requests schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Too Many Requests "500": content: @@ -5474,7 +5475,7 @@ paths: description: Internal Server Error. type: Internal Server Error schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Internal Server Error "503": content: @@ -5483,7 +5484,7 @@ paths: description: Service Unavailable Error. type: Service Unavailable schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Service Unavailable summary: Delete Webhook Subscription tags: @@ -5512,13 +5513,13 @@ paths: type: string style: simple requestBody: - $ref: '#/components/requestBodies/webhookSubscriptionRequest' + $ref: "#/components/requestBodies/webhookSubscriptionRequest" responses: "200": content: application/json: schema: - $ref: '#/components/schemas/webhookSubscription' + $ref: "#/components/schemas/webhookSubscription" description: OK "400": content: @@ -5527,7 +5528,7 @@ paths: description: Cannot process request. type: bad request schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request "401": content: @@ -5536,7 +5537,7 @@ paths: description: Client is providing incorrect or invalid credentials. type: unauthorized schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Unauthorized "403": content: @@ -5545,7 +5546,7 @@ paths: description: Client is not authorized for the action. type: forbidden schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Forbidden "404": content: @@ -5554,7 +5555,7 @@ paths: description: Cannot find the requested resource. type: Not Found schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Cannot find the requested resource. "405": content: @@ -5563,7 +5564,7 @@ paths: description: Method is not allowed. type: Method Not Allowed schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Method Not Allowed "429": content: @@ -5572,7 +5573,7 @@ paths: description: Throttling error. Too many requests. type: Too Many Requests schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Too Many Requests "500": content: @@ -5581,7 +5582,7 @@ paths: description: Internal Server Error. type: Internal Server Error schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Internal Server Error "503": content: @@ -5590,7 +5591,7 @@ paths: description: Service Unavailable Error. type: Service Unavailable schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Service Unavailable summary: Update Webhook Subscription tags: @@ -5607,7 +5608,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/useCases' + $ref: "#/components/schemas/useCases" description: OK "400": content: @@ -5616,7 +5617,7 @@ paths: description: Cannot process request. type: bad request schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request "401": content: @@ -5625,7 +5626,7 @@ paths: description: Client is providing incorrect or invalid credentials. type: unauthorized schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Unauthorized "403": content: @@ -5634,7 +5635,7 @@ paths: description: Client is not authorized for the action. type: forbidden schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Forbidden "404": content: @@ -5643,7 +5644,7 @@ paths: description: Cannot find the requested resource. type: Not Found schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Cannot find the requested resource. "405": content: @@ -5652,7 +5653,7 @@ paths: description: Method is not allowed. type: Method Not Allowed schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Method Not Allowed "429": content: @@ -5661,7 +5662,7 @@ paths: description: Throttling error. Too many requests. type: Too Many Requests schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Too Many Requests "500": content: @@ -5670,7 +5671,7 @@ paths: description: Internal Server Error. type: Internal Server Error schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Internal Server Error "503": content: @@ -5679,7 +5680,7 @@ paths: description: Service Unavailable Error. type: Service Unavailable schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Service Unavailable summary: List Toll-Free Use Cases tags: @@ -5687,6 +5688,567 @@ paths: servers: - description: Production url: https://api.bandwidth.com/api/v2 + /accounts/{accountId}/endpoints: + get: + description: Returns a list of endpoints associated with the specified account. + operationId: listEndpoints + parameters: + - description: Your Bandwidth Account ID. + explode: false + in: path + name: accountId + required: true + schema: + example: "5500123" + type: string + style: simple + - description: The type of endpoint. + explode: true + in: query + name: type + required: false + schema: + $ref: "#/components/schemas/endpointTypeEnum" + style: form + - description: The status of the endpoint. + explode: true + in: query + name: status + required: false + schema: + $ref: "#/components/schemas/endpointStatusEnum" + style: form + - description: The cursor to use for pagination. This is the value of the `next` + link in the previous response. + explode: true + in: query + name: afterCursor + required: false + schema: + example: TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ== + type: string + style: form + - description: The maximum number of endpoints to return in the response. + explode: true + in: query + name: limit + required: false + schema: + default: 100 + example: 2 + maximum: 1000 + minimum: 1 + type: integer + style: form + responses: + "200": + content: + application/json: + examples: + listEndpointsResponseExample: + $ref: "#/components/examples/listEndpointsResponseExample" + schema: + $ref: "#/components/schemas/listEndpointsResponse" + description: OK + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Not Found + "405": + content: + application/json: + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Method Not Allowed + "415": + content: + application/json: + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + "500": + content: + application/json: + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Service Unavailable + summary: List Endpoints + tags: + - Endpoints + post: + callbacks: + endpointEventCallback: + $ref: "#/components/callbacks/endpointEvent" + description: Creates a new Endpoint for the specified account. + operationId: createEndpoint + parameters: + - description: Your Bandwidth Account ID. + explode: false + in: path + name: accountId + required: true + schema: + example: "5500123" + type: string + style: simple + requestBody: + $ref: "#/components/requestBodies/createEndpointRequest" + responses: + "201": + content: + application/json: + examples: + createEndpointResponseExample: + $ref: "#/components/examples/createEndpointResponseExample" + schema: + $ref: "#/components/schemas/createEndpointResponse" + description: Created + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Not Found + "405": + content: + application/json: + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Method Not Allowed + "415": + content: + application/json: + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + "500": + content: + application/json: + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Service Unavailable + summary: Create Endpoint + tags: + - Endpoints + servers: + - description: Production + url: https://api.bandwidth.com/v2 + /accounts/{accountId}/endpoints/{endpointId}: + delete: + description: "Deletes the specified endpoint. If the endpoint is actively streaming\ + \ media, the media stream will be terminated." + operationId: deleteEndpoint + parameters: + - description: Your Bandwidth Account ID. + explode: false + in: path + name: accountId + required: true + schema: + example: "5500123" + type: string + style: simple + - description: BRTC Endpoint ID. + explode: false + in: path + name: endpointId + required: true + schema: + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + style: simple + responses: + "204": + description: No Content + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Not Found + "405": + content: + application/json: + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Method Not Allowed + "415": + content: + application/json: + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + "500": + content: + application/json: + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Service Unavailable + summary: Delete Endpoint + tags: + - Endpoints + get: + description: Returns information about the specified endpoint. + operationId: getEndpoint + parameters: + - description: Your Bandwidth Account ID. + explode: false + in: path + name: accountId + required: true + schema: + example: "5500123" + type: string + style: simple + - description: BRTC Endpoint ID. + explode: false + in: path + name: endpointId + required: true + schema: + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + style: simple + responses: + "200": + content: + application/json: + examples: + getEndpointResponseExample: + $ref: "#/components/examples/getEndpointResponseExample" + schema: + $ref: "#/components/schemas/endpointResponse" + description: OK + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Not Found + "405": + content: + application/json: + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Method Not Allowed + "415": + content: + application/json: + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + "500": + content: + application/json: + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Service Unavailable + summary: Get Endpoint + tags: + - Endpoints + servers: + - description: Production + url: https://api.bandwidth.com/v2 + /accounts/{accountId}/endpoints/{endpointId}/bxml: + put: + description: Updates the BXML for the specified endpoint. + operationId: updateEndpointBxml + parameters: + - description: Your Bandwidth Account ID. + explode: false + in: path + name: accountId + required: true + schema: + example: "5500123" + type: string + style: simple + - description: BRTC Endpoint ID. + explode: false + in: path + name: endpointId + required: true + schema: + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + style: simple + requestBody: + $ref: "#/components/requestBodies/updateEndpointBxmlRequest" + responses: + "204": + description: No Content + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Not Found + "405": + content: + application/json: + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Method Not Allowed + "415": + content: + application/json: + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + "500": + content: + application/json: + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Service Unavailable + summary: Update Endpoint BXML + tags: + - Endpoints + servers: + - description: Production + url: https://api.bandwidth.com/v2 components: callbacks: inboundCallback: @@ -5697,20 +6259,18 @@ components: application/json: examples: smsMessageReceivedCallback: - $ref: '#/components/examples/smsMessageReceivedCallbackExample' + $ref: "#/components/examples/smsMessageReceivedCallbackExample" mmsMessageReceivedCallback: - $ref: '#/components/examples/mmsMessageReceivedCallbackExample' + $ref: "#/components/examples/mmsMessageReceivedCallbackExample" schema: - $ref: '#/components/schemas/inboundCallback' - description: "

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

The payload type will be one\ - \ of message-received, suggestion-response,\ - \ or location-request-response.\n

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

Please visit Webhooks

" + $ref: "#/components/schemas/inboundCallback" + 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 location-request-response. +

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

Please visit Webhooks

required: true responses: "200": @@ -5725,17 +6285,17 @@ components: application/json: examples: messageSendingCallback: - $ref: '#/components/examples/messageSendingCallbackExample' + $ref: "#/components/examples/messageSendingCallbackExample" smsMessageDeliveredCallback: - $ref: '#/components/examples/smsMessageDeliveredCallbackExample' + $ref: "#/components/examples/smsMessageDeliveredCallbackExample" mmsMessageDeliveredCallback: - $ref: '#/components/examples/mmsMessageDeliveredCallbackExample' + $ref: "#/components/examples/mmsMessageDeliveredCallbackExample" groupMmsMessageDeliveredCallback: - $ref: '#/components/examples/groupMmsMessageDeliveredCallbackExample' + $ref: "#/components/examples/groupMmsMessageDeliveredCallbackExample" messageFailedCallback: - $ref: '#/components/examples/messageFailedCallbackExample' + $ref: "#/components/examples/messageFailedCallbackExample" schema: - $ref: '#/components/schemas/statusCallback' + $ref: "#/components/schemas/statusCallback" description: |-

This Outbound Message Webhook is an envelope containing status information regarding a message sent (MT) from your message-enabled Bandwidth telephone number. @@ -5767,7 +6327,7 @@ components: type: string style: simple requestBody: - $ref: '#/components/requestBodies/verificationWebhookRequest' + $ref: "#/components/requestBodies/verificationWebhookRequest" responses: "204": description: No Content @@ -5778,7 +6338,7 @@ components: description: Cannot process request. type: bad request schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request "401": content: @@ -5787,7 +6347,7 @@ components: description: Client is providing incorrect or invalid credentials. type: unauthorized schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Unauthorized "403": content: @@ -5796,7 +6356,7 @@ components: description: Client is not authorized for the action. type: forbidden schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Forbidden "404": content: @@ -5805,7 +6365,7 @@ components: description: Cannot find the requested resource. type: Not Found schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Cannot find the requested resource. "405": content: @@ -5814,7 +6374,7 @@ components: description: Method is not allowed. type: Method Not Allowed schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Method Not Allowed "429": content: @@ -5823,7 +6383,7 @@ components: description: Throttling error. Too many requests. type: Too Many Requests schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Too Many Requests "500": content: @@ -5832,7 +6392,7 @@ components: description: Internal Server Error. type: Internal Server Error schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Internal Server Error "503": content: @@ -5841,9 +6401,23 @@ components: description: Service Unavailable Error. type: Service Unavailable schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Service Unavailable summary: TFV status updates sent to customer's webhook URL. + endpointEvent: + '{request.body#/eventCallbackUrl}': + post: + requestBody: + content: + application/json: + examples: + endpointDisconnectedEventExample: + $ref: "#/components/examples/endpointDisconnectedEventExample" + schema: + $ref: "#/components/schemas/endpointEvent" + responses: + "204": + description: Event was successfully received. examples: smsMessageReceivedCallbackExample: summary: An example of a sms message-received callback body. @@ -6262,6 +6836,200 @@ components: 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: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: too_many_requests + description: The client has sent too many requests in a given amount of + time. + code: "429" + 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" parameters: accountId: description: Your Bandwidth Account ID. @@ -6361,7 +7129,7 @@ components: name: messageStatus required: false schema: - $ref: '#/components/schemas/messageStatusEnum' + $ref: "#/components/schemas/messageStatusEnum" style: form messageDirection: description: The direction of the message. One of INBOUND OUTBOUND. @@ -6370,7 +7138,7 @@ components: name: messageDirection required: false schema: - $ref: '#/components/schemas/listMessageDirectionEnum' + $ref: "#/components/schemas/listMessageDirectionEnum" style: form carrierName: description: The name of the carrier used for this message. Possible values @@ -6391,7 +7159,7 @@ components: name: messageType required: false schema: - $ref: '#/components/schemas/messageTypeEnum' + $ref: "#/components/schemas/messageTypeEnum" style: form errorCode: description: The error code of the message. @@ -6465,7 +7233,7 @@ components: name: product required: false schema: - $ref: '#/components/schemas/productTypeEnum' + $ref: "#/components/schemas/productTypeEnum" style: form location: description: Location Id associated with the message. @@ -6831,7 +7599,7 @@ components: name: phoneNumber required: true schema: - $ref: '#/components/schemas/tfPhoneNumber' + $ref: "#/components/schemas/tfPhoneNumber" style: simple webhookSubscriptionIdPathParam: description: Webhook subscription ID @@ -6843,18 +7611,80 @@ components: schema: type: string style: simple + accountId2: + description: Your Bandwidth Account ID. + explode: false + in: path + name: accountId + required: true + schema: + example: "5500123" + type: string + style: simple + endpointId: + description: BRTC Endpoint ID. + explode: false + in: path + name: endpointId + required: true + schema: + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + style: simple + endpointType: + description: The type of endpoint. + explode: true + in: query + name: type + required: false + schema: + $ref: "#/components/schemas/endpointTypeEnum" + style: form + endpointStatus: + description: The status of the endpoint. + explode: true + in: query + name: status + required: false + schema: + $ref: "#/components/schemas/endpointStatusEnum" + style: form + afterCursor: + description: The cursor to use for pagination. This is the value of the `next` + link in the previous response. + explode: true + in: query + name: afterCursor + required: false + schema: + example: TWF5IHRoZSBmb3JjZSBiZSB3aXRoIHlvdQ== + type: string + style: form + limit1: + description: The maximum number of endpoints to return in the response. + explode: true + in: query + name: limit + required: false + schema: + default: 100 + example: 2 + maximum: 1000 + minimum: 1 + type: integer + style: form requestBodies: createMessageRequest: content: application/json: schema: - $ref: '#/components/schemas/messageRequest' + $ref: "#/components/schemas/messageRequest" required: true createMultiChannelMessageRequest: content: application/json: schema: - $ref: '#/components/schemas/multiChannelMessageRequest' + $ref: "#/components/schemas/multiChannelMessageRequest" required: true uploadMediaRequest: content: @@ -7055,14 +7885,14 @@ components: content: application/json: schema: - $ref: '#/components/schemas/createCall' + $ref: "#/components/schemas/createCall" description: JSON object containing information to create an outbound call required: true updateCallRequest: content: application/json: schema: - $ref: '#/components/schemas/updateCall' + $ref: "#/components/schemas/updateCall" description: JSON object containing information to redirect an existing call to a new BXML document required: true @@ -7092,19 +7922,19 @@ components: content: application/json: schema: - $ref: '#/components/schemas/updateCallRecording' + $ref: "#/components/schemas/updateCallRecording" required: true transcribeRecordingRequest: content: application/json: schema: - $ref: '#/components/schemas/transcribeRecording' + $ref: "#/components/schemas/transcribeRecording" required: true updateConferenceRequest: content: application/json: schema: - $ref: '#/components/schemas/updateConference' + $ref: "#/components/schemas/updateConference" required: true updateConferenceBxmlRequest: content: @@ -7125,20 +7955,20 @@ components: content: application/json: schema: - $ref: '#/components/schemas/updateConferenceMember' + $ref: "#/components/schemas/updateConferenceMember" required: true codeRequest: content: application/json: schema: - $ref: '#/components/schemas/codeRequest' + $ref: "#/components/schemas/codeRequest" description: MFA code request body. required: true codeVerify: content: application/json: schema: - $ref: '#/components/schemas/verifyCodeRequest' + $ref: "#/components/schemas/verifyCodeRequest" description: MFA code verify request body. required: true createSyncLookupRequest: @@ -7146,11 +7976,11 @@ components: application/json: examples: singleNumberRequestExample: - $ref: '#/components/examples/singleNumberRequestExample' + $ref: "#/components/examples/singleNumberRequestExample" multipleNumberRequestExample: - $ref: '#/components/examples/multipleNumberRequestExample' + $ref: "#/components/examples/multipleNumberRequestExample" schema: - $ref: '#/components/schemas/syncLookupRequest' + $ref: "#/components/schemas/syncLookupRequest" description: Synchronous phone number lookup request. required: true createAsyncBulkLookupRequest: @@ -7158,23 +7988,23 @@ components: application/json: examples: multipleNumberRequestExample: - $ref: '#/components/examples/multipleNumberRequestExample' + $ref: "#/components/examples/multipleNumberRequestExample" schema: - $ref: '#/components/schemas/asyncLookupRequest' + $ref: "#/components/schemas/asyncLookupRequest" description: Asynchronous bulk phone number lookup request. required: true requestTollFreeVerificationRequest: content: application/json: schema: - $ref: '#/components/schemas/verificationRequest' + $ref: "#/components/schemas/verificationRequest" description: Request for verification of a toll-free phone number. required: true updateTollFreeVerificationRequestRequest: content: application/json: schema: - $ref: '#/components/schemas/tfvSubmissionWrapper' + $ref: "#/components/schemas/tfvSubmissionWrapper" description: Update a request for verification of a toll-free phone number. required: true verificationWebhookRequest: @@ -7182,38 +8012,59 @@ components: application/json: schema: oneOf: - - $ref: '#/components/schemas/verificationWebhook' - - $ref: '#/components/schemas/verificationDenialWebhook' - - $ref: '#/components/schemas/failureWebhook' - - $ref: '#/components/schemas/blockedWebhook' + - $ref: "#/components/schemas/verificationWebhook" + - $ref: "#/components/schemas/verificationDenialWebhook" + - $ref: "#/components/schemas/failureWebhook" + - $ref: "#/components/schemas/blockedWebhook" description: Verification callback status of a toll-free phone number. required: true webhookSubscriptionRequest: content: application/json: schema: - $ref: '#/components/schemas/webhookSubscriptionRequestSchema' + $ref: "#/components/schemas/webhookSubscriptionRequestSchema" description: Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. required: true + createEndpointRequest: + content: + application/json: + examples: + createWebRtcEndpointRequestExample: + $ref: "#/components/examples/createWeRtcEndpointExample" + schema: + $ref: "#/components/schemas/createEndpointRequest" + required: true + updateEndpointBxmlRequest: + content: + application/xml: + examples: + updateEndpointBxmlRequestExample: + $ref: "#/components/examples/updateEndpointBxmlRequestExample" + schema: + 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/). + type: string + required: true responses: createMessageResponse: content: application/json: schema: - $ref: '#/components/schemas/message' + $ref: "#/components/schemas/message" description: Accepted createMultiChannelMessageResponse: content: application/json: schema: - $ref: '#/components/schemas/createMultiChannelMessageResponse' + $ref: "#/components/schemas/createMultiChannelMessageResponse" description: Accepted listMessagesResponse: content: application/json: schema: - $ref: '#/components/schemas/messagesList' + $ref: "#/components/schemas/messagesList" description: OK getMediaResponse: content: @@ -7228,7 +8079,7 @@ components: application/json: schema: items: - $ref: '#/components/schemas/media' + $ref: "#/components/schemas/media" type: array description: OK headers: @@ -7242,61 +8093,61 @@ components: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Bad Request messagingNotAcceptableError: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Acceptable createMessageBadRequestError: content: application/json: schema: - $ref: '#/components/schemas/createMessageRequestError' + $ref: "#/components/schemas/createMessageRequestError" description: Bad Request messagingUnauthorizedError: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unauthorized messagingForbiddenError: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Forbidden messagingNotFoundError: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Not Found messagingMethodNotAllowedError: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Method Not Allowed messagingInvalidMediaTypeError: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Unsupported Media Type messagingTooManyRequestsError: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Too Many Requests messagingInternalServerError: content: application/json: schema: - $ref: '#/components/schemas/messagingRequestError' + $ref: "#/components/schemas/messagingRequestError" description: Internal Server Error multiChannelBadRequestError: content: @@ -7311,7 +8162,7 @@ components: source: field: "channelList[0].from" schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Bad Request multiChannelNotAcceptableError: description: Not Acceptable @@ -7326,7 +8177,7 @@ components: description: Authentication Failed source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Unauthorized multiChannelForbiddenError: content: @@ -7339,7 +8190,7 @@ components: description: Access Denied source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Forbidden multiChannelNotFoundError: content: @@ -7352,7 +8203,7 @@ components: description: Resource not found. source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Not Found multiChannelMethodNotAllowedError: content: @@ -7365,7 +8216,7 @@ components: description: Method 'PUT' not supported for this resource. source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Method Not Allowed multiChannelInvalidMediaTypeError: content: @@ -7380,7 +8231,7 @@ components: source: header: Content-Type schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Unsupported Media Type multiChannelTooManyRequestsError: content: @@ -7394,7 +8245,7 @@ components: retry later. source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Too Many Requests multiChannelInternalServerError: content: @@ -7407,16 +8258,16 @@ components: description: Internal server error. No further information available source: {} schema: - $ref: '#/components/schemas/multiChannelError' + $ref: "#/components/schemas/multiChannelError" description: Internal Server Error createCallResponse: content: application/json: examples: createCall Response: - $ref: '#/components/examples/createCallResponseExample' + $ref: "#/components/examples/createCallResponseExample" schema: - $ref: '#/components/schemas/createCallResponse' + $ref: "#/components/schemas/createCallResponse" description: Created headers: Location: @@ -7429,7 +8280,7 @@ components: content: application/json: schema: - $ref: '#/components/schemas/callState' + $ref: "#/components/schemas/callState" description: OK updateCallResponse: description: OK @@ -7438,14 +8289,14 @@ components: application/json: schema: items: - $ref: '#/components/schemas/callState' + $ref: "#/components/schemas/callState" type: array description: OK getStatisticsResponse: content: application/json: schema: - $ref: '#/components/schemas/accountStatistics' + $ref: "#/components/schemas/accountStatistics" description: OK updateRecordingResponse: description: OK @@ -7454,14 +8305,14 @@ components: application/json: schema: items: - $ref: '#/components/schemas/callRecordingMetadata' + $ref: "#/components/schemas/callRecordingMetadata" type: array description: OK getCallRecordingResponse: content: application/json: schema: - $ref: '#/components/schemas/callRecordingMetadata' + $ref: "#/components/schemas/callRecordingMetadata" description: OK downloadRecordingMediaResponse: content: @@ -7478,19 +8329,19 @@ components: content: application/json: schema: - $ref: '#/components/schemas/recordingTranscriptions' + $ref: "#/components/schemas/recordingTranscriptions" description: OK listTranscriptionsResponse: content: application/json: schema: - $ref: '#/components/schemas/callTranscriptionMetadataList' + $ref: "#/components/schemas/callTranscriptionMetadataList" description: OK getCallTranscriptionResponse: content: application/json: schema: - $ref: '#/components/schemas/callTranscriptionResponse' + $ref: "#/components/schemas/callTranscriptionResponse" description: OK deleteCallTranscriptionResponse: description: No Content @@ -7499,109 +8350,109 @@ components: application/json: examples: listConferences Response: - $ref: '#/components/examples/listConferencesResponseExample' + $ref: "#/components/examples/listConferencesResponseExample" schema: items: - $ref: '#/components/schemas/conference' + $ref: "#/components/schemas/conference" type: array description: OK getConferenceResponse: content: application/json: schema: - $ref: '#/components/schemas/conference' + $ref: "#/components/schemas/conference" description: OK getConferenceMemberResponse: content: application/json: schema: - $ref: '#/components/schemas/conferenceMember' + $ref: "#/components/schemas/conferenceMember" description: OK listConferenceRecordingsResponse: content: application/json: schema: items: - $ref: '#/components/schemas/conferenceRecordingMetadata' + $ref: "#/components/schemas/conferenceRecordingMetadata" type: array description: OK getConferenceRecordingResponse: content: application/json: schema: - $ref: '#/components/schemas/conferenceRecordingMetadata' + $ref: "#/components/schemas/conferenceRecordingMetadata" description: OK voiceBadRequestError: content: application/json: examples: badRequestErrorExample: - $ref: '#/components/examples/voiceBadRequestErrorExample' + $ref: "#/components/examples/voiceBadRequestErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Bad Request voiceUnauthorizedError: content: application/json: examples: unauthorizedErrorExample: - $ref: '#/components/examples/voiceUnauthorizedErrorExample' + $ref: "#/components/examples/voiceUnauthorizedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unauthorized voiceForbiddenError: content: application/json: examples: forbiddenErrorExample: - $ref: '#/components/examples/voiceForbiddenErrorExample' + $ref: "#/components/examples/voiceForbiddenErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Forbidden voiceNotFoundError: content: application/json: examples: notFoundErrorExample: - $ref: '#/components/examples/voiceNotFoundErrorExample' + $ref: "#/components/examples/voiceNotFoundErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Not Found voiceNotAllowedError: content: application/json: examples: notAllowedErrorExample: - $ref: '#/components/examples/voiceNotAllowedErrorExample' + $ref: "#/components/examples/voiceNotAllowedErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Method Not Allowed voiceConflictError: content: application/json: examples: conflictErrorExample: - $ref: '#/components/examples/voiceConflictErrorExample' + $ref: "#/components/examples/voiceConflictErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Conflict voiceUnsupportedMediaTypeError: content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + $ref: "#/components/examples/voiceUnsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Unsupported Media Type voiceTooManyRequestsError: content: application/json: examples: tooManyRequestsErrorExample: - $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + $ref: "#/components/examples/voiceTooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Too Many Requests headers: Retry-After: @@ -7615,149 +8466,149 @@ components: application/json: examples: internalServerErrorExample: - $ref: '#/components/examples/voiceInternalServerErrorExample' + $ref: "#/components/examples/voiceInternalServerErrorExample" schema: - $ref: '#/components/schemas/voiceApiError' + $ref: "#/components/schemas/voiceApiError" description: Internal Server Error voiceCodeResponse: content: application/json: schema: - $ref: '#/components/schemas/voiceCodeResponse' + $ref: "#/components/schemas/voiceCodeResponse" description: OK messagingCodeResponse: content: application/json: schema: - $ref: '#/components/schemas/messagingCodeResponse' + $ref: "#/components/schemas/messagingCodeResponse" description: OK verifyCodeResponse: content: application/json: schema: - $ref: '#/components/schemas/verifyCodeResponse' + $ref: "#/components/schemas/verifyCodeResponse" description: OK mfaBadRequestError: content: application/json: schema: - $ref: '#/components/schemas/mfaRequestError' + $ref: "#/components/schemas/mfaRequestError" description: Bad Request mfaUnauthorizedError: content: application/json: schema: - $ref: '#/components/schemas/mfaUnauthorizedRequestError' + $ref: "#/components/schemas/mfaUnauthorizedRequestError" description: Unauthorized mfaForbiddenError: content: application/json: schema: - $ref: '#/components/schemas/mfaForbiddenRequestError' + $ref: "#/components/schemas/mfaForbiddenRequestError" description: Forbidden mfaTooManyRequestsError: content: application/json: schema: - $ref: '#/components/schemas/mfaRequestError' + $ref: "#/components/schemas/mfaRequestError" description: Too Many Requests mfaInternalServerError: content: application/json: schema: - $ref: '#/components/schemas/mfaRequestError' + $ref: "#/components/schemas/mfaRequestError" description: Internal Server Error createSyncLookupResponse: content: application/json: examples: lookupCompleteWithDniExample: - $ref: '#/components/examples/lookupCompleteWithDniExample' + $ref: "#/components/examples/lookupCompleteWithDniExample" lookupCompleteExample: - $ref: '#/components/examples/lookupCompleteExample' + $ref: "#/components/examples/lookupCompleteExample" lookupPartialExample: - $ref: '#/components/examples/lookupPartialExample' + $ref: "#/components/examples/lookupPartialExample" lookupFailedExample: - $ref: '#/components/examples/lookupFailedExample' + $ref: "#/components/examples/lookupFailedExample" schema: - $ref: '#/components/schemas/createSyncLookupResponse' + $ref: "#/components/schemas/createSyncLookupResponse" description: OK createAsyncBulkLookupResponse: content: application/json: examples: lookupInProgressExample: - $ref: '#/components/examples/lookupInProgressExample' + $ref: "#/components/examples/lookupInProgressExample" schema: - $ref: '#/components/schemas/createAsyncBulkLookupResponse' + $ref: "#/components/schemas/createAsyncBulkLookupResponse" description: Accepted getAsyncBulkLookupResponse: content: application/json: examples: lookupCompleteWithDniExample: - $ref: '#/components/examples/lookupCompleteWithDniExample' + $ref: "#/components/examples/lookupCompleteWithDniExample" lookupCompleteExample: - $ref: '#/components/examples/lookupCompleteExample' + $ref: "#/components/examples/lookupCompleteExample" lookupInProgressExample: - $ref: '#/components/examples/lookupInProgressExample' + $ref: "#/components/examples/lookupInProgressExample" lookupPartialExample: - $ref: '#/components/examples/lookupPartialExample' + $ref: "#/components/examples/lookupPartialExample" lookupFailedExample: - $ref: '#/components/examples/lookupFailedExample' + $ref: "#/components/examples/lookupFailedExample" schema: - $ref: '#/components/schemas/getAsyncBulkLookupResponse' + $ref: "#/components/schemas/getAsyncBulkLookupResponse" description: OK tnLookupDefaultResponse: content: application/json: examples: badRequest: - $ref: '#/components/examples/badRequestExample' + $ref: "#/components/examples/badRequestExample" unauthorized: - $ref: '#/components/examples/unauthorizedExample' + $ref: "#/components/examples/unauthorizedExample" forbidden: - $ref: '#/components/examples/forbiddenExample' + $ref: "#/components/examples/forbiddenExample" mediaType: - $ref: '#/components/examples/unsupportedMediaTypeExample' + $ref: "#/components/examples/unsupportedMediaTypeExample" notFound: - $ref: '#/components/examples/notFoundExample' + $ref: "#/components/examples/notFoundExample" tooManyRequests: - $ref: '#/components/examples/tooManyRequestsExample' + $ref: "#/components/examples/tooManyRequestsExample" internalServer: - $ref: '#/components/examples/internalServerErrorExample' + $ref: "#/components/examples/internalServerErrorExample" schema: - $ref: '#/components/schemas/lookupErrorResponse' + $ref: "#/components/schemas/lookupErrorResponse" description: Bad Request getTollFreeVerificationStatusResponse: content: application/json: schema: - $ref: '#/components/schemas/tfvStatus' + $ref: "#/components/schemas/tfvStatus" description: OK listWebhookSubscriptionsResponse: content: application/json: schema: - $ref: '#/components/schemas/webhookSubscriptionsListBody' + $ref: "#/components/schemas/webhookSubscriptionsListBody" description: OK createWebhookSubscriptionResponse: content: application/json: schema: - $ref: '#/components/schemas/webhookSubscription' + $ref: "#/components/schemas/webhookSubscription" description: Created updateWebhookSubscriptionResponse: content: application/json: schema: - $ref: '#/components/schemas/webhookSubscription' + $ref: "#/components/schemas/webhookSubscription" description: OK listTollFreeUseCasesResponse: content: application/json: schema: - $ref: '#/components/schemas/useCases' + $ref: "#/components/schemas/useCases" description: OK tfvBadRequestResponse: content: @@ -7766,7 +8617,7 @@ components: description: Cannot process request. type: bad request schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request noContentResponse: description: No Content @@ -7780,7 +8631,7 @@ components: businessContactEmail: Business contact email is not a valid email address. optInWorkflowImageURLs: Entries must be a valid array of objects. schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Bad Request tfvUnauthorizedResponse: content: @@ -7789,7 +8640,7 @@ components: description: Client is providing incorrect or invalid credentials. type: unauthorized schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" description: Unauthorized tfvForbiddenResponse: content: @@ -7798,52 +8649,151 @@ components: description: Client is not authorized for the action. type: forbidden schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/tfvError" + description: Forbidden + tfvNotFoundResponse: + content: + application/json: + example: + description: Cannot find the requested resource. + type: Not Found + schema: + $ref: "#/components/schemas/tfvError" + description: Cannot find the requested resource. + tfvNotAllowedResponse: + content: + application/json: + example: + description: Method is not allowed. + type: Method Not Allowed + schema: + $ref: "#/components/schemas/tfvError" + description: Method Not Allowed + tfvTooManyRequestsResponse: + content: + application/json: + example: + description: Throttling error. Too many requests. + type: Too Many Requests + schema: + $ref: "#/components/schemas/tfvError" + description: Too Many Requests + tfvServerErrorResponse: + content: + application/json: + example: + description: Internal Server Error. + type: Internal Server Error + schema: + $ref: "#/components/schemas/tfvError" + description: Internal Server Error + tfvServiceUnavailableResponse: + content: + application/json: + example: + description: Service Unavailable Error. + type: Service Unavailable + schema: + $ref: "#/components/schemas/tfvError" + description: Service Unavailable + listEndpointsResponse: + content: + application/json: + examples: + listEndpointsResponseExample: + $ref: "#/components/examples/listEndpointsResponseExample" + schema: + $ref: "#/components/schemas/listEndpointsResponse" + description: OK + createEndpointResponse: + content: + application/json: + examples: + createEndpointResponseExample: + $ref: "#/components/examples/createEndpointResponseExample" + schema: + $ref: "#/components/schemas/createEndpointResponse" + description: Created + getEndpointResponse: + content: + application/json: + examples: + getEndpointResponseExample: + $ref: "#/components/examples/getEndpointResponseExample" + schema: + $ref: "#/components/schemas/endpointResponse" + description: OK + badRequestErrorResponse: + content: + application/json: + examples: + badRequestErrorExample: + $ref: "#/components/examples/badRequestErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Bad Request + unauthorizedErrorResponse: + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: "#/components/examples/unauthorizedErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" + description: Unauthorized + forbiddenErrorResponse: + content: + application/json: + examples: + forbiddenErrorExample: + $ref: "#/components/examples/forbiddenErrorExample" + schema: + $ref: "#/components/schemas/errorResponse" description: Forbidden - tfvNotFoundResponse: + notFoundErrorResponse: content: application/json: - example: - description: Cannot find the requested resource. - type: Not Found + examples: + notFoundErrorExample: + $ref: "#/components/examples/notFoundErrorExample" schema: - $ref: '#/components/schemas/tfvError' - description: Cannot find the requested resource. - tfvNotAllowedResponse: + $ref: "#/components/schemas/errorResponse" + description: Not Found + methodNotAllowedErrorResponse: content: application/json: - example: - description: Method is not allowed. - type: Method Not Allowed + examples: + methodNotAllowedErrorExample: + $ref: "#/components/examples/methodNotAllowedErrorExample" schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/errorResponse" description: Method Not Allowed - tfvTooManyRequestsResponse: + unsupportedMediaTypeErrorResponse: content: application/json: - example: - description: Throttling error. Too many requests. - type: Too Many Requests + examples: + unsuppotedMediaTypeErrorExample: + $ref: "#/components/examples/unsupportedMediaTypeErrorExample" schema: - $ref: '#/components/schemas/tfvError' - description: Too Many Requests - tfvServerErrorResponse: + $ref: "#/components/schemas/errorResponse" + description: Unsupported Media Type + tooManyRequestsErrorResponse: content: application/json: - example: - description: Internal Server Error. - type: Internal Server Error + examples: + tooManyRequestsErrorExample: + $ref: "#/components/examples/tooManyRequestsErrorExample" schema: - $ref: '#/components/schemas/tfvError' - description: Internal Server Error - tfvServiceUnavailableResponse: + $ref: "#/components/schemas/errorResponse" + description: Too Many Requests + serviceUnavailableErrorResponse: content: application/json: - example: - description: Service Unavailable Error. - type: Service Unavailable + examples: + serviceUnavailableErrorExample: + $ref: "#/components/examples/serviceUnavailableErrorExample" schema: - $ref: '#/components/schemas/tfvError' + $ref: "#/components/schemas/errorResponse" description: Service Unavailable schemas: applicationId: @@ -7988,10 +8938,10 @@ components: example: 100 type: integer pageInfo: - $ref: '#/components/schemas/pageInfo' + $ref: "#/components/schemas/pageInfo" messages: items: - $ref: '#/components/schemas/listMessageItem' + $ref: "#/components/schemas/listMessageItem" type: array title: MessagesList type: object @@ -8038,11 +8988,11 @@ components: example: "+15554442222" type: string messageStatus: - $ref: '#/components/schemas/messageStatusEnum' + $ref: "#/components/schemas/messageStatusEnum" messageDirection: - $ref: '#/components/schemas/listMessageDirectionEnum' + $ref: "#/components/schemas/listMessageDirectionEnum" messageType: - $ref: '#/components/schemas/messageTypeEnum' + $ref: "#/components/schemas/messageTypeEnum" segmentCount: description: The number of segments the user's message is broken into before sending over carrier networks. @@ -8184,7 +9134,7 @@ components: type: string fieldErrors: items: - $ref: '#/components/schemas/fieldError' + $ref: "#/components/schemas/fieldError" type: array required: - description @@ -8228,9 +9178,10 @@ components: format: date-time type: string carrierName: - description: "The name of the Authorized Message Provider (AMP) that handled\ - \ this message. \nIn the US, this is the carrier that the message was sent\ - \ to.\nThis field is present only when this account feature has been enabled." + 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 type: string message: @@ -8275,7 +9226,7 @@ components: example: 1 type: integer direction: - $ref: '#/components/schemas/messageDirectionEnum' + $ref: "#/components/schemas/messageDirectionEnum" to: description: The phone number recipients of the message. example: @@ -8310,7 +9261,7 @@ components: title: Tag type: string priority: - $ref: '#/components/schemas/priorityEnum' + $ref: "#/components/schemas/priorityEnum" expiration: description: "A string with the date/time value that the message will automatically\ \ expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z\ @@ -8337,13 +9288,9 @@ components: type: array uniqueItems: true from: - 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. \nAlphanumeric\ - \ 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." + 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" type: string text: @@ -8371,7 +9318,7 @@ components: title: Tag type: string priority: - $ref: '#/components/schemas/priorityEnum' + $ref: "#/components/schemas/priorityEnum" expiration: description: "A string with the date/time value that the message will automatically\ \ expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z\ @@ -8528,14 +9475,14 @@ components: links: example: [] items: - $ref: '#/components/schemas/link' + $ref: "#/components/schemas/link" type: array data: - $ref: '#/components/schemas/multiChannelMessageResponseData' + $ref: "#/components/schemas/multiChannelMessageResponseData" errors: example: [] items: - $ref: '#/components/schemas/errorObject' + $ref: "#/components/schemas/errorObject" type: array type: object multiChannelError: @@ -8561,7 +9508,7 @@ components: links: example: [] items: - $ref: '#/components/schemas/link' + $ref: "#/components/schemas/link" type: array data: nullable: true @@ -8569,10 +9516,13 @@ components: example: null errors: items: - $ref: '#/components/schemas/errorObject' + $ref: "#/components/schemas/errorObject" type: array type: object link: + example: + rel: rel + href: href properties: rel: type: string @@ -8596,7 +9546,7 @@ components: description: A detailed explanation of the error. type: string source: - $ref: '#/components/schemas/errorSource' + $ref: "#/components/schemas/errorSource" required: - description - source @@ -8683,7 +9633,7 @@ components: suggestions: description: An array of suggested actions for the recipient. items: - $ref: '#/components/schemas/multiChannelAction' + $ref: "#/components/schemas/multiChannelAction" maxItems: 11 type: array required: @@ -8735,11 +9685,11 @@ components: rbmMessageMedia: properties: media: - $ref: '#/components/schemas/rbmMessageContentFile' + $ref: "#/components/schemas/rbmMessageContentFile" suggestions: description: An array of suggested actions for the recipient. items: - $ref: '#/components/schemas/multiChannelAction' + $ref: "#/components/schemas/multiChannelAction" maxItems: 11 type: array required: @@ -8759,27 +9709,27 @@ components: maxLength: 2000 type: string media: - $ref: '#/components/schemas/rbmCardContent_media' + $ref: "#/components/schemas/rbmCardContent_media" suggestions: description: An array of suggested actions for the recipient that will be displayed on the rich card. items: - $ref: '#/components/schemas/multiChannelAction' + $ref: "#/components/schemas/multiChannelAction" maxItems: 4 type: array type: object rbmStandaloneCard: properties: orientation: - $ref: '#/components/schemas/standaloneCardOrientationEnum' + $ref: "#/components/schemas/standaloneCardOrientationEnum" thumbnailImageAlignment: - $ref: '#/components/schemas/thumbnailAlignmentEnum' + $ref: "#/components/schemas/thumbnailAlignmentEnum" cardContent: - $ref: '#/components/schemas/rbmCardContent' + $ref: "#/components/schemas/rbmCardContent" suggestions: description: An array of suggested actions for the recipient. items: - $ref: '#/components/schemas/multiChannelAction' + $ref: "#/components/schemas/multiChannelAction" maxItems: 11 type: array required: @@ -8805,16 +9755,16 @@ components: rbmMessageCarouselCard: properties: cardWidth: - $ref: '#/components/schemas/cardWidthEnum' + $ref: "#/components/schemas/cardWidthEnum" cardContents: items: - $ref: '#/components/schemas/rbmCardContent' + $ref: "#/components/schemas/rbmCardContent" maxItems: 10 type: array suggestions: description: An array of suggested actions for the recipient. items: - $ref: '#/components/schemas/multiChannelAction' + $ref: "#/components/schemas/multiChannelAction" maxItems: 11 type: array required: @@ -8850,14 +9800,14 @@ components: type: string media: items: - $ref: '#/components/schemas/mmsMessageContentFile' + $ref: "#/components/schemas/mmsMessageContentFile" type: array title: MMS Message type: object rbmMessageContentRichCard: oneOf: - - $ref: '#/components/schemas/rbmStandaloneCard' - - $ref: '#/components/schemas/rbmMessageCarouselCard' + - $ref: "#/components/schemas/rbmStandaloneCard" + - $ref: "#/components/schemas/rbmMessageCarouselCard" title: RBM Rich Card rbmActionTypeEnum: enum: @@ -8870,20 +9820,21 @@ components: example: REPLY type: string rbmOpenUrlEnum: - description: "Specifies how the URL should be opened on a mobile device.\n-\ - \ `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. \n- `WEBVIEW` Opens the URL in an in-app WebView." + 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 type: string rbmWebViewEnum: - description: "Defines the layout of the WebView on a mobile device. It must\ - \ be defined when application is set to `WEBVIEW`\n- `FULL` WebView takes\ - \ the full screen. \n- `HALF` WebView takes half of the screen.\n- `TALL`\ - \ WebView takes three-quarters of the screen." + description: |- + Defines the layout of the WebView on a mobile device. It must be defined when application is set to `WEBVIEW` + - `FULL` WebView takes the full screen. + - `HALF` WebView takes half of the screen. + - `TALL` WebView takes three-quarters of the screen. enum: - FULL - HALF @@ -8911,7 +9862,7 @@ components: type: REPLY properties: type: - $ref: '#/components/schemas/rbmActionTypeEnum' + $ref: "#/components/schemas/rbmActionTypeEnum" text: description: Displayed text for user to click example: Hello world @@ -8933,7 +9884,7 @@ components: type: object rbmActionDial: allOf: - - $ref: '#/components/schemas/rbmActionBase' + - $ref: "#/components/schemas/rbmActionBase" - properties: phoneNumber: description: The phone number to dial. Must be E164 format. @@ -8945,7 +9896,7 @@ components: type: object rbmActionViewLocation: allOf: - - $ref: '#/components/schemas/rbmActionBase' + - $ref: "#/components/schemas/rbmActionBase" - properties: latitude: description: The latitude of the location. @@ -8969,7 +9920,7 @@ components: type: object multiChannelActionCalendarEvent: allOf: - - $ref: '#/components/schemas/rbmActionBase' + - $ref: "#/components/schemas/rbmActionBase" - properties: title: description: The title of the event. @@ -8999,7 +9950,7 @@ components: type: object rbmActionOpenUrl: allOf: - - $ref: '#/components/schemas/rbmActionBase' + - $ref: "#/components/schemas/rbmActionBase" - properties: url: description: The URL to open in browser. @@ -9008,9 +9959,9 @@ components: maxLength: 2048 type: string application: - $ref: '#/components/schemas/rbmOpenUrlEnum' + $ref: "#/components/schemas/rbmOpenUrlEnum" webviewViewMode: - $ref: '#/components/schemas/rbmWebViewEnum' + $ref: "#/components/schemas/rbmWebViewEnum" required: - url title: Open URL @@ -9018,24 +9969,24 @@ components: multiChannelFullActions: description: An array of suggested actions for the recipient. items: - $ref: '#/components/schemas/multiChannelAction' + $ref: "#/components/schemas/multiChannelAction" maxItems: 11 type: array multiChannelAction: anyOf: - - $ref: '#/components/schemas/rbmActionBase' - - $ref: '#/components/schemas/rbmActionDial' - - $ref: '#/components/schemas/rbmActionViewLocation' - - $ref: '#/components/schemas/multiChannelActionCalendarEvent' - - $ref: '#/components/schemas/rbmActionOpenUrl' + - $ref: "#/components/schemas/rbmActionBase" + - $ref: "#/components/schemas/rbmActionDial" + - $ref: "#/components/schemas/rbmActionViewLocation" + - $ref: "#/components/schemas/multiChannelActionCalendarEvent" + - $ref: "#/components/schemas/rbmActionOpenUrl" discriminator: 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' + 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" propertyName: type multiChannelChannelListObjectBase: properties: @@ -9050,7 +10001,7 @@ components: example: 93de2206-9669-4e07-948d-329f4b722ee2 type: string channel: - $ref: '#/components/schemas/multiChannelMessageChannelEnum' + $ref: "#/components/schemas/multiChannelMessageChannelEnum" required: - applicationId - channel @@ -9058,35 +10009,35 @@ components: type: object multiChannelChannelListRBMObject: allOf: - - $ref: '#/components/schemas/multiChannelChannelListObjectBase' + - $ref: "#/components/schemas/multiChannelChannelListObjectBase" - properties: content: - $ref: '#/components/schemas/multiChannelChannelListRBMObject_allOf_content' + $ref: "#/components/schemas/multiChannelChannelListRBMObject_allOf_content" type: object required: - content multiChannelChannelListSMSObject: allOf: - - $ref: '#/components/schemas/multiChannelChannelListObjectBase' + - $ref: "#/components/schemas/multiChannelChannelListObjectBase" - properties: content: - $ref: '#/components/schemas/smsMessageContent' + $ref: "#/components/schemas/smsMessageContent" type: object required: - content multiChannelChannelListMMSObject: allOf: - - $ref: '#/components/schemas/multiChannelChannelListObjectBase' + - $ref: "#/components/schemas/multiChannelChannelListObjectBase" - properties: content: - $ref: '#/components/schemas/mmsMessageContent' + $ref: "#/components/schemas/mmsMessageContent" type: object required: - content multiChannelChannelListRBMResponseObject: allOf: - - $ref: '#/components/schemas/multiChannelChannelListRBMObject' - - $ref: '#/components/schemas/multiChannelChannelListOwnerObject' + - $ref: "#/components/schemas/multiChannelChannelListRBMObject" + - $ref: "#/components/schemas/multiChannelChannelListOwnerObject" example: owner: owner channel: RBM @@ -9117,22 +10068,22 @@ components: text: Hello world multiChannelChannelListSMSResponseObject: allOf: - - $ref: '#/components/schemas/multiChannelChannelListSMSObject' - - $ref: '#/components/schemas/multiChannelChannelListOwnerObject' + - $ref: "#/components/schemas/multiChannelChannelListSMSObject" + - $ref: "#/components/schemas/multiChannelChannelListOwnerObject" multiChannelChannelListMMSResponseObject: allOf: - - $ref: '#/components/schemas/multiChannelChannelListMMSObject' - - $ref: '#/components/schemas/multiChannelChannelListOwnerObject' + - $ref: "#/components/schemas/multiChannelChannelListMMSObject" + - $ref: "#/components/schemas/multiChannelChannelListOwnerObject" multiChannelChannelListRequestObject: anyOf: - - $ref: '#/components/schemas/multiChannelChannelListRBMObject' - - $ref: '#/components/schemas/multiChannelChannelListSMSObject' - - $ref: '#/components/schemas/multiChannelChannelListMMSObject' + - $ref: "#/components/schemas/multiChannelChannelListRBMObject" + - $ref: "#/components/schemas/multiChannelChannelListSMSObject" + - $ref: "#/components/schemas/multiChannelChannelListMMSObject" discriminator: mapping: - RBM: '#/components/schemas/multiChannelChannelListRBMObject' - SMS: '#/components/schemas/multiChannelChannelListSMSObject' - MMS: '#/components/schemas/multiChannelChannelListMMSObject' + RBM: "#/components/schemas/multiChannelChannelListRBMObject" + SMS: "#/components/schemas/multiChannelChannelListSMSObject" + MMS: "#/components/schemas/multiChannelChannelListMMSObject" propertyName: channel multiChannelChannelListOwnerObject: properties: @@ -9145,14 +10096,14 @@ components: type: object multiChannelChannelListResponseObject: anyOf: - - $ref: '#/components/schemas/multiChannelChannelListRBMResponseObject' - - $ref: '#/components/schemas/multiChannelChannelListSMSResponseObject' - - $ref: '#/components/schemas/multiChannelChannelListMMSResponseObject' + - $ref: "#/components/schemas/multiChannelChannelListRBMResponseObject" + - $ref: "#/components/schemas/multiChannelChannelListSMSResponseObject" + - $ref: "#/components/schemas/multiChannelChannelListMMSResponseObject" discriminator: mapping: - RBM: '#/components/schemas/multiChannelChannelListRBMResponseObject' - SMS: '#/components/schemas/multiChannelChannelListSMSResponseObject' - MMS: '#/components/schemas/multiChannelChannelListMMSResponseObject' + RBM: "#/components/schemas/multiChannelChannelListRBMResponseObject" + SMS: "#/components/schemas/multiChannelChannelListSMSResponseObject" + MMS: "#/components/schemas/multiChannelChannelListMMSResponseObject" propertyName: channel multiChannelMessageRequest: description: Multi-Channel Message Request @@ -9166,7 +10117,7 @@ components: \ the order they are listed. Once a message sends successfully, the others\ \ will be ignored." items: - $ref: '#/components/schemas/multiChannelChannelListRequestObject' + $ref: "#/components/schemas/multiChannelChannelListRequestObject" maxItems: 4 type: array tag: @@ -9176,7 +10127,7 @@ components: title: Tag type: string priority: - $ref: '#/components/schemas/priorityEnum' + $ref: "#/components/schemas/priorityEnum" expiration: description: "A string with the date/time value that the message will automatically\ \ expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z\ @@ -9319,7 +10270,7 @@ components: format: date-time type: string direction: - $ref: '#/components/schemas/messageDirectionEnum' + $ref: "#/components/schemas/messageDirectionEnum" to: description: "The destination phone number(s) of the message, in E164 format." example: @@ -9333,7 +10284,7 @@ components: \ the order they are listed. Once a message sends successfully, the others\ \ will be ignored." items: - $ref: '#/components/schemas/multiChannelChannelListResponseObject' + $ref: "#/components/schemas/multiChannelChannelListResponseObject" maxItems: 4 type: array tag: @@ -9343,7 +10294,7 @@ components: title: Tag type: string priority: - $ref: '#/components/schemas/priorityEnum' + $ref: "#/components/schemas/priorityEnum" expiration: description: "A string with the date/time value that the message will automatically\ \ expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z\ @@ -9364,7 +10315,7 @@ components: text: type: string media: - $ref: '#/components/schemas/rbmMessageContentFile' + $ref: "#/components/schemas/rbmMessageContentFile" type: object rbmSuggestionResponse: properties: @@ -9401,17 +10352,17 @@ components: - `inboundCallback` indicates an inbound MO message or a multichannel message client's response to a suggestion or location request. discriminator: mapping: - 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' - request-location-response: '#/components/schemas/inboundCallback' - suggestion-response: '#/components/schemas/inboundCallback' + 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" + request-location-response: "#/components/schemas/inboundCallback" + suggestion-response: "#/components/schemas/inboundCallback" propertyName: type oneOf: - - $ref: '#/components/schemas/statusCallback' - - $ref: '#/components/schemas/inboundCallback' + - $ref: "#/components/schemas/statusCallback" + - $ref: "#/components/schemas/inboundCallback" type: object statusCallback: description: Represents a status callback for an outbound MT SMS or MMS or RBM @@ -9428,7 +10379,7 @@ components: format: date-time type: string type: - $ref: '#/components/schemas/statusCallbackTypeEnum' + $ref: "#/components/schemas/statusCallbackTypeEnum" to: description: |- The destination phone number the message was sent to. @@ -9440,16 +10391,16 @@ components: example: Message delivered to carrier. type: string message: - $ref: '#/components/schemas/statusCallbackMessage' + $ref: "#/components/schemas/statusCallbackMessage" errorCode: description: "Optional error code, applicable only when type is `message-failed`." example: 4405 type: integer carrierName: - description: "The name of the Authorized Message Provider (AMP) that handled\ - \ this message. \nIn the US, this is the carrier that the message was\ - \ sent to.\nThis field is present only when this account feature has been\ - \ enabled." + 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 type: string required: @@ -9467,11 +10418,11 @@ components: format: date-time type: string type: - $ref: '#/components/schemas/inboundCallbackTypeEnum' + $ref: "#/components/schemas/inboundCallbackTypeEnum" to: - description: "The destination phone number the message was sent to. \nFor\ - \ inbound callbacks, this is the Bandwidth number or alphanumeric identifier\ - \ that received the message.\n" + 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" type: string description: @@ -9479,12 +10430,12 @@ components: example: Incoming message received type: string message: - $ref: '#/components/schemas/inboundCallbackMessage' + $ref: "#/components/schemas/inboundCallbackMessage" carrierName: - description: "The name of the Authorized Message Provider (AMP) that handled\ - \ this message. \nIn the US, this is the carrier that the message was\ - \ sent to.\nThis field is present only when this account feature has been\ - \ enabled." + 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 type: string required: @@ -9509,13 +10460,11 @@ components: example: message-delivered type: string inboundCallbackTypeEnum: - description: "The possible inbound callback types originating from MO messages\ - \ or multichannel message client responses:\n- `message-received` indicates\ - \ an MO message from a Bandwidth user's client to a Bandwidth number.\n- `request-location-response`\ - \ indicates a response to a location request sent by the Bandwidth user's\ - \ client after receiving an RBM message. \n- `suggestion-response` indicates\ - \ a response to a suggestion sent by the Bandwidth user's client after receiving\ - \ an RBM message." + 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. + - `request-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 - request-location-response @@ -9549,7 +10498,7 @@ components: example: 1 type: integer direction: - $ref: '#/components/schemas/messageDirectionEnum' + $ref: "#/components/schemas/messageDirectionEnum" to: description: The phone number recipients of the message. example: @@ -9582,9 +10531,9 @@ components: type: string type: array priority: - $ref: '#/components/schemas/priorityEnum' + $ref: "#/components/schemas/priorityEnum" channel: - $ref: '#/components/schemas/multiChannelMessageChannelEnum' + $ref: "#/components/schemas/multiChannelMessageChannelEnum" required: - applicationId - direction @@ -9597,14 +10546,14 @@ components: type: object inboundCallbackMessage: allOf: - - $ref: '#/components/schemas/statusCallbackMessage' + - $ref: "#/components/schemas/statusCallbackMessage" - properties: content: - $ref: '#/components/schemas/multiChannelMessageContent' + $ref: "#/components/schemas/multiChannelMessageContent" suggestionResponse: - $ref: '#/components/schemas/rbmSuggestionResponse' + $ref: "#/components/schemas/rbmSuggestionResponse" locationResponse: - $ref: '#/components/schemas/rbmLocationResponse' + $ref: "#/components/schemas/rbmLocationResponse" type: object required: - applicationId @@ -9733,10 +10682,10 @@ components: nullable: true type: boolean displayName: - description: "The caller display name to use when the call is created. \n\ - May not exceed 256 characters nor contain control characters such as new\ - \ lines.\nIf `privacy` is true, only the following values are valid: `Restricted`,\ - \ `Anonymous`, `Private`, or `Unavailable`." + 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`. example: John Doe maxLength: 256 nullable: true @@ -9768,7 +10717,7 @@ components: maxLength: 2048 type: string answerMethod: - $ref: '#/components/schemas/callbackMethodEnum' + $ref: "#/components/schemas/callbackMethodEnum" username: description: Basic auth username. example: mySecretUsername @@ -9793,7 +10742,7 @@ components: nullable: true type: string answerFallbackMethod: - $ref: '#/components/schemas/callbackMethodEnum' + $ref: "#/components/schemas/callbackMethodEnum" fallbackUsername: description: Basic auth username. example: mySecretUsername @@ -9815,7 +10764,7 @@ components: nullable: true type: string disconnectMethod: - $ref: '#/components/schemas/callbackMethodEnum' + $ref: "#/components/schemas/callbackMethodEnum" callTimeout: default: 30 description: |- @@ -9842,7 +10791,7 @@ components: nullable: true type: number machineDetection: - $ref: '#/components/schemas/machineDetectionConfiguration' + $ref: "#/components/schemas/machineDetectionConfiguration" priority: default: 5 description: |- @@ -9949,14 +10898,14 @@ components: nullable: true type: string answerMethod: - $ref: '#/components/schemas/callbackMethodEnum' + $ref: "#/components/schemas/callbackMethodEnum" answerUrl: description: URL to deliver the `answer` event webhook. example: https://myServer.example/bandwidth/webhooks/answer format: uri type: string answerFallbackMethod: - $ref: '#/components/schemas/callbackMethodEnum' + $ref: "#/components/schemas/callbackMethodEnum" answerFallbackUrl: description: Fallback URL to deliver the `answer` event webhook. example: https://myFallbackServer.example/bandwidth/webhooks/answer @@ -9964,7 +10913,7 @@ components: nullable: true type: string disconnectMethod: - $ref: '#/components/schemas/callbackMethodEnum' + $ref: "#/components/schemas/callbackMethodEnum" disconnectUrl: description: URL to deliver the `disconnect` event webhook. example: https://myServer.example/bandwidth/webhooks/disconnect @@ -10064,7 +11013,7 @@ components: example: "+19195554321" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" state: description: |- The current state of the call. Current possible values are @@ -10171,7 +11120,7 @@ components: updateCall: properties: state: - $ref: '#/components/schemas/callStateEnum' + $ref: "#/components/schemas/callStateEnum" redirectUrl: description: |- The URL to send the [Redirect](/docs/voice/bxml/redirect) event @@ -10185,7 +11134,7 @@ components: nullable: true type: string redirectMethod: - $ref: '#/components/schemas/redirectMethodEnum' + $ref: "#/components/schemas/redirectMethodEnum" username: description: Basic auth username. example: mySecretUsername @@ -10207,7 +11156,7 @@ components: nullable: true type: string redirectFallbackMethod: - $ref: '#/components/schemas/redirectMethodEnum' + $ref: "#/components/schemas/redirectMethodEnum" fallbackUsername: description: Basic auth username. example: mySecretUsername @@ -10239,7 +11188,7 @@ components: updateCallRecording: properties: state: - $ref: '#/components/schemas/recordingStateEnum' + $ref: "#/components/schemas/recordingStateEnum" required: - state type: object @@ -10331,7 +11280,7 @@ components: example: PT13.67S type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" channels: description: Always `1` for conference recordings; multi-channel recordings are not supported on conferences. @@ -10349,7 +11298,7 @@ components: format: date-time type: string fileFormat: - $ref: '#/components/schemas/fileFormatEnum' + $ref: "#/components/schemas/fileFormatEnum" status: description: "The current status of the process. For recording, current\ \ possible values are 'processing', 'partial', 'complete', 'deleted',\ @@ -10367,7 +11316,7 @@ components: nullable: true type: string transcription: - $ref: '#/components/schemas/recordingTranscriptionMetadata' + $ref: "#/components/schemas/recordingTranscriptionMetadata" recordingName: description: A name to identify this recording. example: my-recording-name @@ -10424,7 +11373,7 @@ components: nullable: true type: string conferenceEventMethod: - $ref: '#/components/schemas/callbackMethodEnum' + $ref: "#/components/schemas/callbackMethodEnum" tag: description: The custom string attached to the conference that will be sent with callbacks. @@ -10436,14 +11385,14 @@ components: A list of active members of the conference. Omitted if this is a response to the [Get Conferences endpoint](/apis/voice#tag/Conferences/operation/listConferences). items: - $ref: '#/components/schemas/conferenceMember' + $ref: "#/components/schemas/conferenceMember" nullable: true type: array type: object updateConference: properties: status: - $ref: '#/components/schemas/conferenceStateEnum' + $ref: "#/components/schemas/conferenceStateEnum" redirectUrl: description: |- The URL to send the [conferenceRedirect](/docs/voice/webhooks/conferenceRedirect) @@ -10454,7 +11403,7 @@ components: nullable: true type: string redirectMethod: - $ref: '#/components/schemas/redirectMethodEnum' + $ref: "#/components/schemas/redirectMethodEnum" username: description: Basic auth username. example: mySecretUsername @@ -10477,7 +11426,7 @@ components: nullable: true type: string redirectFallbackMethod: - $ref: '#/components/schemas/redirectMethodEnum' + $ref: "#/components/schemas/redirectMethodEnum" fallbackUsername: description: Basic auth username. example: mySecretUsername @@ -10630,7 +11579,7 @@ components: format: date-time type: string fileFormat: - $ref: '#/components/schemas/fileFormatEnum' + $ref: "#/components/schemas/fileFormatEnum" status: description: "The current status of the process. For recording, current\ \ possible values are 'processing', 'partial', 'complete', 'deleted',\ @@ -10660,7 +11609,7 @@ components: \ need more information." properties: mode: - $ref: '#/components/schemas/machineDetectionModeEnum' + $ref: "#/components/schemas/machineDetectionModeEnum" detectionTimeout: default: 15 description: |- @@ -10701,9 +11650,9 @@ components: nullable: true type: number machineSpeechEndThreshold: - description: "When an answering machine is detected, the amount of silence\ - \ (in seconds) before assuming the message has finished playing. \nIf\ - \ not provided it will default to the speechEndThreshold value." + 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 format: double nullable: true @@ -10727,7 +11676,7 @@ components: nullable: true type: string callbackMethod: - $ref: '#/components/schemas/callbackMethodEnum' + $ref: "#/components/schemas/callbackMethodEnum" username: description: Basic auth username. example: mySecretUsername @@ -10751,7 +11700,7 @@ components: nullable: true type: string fallbackMethod: - $ref: '#/components/schemas/callbackMethodEnum' + $ref: "#/components/schemas/callbackMethodEnum" fallbackUsername: description: Basic auth username. example: mySecretUsername @@ -10777,7 +11726,7 @@ components: format: uri type: string callbackMethod: - $ref: '#/components/schemas/callbackMethodEnum' + $ref: "#/components/schemas/callbackMethodEnum" username: description: Basic auth username. example: mySecretUsername @@ -10828,7 +11777,7 @@ components: properties: transcripts: items: - $ref: '#/components/schemas/transcription' + $ref: "#/components/schemas/transcription" type: array type: object callTranscriptionMetadataList: @@ -10837,7 +11786,7 @@ components: 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 items: - $ref: '#/components/schemas/callTranscriptionMetadata' + $ref: "#/components/schemas/callTranscriptionMetadata" type: array callTranscriptionMetadata: properties: @@ -10887,15 +11836,15 @@ components: transcript: Hello World! This is an example. confidence: 0.9 items: - $ref: '#/components/schemas/callTranscription' + $ref: "#/components/schemas/callTranscription" type: array type: object callTranscription: properties: detectedLanguage: - $ref: '#/components/schemas/callTranscriptionDetectedLanguageEnum' + $ref: "#/components/schemas/callTranscriptionDetectedLanguageEnum" track: - $ref: '#/components/schemas/callTranscriptionTrackEnum' + $ref: "#/components/schemas/callTranscriptionTrackEnum" transcript: description: The transcription itself. example: Hello World! This is an example. @@ -10995,7 +11944,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -11030,7 +11979,7 @@ components: nullable: true type: string machineDetectionResult: - $ref: '#/components/schemas/machineDetectionResult' + $ref: "#/components/schemas/machineDetectionResult" type: object bridgeCompleteCallback: description: "If the target call leaves the , then this callback is\ @@ -11074,7 +12023,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -11168,7 +12117,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -11491,7 +12440,7 @@ components: example: PT13.67S type: string fileFormat: - $ref: '#/components/schemas/fileFormatEnum' + $ref: "#/components/schemas/fileFormatEnum" mediaUrl: description: The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. @@ -11557,7 +12506,7 @@ components: example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callUrl: description: The URL of the call associated with the event. example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -11654,7 +12603,7 @@ components: example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" digit: description: The digit collected in the call. example: "2" @@ -11744,7 +12693,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -11787,7 +12736,7 @@ components: terminatingDigit: description: (optional) The digit the user pressed to end the gather. Empty string value if no terminating digit was pressed. - example: '#' + example: "#" type: string transferCallerId: description: "The phone number used as the from field of the B-leg call,\ @@ -11847,7 +12796,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -11863,9 +12812,9 @@ components: format: date-time type: string diversion: - $ref: '#/components/schemas/diversion' + $ref: "#/components/schemas/diversion" stirShaken: - $ref: '#/components/schemas/stirShaken' + $ref: "#/components/schemas/stirShaken" uui: description: "The value of the `User-To-User` header to send within the\ \ initial `INVITE`. Must include the encoding parameter as specified in\ @@ -11916,7 +12865,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -11951,7 +12900,7 @@ components: nullable: true type: string machineDetectionResult: - $ref: '#/components/schemas/machineDetectionResult' + $ref: "#/components/schemas/machineDetectionResult" type: object recordingCompleteCallback: description: "The Record Complete event is sent after a verb has executed\ @@ -11994,7 +12943,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -12049,7 +12998,7 @@ components: example: PT13.67S type: string fileFormat: - $ref: '#/components/schemas/fileFormatEnum' + $ref: "#/components/schemas/fileFormatEnum" channels: description: Always `1` for conference recordings; multi-channel recordings are not supported on conferences. @@ -12112,7 +13061,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -12161,7 +13110,7 @@ components: example: PT13.67S type: string fileFormat: - $ref: '#/components/schemas/fileFormatEnum' + $ref: "#/components/schemas/fileFormatEnum" channels: description: Always `1` for conference recordings; multi-channel recordings are not supported on conferences. @@ -12233,7 +13182,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -12323,7 +13272,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -12372,7 +13321,7 @@ components: example: PT13.67S type: string fileFormat: - $ref: '#/components/schemas/fileFormatEnum' + $ref: "#/components/schemas/fileFormatEnum" tag: description: "(optional) The tag specified on call creation. If no tag was\ \ specified or it was previously cleared, this field will not be present." @@ -12380,7 +13329,7 @@ components: nullable: true type: string transcription: - $ref: '#/components/schemas/transcription' + $ref: "#/components/schemas/transcription" transferCallerId: description: "The phone number used as the from field of the B-leg call,\ \ in E.164 format (e.g. +15555555555)." @@ -12436,7 +13385,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -12523,7 +13472,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -12629,7 +13578,7 @@ components: example: "+15555555555" type: string direction: - $ref: '#/components/schemas/callDirectionEnum' + $ref: "#/components/schemas/callDirectionEnum" callId: description: The call id associated with the event. example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 @@ -12773,7 +13722,7 @@ components: terminatingDigit: description: (optional) The digit the user pressed to end the gather. Empty string value if no terminating digit was pressed. - example: '#' + example: "#" type: string startTime: description: "Time the call was started, in ISO 8601 format." @@ -13192,7 +14141,7 @@ components: example: NumberInventory type: string meta: - $ref: '#/components/schemas/lookupErrorSchema_meta' + $ref: "#/components/schemas/lookupErrorSchema_meta" type: object syncLookupRequest: properties: @@ -13272,13 +14221,13 @@ components: links: example: [] items: - $ref: '#/components/schemas/linkSchema' + $ref: "#/components/schemas/linkSchema" type: array data: - $ref: '#/components/schemas/createSyncLookupResponse_data' + $ref: "#/components/schemas/createSyncLookupResponse_data" errors: items: - $ref: '#/components/schemas/lookupErrorSchema' + $ref: "#/components/schemas/lookupErrorSchema" type: array type: object createAsyncBulkLookupResponse: @@ -13316,13 +14265,13 @@ components: links: description: Links for pagination (if applicable) items: - $ref: '#/components/schemas/linkSchema' + $ref: "#/components/schemas/linkSchema" type: array data: - $ref: '#/components/schemas/createAsyncBulkLookupResponse_data' + $ref: "#/components/schemas/createAsyncBulkLookupResponse_data" errors: items: - $ref: '#/components/schemas/lookupErrorSchema' + $ref: "#/components/schemas/lookupErrorSchema" type: array type: object getAsyncBulkLookupResponse: @@ -13377,13 +14326,13 @@ components: links: example: [] items: - $ref: '#/components/schemas/linkSchema' + $ref: "#/components/schemas/linkSchema" type: array data: - $ref: '#/components/schemas/getAsyncBulkLookupResponse_data' + $ref: "#/components/schemas/getAsyncBulkLookupResponse_data" errors: items: - $ref: '#/components/schemas/lookupErrorSchema' + $ref: "#/components/schemas/lookupErrorSchema" type: array type: object lookupErrorResponse: @@ -13413,14 +14362,14 @@ components: links: example: [] items: - $ref: '#/components/schemas/linkSchema' + $ref: "#/components/schemas/linkSchema" type: array data: description: The phone number lookup response data type: object errors: items: - $ref: '#/components/schemas/lookupErrorSchema' + $ref: "#/components/schemas/lookupErrorSchema" type: array type: object lookupResult: @@ -13443,7 +14392,7 @@ components: example: "+10072904498" type: string lineType: - $ref: '#/components/schemas/lineTypeEnum' + $ref: "#/components/schemas/lineTypeEnum" messagingProvider: description: The messaging service provider of the telephone number. example: Verizon Wireless @@ -13469,22 +14418,22 @@ components: format: date-time-local type: string deactivationEvent: - $ref: '#/components/schemas/deactivationEventEnum' + $ref: "#/components/schemas/deactivationEventEnum" latestMessageDeliveryStatus: - $ref: '#/components/schemas/latestMessageDeliveryStatusEnum' + $ref: "#/components/schemas/latestMessageDeliveryStatusEnum" initialMessageDeliveryStatusDate: - description: "[DNI-Only](#section/DNI-Only). The date the phone number entered\ - \ the status described in `latestMessageDeliveryStatus`. \nThink of this\ - \ as the \"start time\" for that status.\nValue resets every time the\ - \ `latestMessageDeliveryStatus` changes." + 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 format: date type: string latestMessageDeliveryStatusDate: - description: "[DNI-Only](#section/DNI-Only). The date bandwidth last received\ - \ delivery status information for this phone number. \nUse this field\ - \ to understand how up-to-date the `latestMessageDeliveryStatus` is.\n\ - Value resets every time the `latestMessageDeliveryStatus` changes." + 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 format: date type: string @@ -13641,9 +14590,9 @@ components: verificationRequest: properties: businessAddress: - $ref: '#/components/schemas/address' + $ref: "#/components/schemas/address" businessContact: - $ref: '#/components/schemas/contact' + $ref: "#/components/schemas/contact" messageVolume: description: Estimated monthly volume of messages from the toll-free number. example: 10000 @@ -13652,7 +14601,7 @@ components: type: integer phoneNumbers: items: - $ref: '#/components/schemas/tfPhoneNumber' + $ref: "#/components/schemas/tfPhoneNumber" maxItems: 10 minItems: 1 type: array @@ -13677,7 +14626,7 @@ components: nullable: false type: string optInWorkflow: - $ref: '#/components/schemas/optInWorkflow' + $ref: "#/components/schemas/optInWorkflow" additionalInformation: description: Any additional information. example: Any additional information @@ -13715,9 +14664,9 @@ components: nullable: true type: string businessRegistrationType: - $ref: '#/components/schemas/businessRegistrationTypeEnum' + $ref: "#/components/schemas/businessRegistrationTypeEnum" businessEntityType: - $ref: '#/components/schemas/businessEntityTypeEnum' + $ref: "#/components/schemas/businessEntityTypeEnum" helpMessageResponse: description: A message that gets sent to users requesting help. example: Please contact support for assistance. @@ -13741,9 +14690,9 @@ components: verificationUpdateRequest: properties: businessAddress: - $ref: '#/components/schemas/address' + $ref: "#/components/schemas/address" businessContact: - $ref: '#/components/schemas/contact' + $ref: "#/components/schemas/contact" messageVolume: description: Estimated monthly volume of messages from the toll-free number. example: 10000 @@ -13771,7 +14720,7 @@ components: nullable: false type: string optInWorkflow: - $ref: '#/components/schemas/optInWorkflow' + $ref: "#/components/schemas/optInWorkflow" additionalInformation: description: Any additional information. example: Any additional information @@ -13809,9 +14758,9 @@ components: nullable: true type: string businessRegistrationType: - $ref: '#/components/schemas/businessRegistrationTypeEnum' + $ref: "#/components/schemas/businessRegistrationTypeEnum" businessEntityType: - $ref: '#/components/schemas/businessEntityTypeEnum' + $ref: "#/components/schemas/businessEntityTypeEnum" helpMessageResponse: description: A message that gets sent to users requesting help. example: Please contact support for assistance. @@ -13848,7 +14797,7 @@ components: webhookSubscriptionRequestSchema: properties: basicAuthentication: - $ref: '#/components/schemas/tfvBasicAuthentication' + $ref: "#/components/schemas/tfvBasicAuthentication" callbackUrl: description: "Callback URL to receive status updates from Bandwidth. When\ \ a webhook subscription is registered with Bandwidth under a given account\ @@ -13929,7 +14878,7 @@ components: reason: Reason B resubmitAllowed: true items: - $ref: '#/components/schemas/additionalDenialReason' + $ref: "#/components/schemas/additionalDenialReason" type: array declineReasonDescription: description: Explanation for why a verification request was declined. @@ -13990,7 +14939,7 @@ components: pattern: "^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$" type: string status: - $ref: '#/components/schemas/tfvCallbackStatusEnum' + $ref: "#/components/schemas/tfvCallbackStatusEnum" internalTicketNumber: description: Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. @@ -14013,7 +14962,7 @@ components: pattern: "^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$" type: string status: - $ref: '#/components/schemas/tfvCallbackStatusEnum' + $ref: "#/components/schemas/tfvCallbackStatusEnum" internalTicketNumber: description: Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. @@ -14034,7 +14983,7 @@ components: tfvSubmissionWrapper: properties: submission: - $ref: '#/components/schemas/verificationUpdateRequest' + $ref: "#/components/schemas/verificationUpdateRequest" type: object address: example: @@ -14292,14 +15241,14 @@ components: description: description properties: links: - $ref: '#/components/schemas/linksObject' + $ref: "#/components/schemas/linksObject" errors: items: - $ref: '#/components/schemas/error' + $ref: "#/components/schemas/error" type: array data: items: - $ref: '#/components/schemas/webhookSubscription' + $ref: "#/components/schemas/webhookSubscription" type: array required: - data @@ -14341,7 +15290,7 @@ components: type: string telephoneNumbers: items: - $ref: '#/components/schemas/telephoneNumber' + $ref: "#/components/schemas/telephoneNumber" type: array type: object telephoneNumber: @@ -14392,9 +15341,9 @@ components: b([-a-zA-Z0-9@:%_\\+.~#()?&//=]*)" type: string type: - $ref: '#/components/schemas/webhookSubscriptionTypeEnum' + $ref: "#/components/schemas/webhookSubscriptionTypeEnum" basicAuthentication: - $ref: '#/components/schemas/webhookSubscription_basicAuthentication' + $ref: "#/components/schemas/webhookSubscription_basicAuthentication" createdDate: example: 2023-05-15T13:56:39.965Z format: date-time @@ -14495,7 +15444,7 @@ components: pattern: "^\\+1(800|833|844|855|866|877|888)[2-9]\\d{6}$" type: string status: - $ref: '#/components/schemas/tfvStatusEnum' + $ref: "#/components/schemas/tfvStatusEnum" internalTicketNumber: description: Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all @@ -14525,7 +15474,7 @@ components: format: date-time type: string submission: - $ref: '#/components/schemas/tfvSubmissionInfo' + $ref: "#/components/schemas/tfvSubmissionInfo" blocked: description: Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked. @@ -14572,9 +15521,9 @@ components: useCaseSummary: Text summarizing the use case for the toll-free number properties: businessAddress: - $ref: '#/components/schemas/address' + $ref: "#/components/schemas/address" businessContact: - $ref: '#/components/schemas/contact' + $ref: "#/components/schemas/contact" messageVolume: description: Estimated monthly volume of messages from the toll-free number. example: 10000 @@ -14602,7 +15551,7 @@ components: nullable: false type: string optInWorkflow: - $ref: '#/components/schemas/optInWorkflow' + $ref: "#/components/schemas/optInWorkflow" additionalInformation: description: Any additional information. example: Any additional information @@ -14640,9 +15589,9 @@ components: nullable: true type: string businessRegistrationType: - $ref: '#/components/schemas/businessRegistrationTypeEnum' + $ref: "#/components/schemas/businessRegistrationTypeEnum" businessEntityType: - $ref: '#/components/schemas/businessEntityTypeEnum' + $ref: "#/components/schemas/businessEntityTypeEnum" type: object tfvStatusEnum: enum: @@ -14660,21 +15609,489 @@ components: nullable: true pattern: "^[ -~]{16,64}$" type: string + endpointId: + description: The unique ID of the endpoint. + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + endpointStatusEnum: + enum: + - CONNECTED + - DISCONNECTED + type: string + deviceStatusEnum: + enum: + - CONNECTED + - DISCONNECTED + type: string + endpointTypeEnum: + enum: + - WEBRTC + type: string + endpointDirectionEnum: + enum: + - INBOUND + - OUTBOUND + - BIDIRECTIONAL + type: string + sipCredentials: + properties: + username: + description: The username for the SIP connection. + example: username + type: string + password: + description: The password for the SIP connection. + example: password + type: string + type: object + sipConnectionMetadata: + properties: + ipAddress: + description: The IP address of the SIP connection. + example: 192.168.0.0 + format: ipv4 + type: string + port: + description: The port of the SIP connection. + example: 5060 + type: integer + credentials: + $ref: "#/components/schemas/sipCredentials" + uuiHeader: + description: The User-to-User Information header for the SIP connection. + example: my-uui-header + type: string + title: SIP Connection + type: object + webRtcConnectionMetadata: + title: WebRTC Connection + type: object + endpointToken: + description: The json web token specific to the endpoint. Used to authenticate + the client with the media gateway. + example: xxxxx.yyyyy.zzzzz + type: string + endpointTag: + description: A tag for the endpoint. + example: my-tag + maximum: 1024 + type: string + device: + example: + creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + properties: + deviceId: + description: The unique ID of the device. + example: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + deviceName: + description: The name of the device. + example: David's iPhone + maximum: 1024 + type: string + status: + $ref: "#/components/schemas/deviceStatusEnum" + creationTimestamp: + description: The time the device was created. In ISO-8601 format. + example: 2021-01-01T00:00:00Z + format: date-time + type: string + required: + - creationTimestamp + - deviceId + - status + type: object + endpoints: + example: + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + properties: + endpointId: + description: The unique ID of the endpoint. + example: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + type: + $ref: "#/components/schemas/endpointTypeEnum" + status: + $ref: "#/components/schemas/endpointStatusEnum" + creationTimestamp: + description: The time the endpoint was created. In ISO-8601 format. + example: 2021-01-01T00:00:00Z + format: date-time + type: string + expirationTimestamp: + description: The time the endpoint token will expire. In ISO-8601 format. + Tokens last 24 hours. + example: 2021-01-02T00:00:00Z + format: date-time + type: string + tag: + description: A tag for the endpoint. + example: my-tag + maximum: 1024 + type: string + required: + - creationTimestamp + - endpointId + - expirationTimestamp + - status + - type + type: object + endpoint: + allOf: + - $ref: "#/components/schemas/endpoints" + - properties: + devices: + items: + $ref: "#/components/schemas/device" + type: array + type: object + example: + devices: + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + type: object + createWebRtcConnectionRequest: + allOf: + - $ref: "#/components/schemas/createEndpointRequestBase" + - properties: + connectionMetadata: + $ref: "#/components/schemas/webRtcConnectionMetadata" + type: object + createEndpointRequestBase: + properties: + type: + $ref: "#/components/schemas/endpointTypeEnum" + direction: + $ref: "#/components/schemas/endpointDirectionEnum" + eventCallbackUrl: + description: The URL to send event callbacks to. + example: https://myapp.com/callback + format: uri + type: string + eventFallbackUrl: + description: The URL to send event fallbacks to. + example: https://fallback.myapp.com/callback + format: uri + type: string + tag: + description: A tag for the endpoint. + example: my-tag + maximum: 1024 + type: string + required: + - direction + - type + type: object + createEndpointRequest: + $ref: "#/components/schemas/createWebRtcConnectionRequest" + createEndpointResponseObject: + allOf: + - $ref: "#/components/schemas/endpoint" + - properties: + token: + $ref: "#/components/schemas/endpointToken" + required: + - token + type: object + example: + devices: + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + token: xxxxx.yyyyy.zzzzz + endpointEventTypeEnum: + enum: + - DEVICE_CONNECTED + - DEVICE_DISCONNECTED + type: string + endpointEvent: + allOf: + - $ref: "#/components/schemas/endpoints" + - properties: + eventTime: + description: The time the event occurred. In ISO-8601 format. + example: 2021-01-01T00:00:00Z + format: date-time + type: string + eventType: + $ref: "#/components/schemas/endpointEventTypeEnum" + device: + $ref: "#/components/schemas/device" + required: + - eventTime + - eventType + type: object + description: An event that occurred on an endpoint. + page: + example: + pageNumber: 0 + totalPages: 10 + pageSize: 10 + totalElements: 100 + properties: + pageSize: + description: The number of items per page. + example: 10 + minimum: 0 + type: integer + totalElements: + description: The total number of items. + example: 100 + minimum: 0 + type: integer + totalPages: + description: The total number of pages. + example: 10 + minimum: 0 + type: integer + pageNumber: + description: The current page number. + example: 0 + minimum: 0 + type: integer + required: + - pageSize + type: object + listEndpointsResponse: + example: + data: + - endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + - endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + links: + - rel: rel + href: href + - rel: rel + href: href + page: + pageNumber: 0 + totalPages: 10 + pageSize: 10 + totalElements: 100 + errors: + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + properties: + links: + items: + $ref: "#/components/schemas/link" + type: array + page: + $ref: "#/components/schemas/page" + data: + items: + $ref: "#/components/schemas/endpoints" + type: array + errors: + items: + $ref: "#/components/schemas/error" + type: array + required: + - data + - errors + - links + type: object + endpointResponse: + example: + data: + devices: + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + links: + - rel: rel + href: href + - rel: rel + href: href + errors: + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + properties: + links: + items: + $ref: "#/components/schemas/link" + type: array + data: + $ref: "#/components/schemas/endpoint" + errors: + items: + $ref: "#/components/schemas/error" + type: array + required: + - data + - errors + - links + type: object + createEndpointResponse: + example: + data: + devices: + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + - creationTimestamp: 2021-01-01T00:00:00Z + deviceId: d-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + deviceName: David's iPhone + status: CONNECTED + endpointId: e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + creationTimestamp: 2021-01-01T00:00:00Z + expirationTimestamp: 2021-01-02T00:00:00Z + tag: my-tag + type: WEBRTC + status: CONNECTED + token: xxxxx.yyyyy.zzzzz + links: + - rel: rel + href: href + - rel: rel + href: href + errors: + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + properties: + links: + items: + $ref: "#/components/schemas/link" + type: array + data: + $ref: "#/components/schemas/createEndpointResponseObject" + errors: + items: + $ref: "#/components/schemas/error" + type: array + required: + - data + - errors + - links + type: object + errorResponse: + example: + data: "{}" + links: + - rel: rel + href: href + - rel: rel + href: href + errors: + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + - code: 0 + telephoneNumbers: + - telephoneNumber: telephoneNumber + - telephoneNumber: telephoneNumber + description: description + properties: + links: + items: + $ref: "#/components/schemas/link" + type: array + data: + additionalProperties: false + nullable: true + type: object + errors: + items: + $ref: "#/components/schemas/error" + type: array + required: + - data + - errors + - links + type: object rbmCardContent_media: allOf: - - $ref: '#/components/schemas/rbmMessageContentFile' + - $ref: "#/components/schemas/rbmMessageContentFile" - properties: height: - $ref: '#/components/schemas/rbmMediaHeightEnum' + $ref: "#/components/schemas/rbmMediaHeightEnum" type: object required: - height multiChannelChannelListRBMObject_allOf_content: description: The content of the message. oneOf: - - $ref: '#/components/schemas/rbmMessageContentText' - - $ref: '#/components/schemas/rbmMessageMedia' - - $ref: '#/components/schemas/rbmMessageContentRichCard' + - $ref: "#/components/schemas/rbmMessageContentText" + - $ref: "#/components/schemas/rbmMessageMedia" + - $ref: "#/components/schemas/rbmMessageContentRichCard" lookupErrorSchema_meta: example: code: 1001 @@ -14735,12 +16152,12 @@ components: format: uuid type: string status: - $ref: '#/components/schemas/completedLookupStatusEnum' + $ref: "#/components/schemas/completedLookupStatusEnum" results: description: The carrier information results for the specified telephone numbers. items: - $ref: '#/components/schemas/lookupResult' + $ref: "#/components/schemas/lookupResult" type: array type: object createAsyncBulkLookupResponse_data: @@ -14755,7 +16172,7 @@ components: format: uuid type: string status: - $ref: '#/components/schemas/inProgressLookupStatusEnum' + $ref: "#/components/schemas/inProgressLookupStatusEnum" type: object getAsyncBulkLookupResponse_data: description: The phone number lookup response data @@ -14792,12 +16209,12 @@ components: format: uuid type: string status: - $ref: '#/components/schemas/inProgressLookupStatusEnum' + $ref: "#/components/schemas/inProgressLookupStatusEnum" results: description: The carrier information results for the specified telephone number. items: - $ref: '#/components/schemas/lookupResult' + $ref: "#/components/schemas/lookupResult" type: array type: object webhookSubscription_basicAuthentication: diff --git a/bandwidth.yml b/bandwidth.yml index d7c32953..8b9998df 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -22,6 +22,7 @@ tags: - name: MFA - name: Phone Number Lookup - name: Toll-Free Verification + - name: Endpoints paths: /users/{accountId}/media: get: @@ -1682,6 +1683,165 @@ paths: '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/accountId2' + - $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/accountId2' + 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/accountId2' + - $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/accountId2' + - $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/accountId2' + - $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: @@ -1976,7 +2136,7 @@ components: type: string description: >- The name of the Authorized Message Provider (AMP) that handled this - message. + message. In the US, this is the carrier that the message was sent to. @@ -2063,7 +2223,7 @@ components: 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. + 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 -, @@ -2385,7 +2545,7 @@ components: - `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. + option is used by default. - `WEBVIEW` Opens the URL in an in-app WebView. enum: @@ -2398,7 +2558,7 @@ components: Defines the layout of the WebView on a mobile device. It must be defined when application is set to `WEBVIEW` - - `FULL` WebView takes the full screen. + - `FULL` WebView takes the full screen. - `HALF` WebView takes half of the screen. @@ -2799,7 +2959,7 @@ components: to: type: string description: > - The destination phone number the message was sent 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. @@ -2850,7 +3010,7 @@ components: client to a Bandwidth number. - `request-location-response` indicates a response to a location request - sent by the Bandwidth user's client after receiving an RBM message. + 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. @@ -3089,7 +3249,7 @@ components: nullable: true type: string description: >- - The caller display name to use when the call is created. + The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. @@ -4026,7 +4186,7 @@ components: format: double description: >- When an answering machine is detected, the amount of silence (in - seconds) before assuming the message has finished playing. + seconds) before assuming the message has finished playing. If not provided it will default to the speechEndThreshold value. example: 5 @@ -5729,7 +5889,7 @@ components: format: date description: >- [DNI-Only](#section/DNI-Only). The date the phone number entered the - status described in `latestMessageDeliveryStatus`. + status described in `latestMessageDeliveryStatus`. Think of this as the "start time" for that status. @@ -5740,7 +5900,7 @@ components: format: date description: >- [DNI-Only](#section/DNI-Only). The date bandwidth last received - delivery status information for this phone number. + delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. @@ -6520,6 +6680,303 @@ components: nullable: true pattern: ^[ -~]{16,64}$ type: string + 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' + createEndpointResponseObject: + 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 + 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 + listEndpointsResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + page: + $ref: '#/components/schemas/page' + data: + type: array + items: + $ref: '#/components/schemas/endpoints' + errors: + type: array + items: + $ref: '#/components/schemas/error' + required: + - links + - data + - errors + endpointResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + data: + $ref: '#/components/schemas/endpoint' + errors: + type: array + items: + $ref: '#/components/schemas/error' + required: + - links + - data + - errors + createEndpointResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + data: + $ref: '#/components/schemas/createEndpointResponseObject' + errors: + type: array + items: + $ref: '#/components/schemas/error' + required: + - links + - data + - errors + errorResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + data: + type: object + nullable: true + additionalProperties: false + errors: + type: array + items: + $ref: '#/components/schemas/error' + required: + - links + - data + - errors responses: createMessageResponse: description: Accepted @@ -7171,6 +7628,105 @@ components: example: description: Service Unavailable Error. type: Service Unavailable + 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/errorResponse' + examples: + badRequestErrorExample: + $ref: '#/components/examples/badRequestErrorExample' + unauthorizedErrorResponse: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/unauthorizedErrorExample' + forbiddenErrorResponse: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + forbiddenErrorExample: + $ref: '#/components/examples/forbiddenErrorExample' + notFoundErrorResponse: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + notFoundErrorExample: + $ref: '#/components/examples/notFoundErrorExample' + methodNotAllowedErrorResponse: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + methodNotAllowedErrorExample: + $ref: '#/components/examples/methodNotAllowedErrorExample' + unsupportedMediaTypeErrorResponse: + description: Unsupported Media Type + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + unsuppotedMediaTypeErrorExample: + $ref: '#/components/examples/unsupportedMediaTypeErrorExample' + tooManyRequestsErrorResponse: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/tooManyRequestsErrorExample' + serviceUnavailableErrorResponse: + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/errorResponse' + examples: + serviceUnavailableErrorExample: + $ref: '#/components/examples/serviceUnavailableErrorExample' parameters: accountId: in: path @@ -7670,6 +8226,53 @@ components: type: string description: Webhook subscription ID example: 7bt57JcsVYJrN9K1OcV1Nu + accountId2: + name: accountId + in: path + required: true + schema: + type: string + example: '5500123' + description: Your Bandwidth Account ID. + 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. @@ -8094,6 +8697,205 @@ components: 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: + - id: 59512d87-7a92-4040-8e4a-78fb772019b9 + type: too_many_requests + description: The client has sent too many requests in a given amount of time. + code: '429' + 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: @@ -8449,6 +9251,30 @@ components: 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 @@ -8475,12 +9301,12 @@ components: required: true description: >-

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

The payload type will be one of message-received, suggestion-response, or @@ -8582,3 +9408,17 @@ components: $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/docs/EndpointsApi.md b/docs/EndpointsApi.md new file mode 100644 index 00000000..b9e12082 --- /dev/null +++ b/docs/EndpointsApi.md @@ -0,0 +1,241 @@ +# Bandwidth.Standard.Api.EndpointsApi + +All URIs are relative to *http://localhost* + +| 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** +> CreateEndpointResponse CreateEndpoint (string accountId, CreateWebRtcConnectionRequest body) + +Create Endpoint + +Creates a new Endpoint for the specified account. + + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **accountId** | **string** | Your Bandwidth Account ID. | | +| **body** | **CreateWebRtcConnectionRequest** | | | + +### Return type + +[**CreateEndpointResponse**](CreateEndpointResponse.md) + +### Authorization + +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Service Unavailable | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + + +# **DeleteEndpoint** +> void DeleteEndpoint (string accountId, string endpointId) + +Delete Endpoint + +Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **accountId** | **string** | Your Bandwidth Account ID. | | +| **endpointId** | **string** | BRTC Endpoint ID. | | + +### 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Service Unavailable | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + + +# **GetEndpoint** +> EndpointResponse GetEndpoint (string accountId, string endpointId) + +Get Endpoint + +Returns information about the specified endpoint. + + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **accountId** | **string** | Your Bandwidth Account ID. | | +| **endpointId** | **string** | BRTC Endpoint ID. | | + +### Return type + +[**EndpointResponse**](EndpointResponse.md) + +### Authorization + +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Service Unavailable | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + + +# **ListEndpoints** +> ListEndpointsResponse ListEndpoints (string accountId, EndpointTypeEnum type = null, EndpointStatusEnum status = null, string afterCursor = null, int limit = null) + +List Endpoints + +Returns a list of endpoints associated with the specified account. + + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **accountId** | **string** | Your Bandwidth Account ID. | | +| **type** | **EndpointTypeEnum** | The type of endpoint. | [optional] | +| **status** | **EndpointStatusEnum** | The status of the endpoint. | [optional] | +| **afterCursor** | **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] | + +### Return type + +[**ListEndpointsResponse**](ListEndpointsResponse.md) + +### Authorization + +[Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Service Unavailable | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + + +# **UpdateEndpointBxml** +> void UpdateEndpointBxml (string accountId, string endpointId, string body) + +Update Endpoint BXML + +Updates the BXML for the specified endpoint. + + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **accountId** | **string** | Your Bandwidth Account ID. | | +| **endpointId** | **string** | BRTC Endpoint ID. | | +| **body** | **string** | | | + +### 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Service Unavailable | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/docs/scripts/git_push.ps1 b/docs/scripts/git_push.ps1 new file mode 100644 index 00000000..73ed35c2 --- /dev/null +++ b/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/docs/scripts/git_push.sh b/docs/scripts/git_push.sh new file mode 100644 index 00000000..88210492 --- /dev/null +++ b/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/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_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +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 + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/src/Bandwidth.Standard/Api/EndpointsApi.cs b/src/Bandwidth.Standard/Api/EndpointsApi.cs new file mode 100644 index 00000000..8922259d --- /dev/null +++ b/src/Bandwidth.Standard/Api/EndpointsApi.cs @@ -0,0 +1,3489 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Bandwidth.Standard.Client; +using Bandwidth.Standard.Model; + +namespace Bandwidth.Standard.Api +{ + ///

+ /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IEndpointsApi : IApi + { + /// + /// The class containing the events + /// + EndpointsApiEvents Events { get; } + + /// + /// Create Endpoint + /// + /// + /// Creates a new Endpoint for the specified account. + /// + /// Thrown when fails to make API call + /// Your Bandwidth Account ID. + /// + /// Cancellation Token to cancel the request. + /// <> + Task CreateEndpointAsync(string accountId, CreateWebRtcConnectionRequest body, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create Endpoint + /// + /// + /// Creates a new Endpoint for the specified account. + /// + /// Your Bandwidth Account ID. + /// + /// Cancellation Token to cancel the request. + /// <> + Task CreateEndpointOrDefaultAsync(string accountId, CreateWebRtcConnectionRequest body, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete Endpoint + /// + /// + /// Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + /// + /// Thrown when fails to make API call + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// Cancellation Token to cancel the request. + /// <> + Task DeleteEndpointAsync(string accountId, string endpointId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete Endpoint + /// + /// + /// Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + /// + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// Cancellation Token to cancel the request. + /// <> + Task DeleteEndpointOrDefaultAsync(string accountId, string endpointId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Get Endpoint + /// + /// + /// Returns information about the specified endpoint. + /// + /// Thrown when fails to make API call + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// Cancellation Token to cancel the request. + /// <> + Task GetEndpointAsync(string accountId, string endpointId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Get Endpoint + /// + /// + /// Returns information about the specified endpoint. + /// + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// Cancellation Token to cancel the request. + /// <> + Task GetEndpointOrDefaultAsync(string accountId, string endpointId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// List Endpoints + /// + /// + /// Returns a list of endpoints associated with the specified account. + /// + /// Thrown when fails to make API call + /// Your Bandwidth Account ID. + /// The type of endpoint. (optional) + /// The status of the endpoint. (optional) + /// The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + /// The maximum number of endpoints to return in the response. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// <> + Task ListEndpointsAsync(string accountId, Option type = default, Option status = default, Option afterCursor = default, Option limit = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// List Endpoints + /// + /// + /// Returns a list of endpoints associated with the specified account. + /// + /// Your Bandwidth Account ID. + /// The type of endpoint. (optional) + /// The status of the endpoint. (optional) + /// The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + /// The maximum number of endpoints to return in the response. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// <> + Task ListEndpointsOrDefaultAsync(string accountId, Option type = default, Option status = default, Option afterCursor = default, Option limit = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Update Endpoint BXML + /// + /// + /// Updates the BXML for the specified endpoint. + /// + /// Thrown when fails to make API call + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// + /// Cancellation Token to cancel the request. + /// <> + Task UpdateEndpointBxmlAsync(string accountId, string endpointId, string body, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Update Endpoint BXML + /// + /// + /// Updates the BXML for the specified endpoint. + /// + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// + /// Cancellation Token to cancel the request. + /// <> + Task UpdateEndpointBxmlOrDefaultAsync(string accountId, string endpointId, string body, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ICreateEndpointApiResponse : Bandwidth.Standard.Client.IApiResponse, ICreated, IBadRequest, IUnauthorized, IForbidden, INotFound, IMethodNotAllowed, IUnsupportedMediaType, ITooManyRequests, IInternalServerError + { + /// + /// Returns true if the response is 201 Created + /// + /// + bool IsCreated { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 401 Unauthorized + /// + /// + bool IsUnauthorized { get; } + + /// + /// Returns true if the response is 403 Forbidden + /// + /// + bool IsForbidden { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + + /// + /// Returns true if the response is 415 UnsupportedMediaType + /// + /// + bool IsUnsupportedMediaType { get; } + + /// + /// Returns true if the response is 429 TooManyRequests + /// + /// + bool IsTooManyRequests { get; } + + /// + /// Returns true if the response is 500 InternalServerError + /// + /// + bool IsInternalServerError { get; } + } + + /// + /// The + /// + public interface IDeleteEndpointApiResponse : Bandwidth.Standard.Client.IApiResponse, IBadRequest, IUnauthorized, IForbidden, INotFound, IMethodNotAllowed, IUnsupportedMediaType, ITooManyRequests, IInternalServerError + { + /// + /// Returns true if the response is 204 NoContent + /// + /// + bool IsNoContent { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 401 Unauthorized + /// + /// + bool IsUnauthorized { get; } + + /// + /// Returns true if the response is 403 Forbidden + /// + /// + bool IsForbidden { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + + /// + /// Returns true if the response is 415 UnsupportedMediaType + /// + /// + bool IsUnsupportedMediaType { get; } + + /// + /// Returns true if the response is 429 TooManyRequests + /// + /// + bool IsTooManyRequests { get; } + + /// + /// Returns true if the response is 500 InternalServerError + /// + /// + bool IsInternalServerError { get; } + } + + /// + /// The + /// + public interface IGetEndpointApiResponse : Bandwidth.Standard.Client.IApiResponse, IOk, IBadRequest, IUnauthorized, IForbidden, INotFound, IMethodNotAllowed, IUnsupportedMediaType, ITooManyRequests, IInternalServerError + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 401 Unauthorized + /// + /// + bool IsUnauthorized { get; } + + /// + /// Returns true if the response is 403 Forbidden + /// + /// + bool IsForbidden { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + + /// + /// Returns true if the response is 415 UnsupportedMediaType + /// + /// + bool IsUnsupportedMediaType { get; } + + /// + /// Returns true if the response is 429 TooManyRequests + /// + /// + bool IsTooManyRequests { get; } + + /// + /// Returns true if the response is 500 InternalServerError + /// + /// + bool IsInternalServerError { get; } + } + + /// + /// The + /// + public interface IListEndpointsApiResponse : Bandwidth.Standard.Client.IApiResponse, IOk, IBadRequest, IUnauthorized, IForbidden, INotFound, IMethodNotAllowed, IUnsupportedMediaType, ITooManyRequests, IInternalServerError + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 401 Unauthorized + /// + /// + bool IsUnauthorized { get; } + + /// + /// Returns true if the response is 403 Forbidden + /// + /// + bool IsForbidden { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + + /// + /// Returns true if the response is 415 UnsupportedMediaType + /// + /// + bool IsUnsupportedMediaType { get; } + + /// + /// Returns true if the response is 429 TooManyRequests + /// + /// + bool IsTooManyRequests { get; } + + /// + /// Returns true if the response is 500 InternalServerError + /// + /// + bool IsInternalServerError { get; } + } + + /// + /// The + /// + public interface IUpdateEndpointBxmlApiResponse : Bandwidth.Standard.Client.IApiResponse, IBadRequest, IUnauthorized, IForbidden, INotFound, IMethodNotAllowed, IUnsupportedMediaType, ITooManyRequests, IInternalServerError + { + /// + /// Returns true if the response is 204 NoContent + /// + /// + bool IsNoContent { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 401 Unauthorized + /// + /// + bool IsUnauthorized { get; } + + /// + /// Returns true if the response is 403 Forbidden + /// + /// + bool IsForbidden { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + + /// + /// Returns true if the response is 415 UnsupportedMediaType + /// + /// + bool IsUnsupportedMediaType { get; } + + /// + /// Returns true if the response is 429 TooManyRequests + /// + /// + bool IsTooManyRequests { get; } + + /// + /// Returns true if the response is 500 InternalServerError + /// + /// + bool IsInternalServerError { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class EndpointsApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnCreateEndpoint; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorCreateEndpoint; + + internal void ExecuteOnCreateEndpoint(EndpointsApi.CreateEndpointApiResponse apiResponse) + { + OnCreateEndpoint?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateEndpoint(Exception exception) + { + OnErrorCreateEndpoint?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnDeleteEndpoint; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorDeleteEndpoint; + + internal void ExecuteOnDeleteEndpoint(EndpointsApi.DeleteEndpointApiResponse apiResponse) + { + OnDeleteEndpoint?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeleteEndpoint(Exception exception) + { + OnErrorDeleteEndpoint?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetEndpoint; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetEndpoint; + + internal void ExecuteOnGetEndpoint(EndpointsApi.GetEndpointApiResponse apiResponse) + { + OnGetEndpoint?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetEndpoint(Exception exception) + { + OnErrorGetEndpoint?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnListEndpoints; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorListEndpoints; + + internal void ExecuteOnListEndpoints(EndpointsApi.ListEndpointsApiResponse apiResponse) + { + OnListEndpoints?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorListEndpoints(Exception exception) + { + OnErrorListEndpoints?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnUpdateEndpointBxml; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorUpdateEndpointBxml; + + internal void ExecuteOnUpdateEndpointBxml(EndpointsApi.UpdateEndpointBxmlApiResponse apiResponse) + { + OnUpdateEndpointBxml?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdateEndpointBxml(Exception exception) + { + OnErrorUpdateEndpointBxml?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class EndpointsApi : IEndpointsApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public EndpointsApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public EndpointsApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, EndpointsApiEvents endpointsApiEvents, + TokenProvider basicTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = endpointsApiEvents; + BasicTokenProvider = basicTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatCreateEndpoint(ref string accountId, ref CreateWebRtcConnectionRequest body); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateCreateEndpoint(string accountId, CreateWebRtcConnectionRequest body) + { + if (accountId == null) + throw new ArgumentNullException(nameof(accountId)); + + if (body == null) + throw new ArgumentNullException(nameof(body)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterCreateEndpointDefaultImplementation(ICreateEndpointApiResponse apiResponseLocalVar, string accountId, CreateWebRtcConnectionRequest body) + { + bool suppressDefaultLog = false; + AfterCreateEndpoint(ref suppressDefaultLog, apiResponseLocalVar, accountId, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterCreateEndpoint(ref bool suppressDefaultLog, ICreateEndpointApiResponse apiResponseLocalVar, string accountId, CreateWebRtcConnectionRequest body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorCreateEndpointDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string accountId, CreateWebRtcConnectionRequest body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateEndpoint(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, accountId, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateEndpoint(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string accountId, CreateWebRtcConnectionRequest body); + + /// + /// Create Endpoint Creates a new Endpoint for the specified account. + /// + /// Your Bandwidth Account ID. + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateEndpointOrDefaultAsync(string accountId, CreateWebRtcConnectionRequest body, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateEndpointAsync(accountId, body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Create Endpoint Creates a new Endpoint for the specified account. + /// + /// Thrown when fails to make API call + /// Your Bandwidth Account ID. + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateEndpointAsync(string accountId, CreateWebRtcConnectionRequest body, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateEndpoint(accountId, body); + + FormatCreateEndpoint(ref accountId, ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("https://api.bandwidth.com/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BaccountId%7D", Uri.EscapeDataString(accountId.ToString())); + + httpRequestMessageLocalVar.Content = (body as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BasicToken basicTokenLocalVar1 = (BasicToken) await BasicTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(basicTokenLocalVar1); + + basicTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + CreateEndpointApiResponse apiResponseLocalVar; + + switch ((int)httpResponseMessageLocalVar.StatusCode) { + default: { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + apiResponseLocalVar = new CreateEndpointApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/accounts/{accountId}/endpoints", requestedAtLocalVar, _jsonSerializerOptions); + + break; + } + } + + AfterCreateEndpointDefaultImplementation(apiResponseLocalVar, accountId, body); + + Events.ExecuteOnCreateEndpoint(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateEndpointDefaultImplementation(e, "/accounts/{accountId}/endpoints", uriBuilderLocalVar.Path, accountId, body); + Events.ExecuteOnErrorCreateEndpoint(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateEndpointApiResponse : Bandwidth.Standard.Client.ApiResponse, ICreateEndpointApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateEndpointApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateEndpointApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, System.IO.Stream contentStream, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, contentStream, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 201 Created + /// + /// + public bool IsCreated => 201 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 201 Created + /// + /// + public Bandwidth.Standard.Model.CreateEndpointResponse Created() + { + // This logic may be modified with the AsModel.mustache template + return IsCreated + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 201 Created and the deserialized response is not null + /// + /// + /// + public bool TryCreated(out Bandwidth.Standard.Model.CreateEndpointResponse result) + { + result = null; + + try + { + result = Created(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)201); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 400 BadRequest + /// + /// + public Bandwidth.Standard.Model.ErrorResponse BadRequest() + { + // This logic may be modified with the AsModel.mustache template + return IsBadRequest + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 400 BadRequest and the deserialized response is not null + /// + /// + /// + public bool TryBadRequest(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = BadRequest(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)400); + } + + return result != null; + } + + /// + /// Returns true if the response is 401 Unauthorized + /// + /// + public bool IsUnauthorized => 401 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 401 Unauthorized + /// + /// + public Bandwidth.Standard.Model.ErrorResponse Unauthorized() + { + // This logic may be modified with the AsModel.mustache template + return IsUnauthorized + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 401 Unauthorized and the deserialized response is not null + /// + /// + /// + public bool TryUnauthorized(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = Unauthorized(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)401); + } + + return result != null; + } + + /// + /// Returns true if the response is 403 Forbidden + /// + /// + public bool IsForbidden => 403 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 403 Forbidden + /// + /// + public Bandwidth.Standard.Model.ErrorResponse Forbidden() + { + // This logic may be modified with the AsModel.mustache template + return IsForbidden + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 403 Forbidden and the deserialized response is not null + /// + /// + /// + public bool TryForbidden(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = Forbidden(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)403); + } + + return result != null; + } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 404 NotFound + /// + /// + public Bandwidth.Standard.Model.ErrorResponse NotFound() + { + // This logic may be modified with the AsModel.mustache template + return IsNotFound + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 404 NotFound and the deserialized response is not null + /// + /// + /// + public bool TryNotFound(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = NotFound(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)404); + } + + return result != null; + } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 405 MethodNotAllowed + /// + /// + public Bandwidth.Standard.Model.ErrorResponse MethodNotAllowed() + { + // This logic may be modified with the AsModel.mustache template + return IsMethodNotAllowed + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 405 MethodNotAllowed and the deserialized response is not null + /// + /// + /// + public bool TryMethodNotAllowed(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = MethodNotAllowed(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)405); + } + + return result != null; + } + + /// + /// Returns true if the response is 415 UnsupportedMediaType + /// + /// + public bool IsUnsupportedMediaType => 415 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 415 UnsupportedMediaType + /// + /// + public Bandwidth.Standard.Model.ErrorResponse UnsupportedMediaType() + { + // This logic may be modified with the AsModel.mustache template + return IsUnsupportedMediaType + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 415 UnsupportedMediaType and the deserialized response is not null + /// + /// + /// + public bool TryUnsupportedMediaType(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = UnsupportedMediaType(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)415); + } + + return result != null; + } + + /// + /// Returns true if the response is 429 TooManyRequests + /// + /// + public bool IsTooManyRequests => 429 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 429 TooManyRequests + /// + /// + public Bandwidth.Standard.Model.ErrorResponse TooManyRequests() + { + // This logic may be modified with the AsModel.mustache template + return IsTooManyRequests + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 429 TooManyRequests and the deserialized response is not null + /// + /// + /// + public bool TryTooManyRequests(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = TooManyRequests(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)429); + } + + return result != null; + } + + /// + /// Returns true if the response is 500 InternalServerError + /// + /// + public bool IsInternalServerError => 500 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 500 InternalServerError + /// + /// + public Bandwidth.Standard.Model.ErrorResponse InternalServerError() + { + // This logic may be modified with the AsModel.mustache template + return IsInternalServerError + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 500 InternalServerError and the deserialized response is not null + /// + /// + /// + public bool TryInternalServerError(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = InternalServerError(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)500); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatDeleteEndpoint(ref string accountId, ref string endpointId); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateDeleteEndpoint(string accountId, string endpointId) + { + if (accountId == null) + throw new ArgumentNullException(nameof(accountId)); + + if (endpointId == null) + throw new ArgumentNullException(nameof(endpointId)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterDeleteEndpointDefaultImplementation(IDeleteEndpointApiResponse apiResponseLocalVar, string accountId, string endpointId) + { + bool suppressDefaultLog = false; + AfterDeleteEndpoint(ref suppressDefaultLog, apiResponseLocalVar, accountId, endpointId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterDeleteEndpoint(ref bool suppressDefaultLog, IDeleteEndpointApiResponse apiResponseLocalVar, string accountId, string endpointId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorDeleteEndpointDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string accountId, string endpointId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeleteEndpoint(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, accountId, endpointId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorDeleteEndpoint(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string accountId, string endpointId); + + /// + /// Delete Endpoint Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + /// + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteEndpointOrDefaultAsync(string accountId, string endpointId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeleteEndpointAsync(accountId, endpointId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Delete Endpoint Deletes the specified endpoint. If the endpoint is actively streaming media, the media stream will be terminated. + /// + /// Thrown when fails to make API call + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteEndpointAsync(string accountId, string endpointId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeleteEndpoint(accountId, endpointId); + + FormatDeleteEndpoint(ref accountId, ref endpointId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("https://api.bandwidth.com/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BaccountId%7D", Uri.EscapeDataString(accountId.ToString())); + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BendpointId%7D", Uri.EscapeDataString(endpointId.ToString())); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BasicToken basicTokenLocalVar1 = (BasicToken) await BasicTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(basicTokenLocalVar1); + + basicTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + DeleteEndpointApiResponse apiResponseLocalVar; + + switch ((int)httpResponseMessageLocalVar.StatusCode) { + default: { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + apiResponseLocalVar = new DeleteEndpointApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/accounts/{accountId}/endpoints/{endpointId}", requestedAtLocalVar, _jsonSerializerOptions); + + break; + } + } + + AfterDeleteEndpointDefaultImplementation(apiResponseLocalVar, accountId, endpointId); + + Events.ExecuteOnDeleteEndpoint(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeleteEndpointDefaultImplementation(e, "/accounts/{accountId}/endpoints/{endpointId}", uriBuilderLocalVar.Path, accountId, endpointId); + Events.ExecuteOnErrorDeleteEndpoint(e); + throw; + } + } + + /// + /// The + /// + public partial class DeleteEndpointApiResponse : Bandwidth.Standard.Client.ApiResponse, IDeleteEndpointApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeleteEndpointApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeleteEndpointApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, System.IO.Stream contentStream, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, contentStream, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 204 NoContent + /// + /// + public bool IsNoContent => 204 == (int)StatusCode; + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 400 BadRequest + /// + /// + public Bandwidth.Standard.Model.ErrorResponse BadRequest() + { + // This logic may be modified with the AsModel.mustache template + return IsBadRequest + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 400 BadRequest and the deserialized response is not null + /// + /// + /// + public bool TryBadRequest(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = BadRequest(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)400); + } + + return result != null; + } + + /// + /// Returns true if the response is 401 Unauthorized + /// + /// + public bool IsUnauthorized => 401 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 401 Unauthorized + /// + /// + public Bandwidth.Standard.Model.ErrorResponse Unauthorized() + { + // This logic may be modified with the AsModel.mustache template + return IsUnauthorized + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 401 Unauthorized and the deserialized response is not null + /// + /// + /// + public bool TryUnauthorized(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = Unauthorized(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)401); + } + + return result != null; + } + + /// + /// Returns true if the response is 403 Forbidden + /// + /// + public bool IsForbidden => 403 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 403 Forbidden + /// + /// + public Bandwidth.Standard.Model.ErrorResponse Forbidden() + { + // This logic may be modified with the AsModel.mustache template + return IsForbidden + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 403 Forbidden and the deserialized response is not null + /// + /// + /// + public bool TryForbidden(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = Forbidden(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)403); + } + + return result != null; + } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 404 NotFound + /// + /// + public Bandwidth.Standard.Model.ErrorResponse NotFound() + { + // This logic may be modified with the AsModel.mustache template + return IsNotFound + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 404 NotFound and the deserialized response is not null + /// + /// + /// + public bool TryNotFound(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = NotFound(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)404); + } + + return result != null; + } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 405 MethodNotAllowed + /// + /// + public Bandwidth.Standard.Model.ErrorResponse MethodNotAllowed() + { + // This logic may be modified with the AsModel.mustache template + return IsMethodNotAllowed + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 405 MethodNotAllowed and the deserialized response is not null + /// + /// + /// + public bool TryMethodNotAllowed(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = MethodNotAllowed(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)405); + } + + return result != null; + } + + /// + /// Returns true if the response is 415 UnsupportedMediaType + /// + /// + public bool IsUnsupportedMediaType => 415 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 415 UnsupportedMediaType + /// + /// + public Bandwidth.Standard.Model.ErrorResponse UnsupportedMediaType() + { + // This logic may be modified with the AsModel.mustache template + return IsUnsupportedMediaType + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 415 UnsupportedMediaType and the deserialized response is not null + /// + /// + /// + public bool TryUnsupportedMediaType(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = UnsupportedMediaType(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)415); + } + + return result != null; + } + + /// + /// Returns true if the response is 429 TooManyRequests + /// + /// + public bool IsTooManyRequests => 429 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 429 TooManyRequests + /// + /// + public Bandwidth.Standard.Model.ErrorResponse TooManyRequests() + { + // This logic may be modified with the AsModel.mustache template + return IsTooManyRequests + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 429 TooManyRequests and the deserialized response is not null + /// + /// + /// + public bool TryTooManyRequests(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = TooManyRequests(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)429); + } + + return result != null; + } + + /// + /// Returns true if the response is 500 InternalServerError + /// + /// + public bool IsInternalServerError => 500 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 500 InternalServerError + /// + /// + public Bandwidth.Standard.Model.ErrorResponse InternalServerError() + { + // This logic may be modified with the AsModel.mustache template + return IsInternalServerError + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 500 InternalServerError and the deserialized response is not null + /// + /// + /// + public bool TryInternalServerError(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = InternalServerError(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)500); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetEndpoint(ref string accountId, ref string endpointId); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateGetEndpoint(string accountId, string endpointId) + { + if (accountId == null) + throw new ArgumentNullException(nameof(accountId)); + + if (endpointId == null) + throw new ArgumentNullException(nameof(endpointId)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterGetEndpointDefaultImplementation(IGetEndpointApiResponse apiResponseLocalVar, string accountId, string endpointId) + { + bool suppressDefaultLog = false; + AfterGetEndpoint(ref suppressDefaultLog, apiResponseLocalVar, accountId, endpointId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterGetEndpoint(ref bool suppressDefaultLog, IGetEndpointApiResponse apiResponseLocalVar, string accountId, string endpointId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorGetEndpointDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string accountId, string endpointId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetEndpoint(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, accountId, endpointId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorGetEndpoint(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string accountId, string endpointId); + + /// + /// Get Endpoint Returns information about the specified endpoint. + /// + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetEndpointOrDefaultAsync(string accountId, string endpointId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetEndpointAsync(accountId, endpointId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Get Endpoint Returns information about the specified endpoint. + /// + /// Thrown when fails to make API call + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetEndpointAsync(string accountId, string endpointId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateGetEndpoint(accountId, endpointId); + + FormatGetEndpoint(ref accountId, ref endpointId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("https://api.bandwidth.com/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BaccountId%7D", Uri.EscapeDataString(accountId.ToString())); + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BendpointId%7D", Uri.EscapeDataString(endpointId.ToString())); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BasicToken basicTokenLocalVar1 = (BasicToken) await BasicTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(basicTokenLocalVar1); + + basicTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + GetEndpointApiResponse apiResponseLocalVar; + + switch ((int)httpResponseMessageLocalVar.StatusCode) { + default: { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + apiResponseLocalVar = new GetEndpointApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/accounts/{accountId}/endpoints/{endpointId}", requestedAtLocalVar, _jsonSerializerOptions); + + break; + } + } + + AfterGetEndpointDefaultImplementation(apiResponseLocalVar, accountId, endpointId); + + Events.ExecuteOnGetEndpoint(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetEndpointDefaultImplementation(e, "/accounts/{accountId}/endpoints/{endpointId}", uriBuilderLocalVar.Path, accountId, endpointId); + Events.ExecuteOnErrorGetEndpoint(e); + throw; + } + } + + /// + /// The + /// + public partial class GetEndpointApiResponse : Bandwidth.Standard.Client.ApiResponse, IGetEndpointApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetEndpointApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetEndpointApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, System.IO.Stream contentStream, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, contentStream, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Bandwidth.Standard.Model.EndpointResponse Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk(out Bandwidth.Standard.Model.EndpointResponse result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 400 BadRequest + /// + /// + public Bandwidth.Standard.Model.ErrorResponse BadRequest() + { + // This logic may be modified with the AsModel.mustache template + return IsBadRequest + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 400 BadRequest and the deserialized response is not null + /// + /// + /// + public bool TryBadRequest(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = BadRequest(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)400); + } + + return result != null; + } + + /// + /// Returns true if the response is 401 Unauthorized + /// + /// + public bool IsUnauthorized => 401 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 401 Unauthorized + /// + /// + public Bandwidth.Standard.Model.ErrorResponse Unauthorized() + { + // This logic may be modified with the AsModel.mustache template + return IsUnauthorized + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 401 Unauthorized and the deserialized response is not null + /// + /// + /// + public bool TryUnauthorized(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = Unauthorized(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)401); + } + + return result != null; + } + + /// + /// Returns true if the response is 403 Forbidden + /// + /// + public bool IsForbidden => 403 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 403 Forbidden + /// + /// + public Bandwidth.Standard.Model.ErrorResponse Forbidden() + { + // This logic may be modified with the AsModel.mustache template + return IsForbidden + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 403 Forbidden and the deserialized response is not null + /// + /// + /// + public bool TryForbidden(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = Forbidden(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)403); + } + + return result != null; + } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 404 NotFound + /// + /// + public Bandwidth.Standard.Model.ErrorResponse NotFound() + { + // This logic may be modified with the AsModel.mustache template + return IsNotFound + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 404 NotFound and the deserialized response is not null + /// + /// + /// + public bool TryNotFound(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = NotFound(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)404); + } + + return result != null; + } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 405 MethodNotAllowed + /// + /// + public Bandwidth.Standard.Model.ErrorResponse MethodNotAllowed() + { + // This logic may be modified with the AsModel.mustache template + return IsMethodNotAllowed + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 405 MethodNotAllowed and the deserialized response is not null + /// + /// + /// + public bool TryMethodNotAllowed(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = MethodNotAllowed(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)405); + } + + return result != null; + } + + /// + /// Returns true if the response is 415 UnsupportedMediaType + /// + /// + public bool IsUnsupportedMediaType => 415 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 415 UnsupportedMediaType + /// + /// + public Bandwidth.Standard.Model.ErrorResponse UnsupportedMediaType() + { + // This logic may be modified with the AsModel.mustache template + return IsUnsupportedMediaType + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 415 UnsupportedMediaType and the deserialized response is not null + /// + /// + /// + public bool TryUnsupportedMediaType(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = UnsupportedMediaType(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)415); + } + + return result != null; + } + + /// + /// Returns true if the response is 429 TooManyRequests + /// + /// + public bool IsTooManyRequests => 429 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 429 TooManyRequests + /// + /// + public Bandwidth.Standard.Model.ErrorResponse TooManyRequests() + { + // This logic may be modified with the AsModel.mustache template + return IsTooManyRequests + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 429 TooManyRequests and the deserialized response is not null + /// + /// + /// + public bool TryTooManyRequests(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = TooManyRequests(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)429); + } + + return result != null; + } + + /// + /// Returns true if the response is 500 InternalServerError + /// + /// + public bool IsInternalServerError => 500 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 500 InternalServerError + /// + /// + public Bandwidth.Standard.Model.ErrorResponse InternalServerError() + { + // This logic may be modified with the AsModel.mustache template + return IsInternalServerError + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 500 InternalServerError and the deserialized response is not null + /// + /// + /// + public bool TryInternalServerError(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = InternalServerError(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)500); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatListEndpoints(ref string accountId, ref Option type, ref Option status, ref Option afterCursor, ref Option limit); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateListEndpoints(string accountId, Option afterCursor) + { + if (accountId == null) + throw new ArgumentNullException(nameof(accountId)); + + if (afterCursor.IsSet && afterCursor.Value == null) + throw new ArgumentNullException(nameof(afterCursor)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + private void AfterListEndpointsDefaultImplementation(IListEndpointsApiResponse apiResponseLocalVar, string accountId, Option type, Option status, Option afterCursor, Option limit) + { + bool suppressDefaultLog = false; + AfterListEndpoints(ref suppressDefaultLog, apiResponseLocalVar, accountId, type, status, afterCursor, limit); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterListEndpoints(ref bool suppressDefaultLog, IListEndpointsApiResponse apiResponseLocalVar, string accountId, Option type, Option status, Option afterCursor, Option limit); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorListEndpointsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string accountId, Option type, Option status, Option afterCursor, Option limit) + { + bool suppressDefaultLogLocalVar = false; + OnErrorListEndpoints(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, accountId, type, status, afterCursor, limit); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorListEndpoints(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string accountId, Option type, Option status, Option afterCursor, Option limit); + + /// + /// List Endpoints Returns a list of endpoints associated with the specified account. + /// + /// Your Bandwidth Account ID. + /// The type of endpoint. (optional) + /// The status of the endpoint. (optional) + /// The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + /// The maximum number of endpoints to return in the response. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// <> + public async Task ListEndpointsOrDefaultAsync(string accountId, Option type = default, Option status = default, Option afterCursor = default, Option limit = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await ListEndpointsAsync(accountId, type, status, afterCursor, limit, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// List Endpoints Returns a list of endpoints associated with the specified account. + /// + /// Thrown when fails to make API call + /// Your Bandwidth Account ID. + /// The type of endpoint. (optional) + /// The status of the endpoint. (optional) + /// The cursor to use for pagination. This is the value of the `next` link in the previous response. (optional) + /// The maximum number of endpoints to return in the response. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// <> + public async Task ListEndpointsAsync(string accountId, Option type = default, Option status = default, Option afterCursor = default, Option limit = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateListEndpoints(accountId, afterCursor); + + FormatListEndpoints(ref accountId, ref type, ref status, ref afterCursor, ref limit); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("https://api.bandwidth.com/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BaccountId%7D", Uri.EscapeDataString(accountId.ToString())); + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + if (type.IsSet) + parseQueryStringLocalVar["type"] = ClientUtils.ParameterToString(type.Value); + + if (status.IsSet) + parseQueryStringLocalVar["status"] = ClientUtils.ParameterToString(status.Value); + + if (afterCursor.IsSet) + parseQueryStringLocalVar["afterCursor"] = ClientUtils.ParameterToString(afterCursor.Value); + + if (limit.IsSet) + parseQueryStringLocalVar["limit"] = ClientUtils.ParameterToString(limit.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BasicToken basicTokenLocalVar1 = (BasicToken) await BasicTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(basicTokenLocalVar1); + + basicTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + ListEndpointsApiResponse apiResponseLocalVar; + + switch ((int)httpResponseMessageLocalVar.StatusCode) { + default: { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + apiResponseLocalVar = new ListEndpointsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/accounts/{accountId}/endpoints", requestedAtLocalVar, _jsonSerializerOptions); + + break; + } + } + + AfterListEndpointsDefaultImplementation(apiResponseLocalVar, accountId, type, status, afterCursor, limit); + + Events.ExecuteOnListEndpoints(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorListEndpointsDefaultImplementation(e, "/accounts/{accountId}/endpoints", uriBuilderLocalVar.Path, accountId, type, status, afterCursor, limit); + Events.ExecuteOnErrorListEndpoints(e); + throw; + } + } + + /// + /// The + /// + public partial class ListEndpointsApiResponse : Bandwidth.Standard.Client.ApiResponse, IListEndpointsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public ListEndpointsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public ListEndpointsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, System.IO.Stream contentStream, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, contentStream, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Bandwidth.Standard.Model.ListEndpointsResponse Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk(out Bandwidth.Standard.Model.ListEndpointsResponse result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 400 BadRequest + /// + /// + public Bandwidth.Standard.Model.ErrorResponse BadRequest() + { + // This logic may be modified with the AsModel.mustache template + return IsBadRequest + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 400 BadRequest and the deserialized response is not null + /// + /// + /// + public bool TryBadRequest(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = BadRequest(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)400); + } + + return result != null; + } + + /// + /// Returns true if the response is 401 Unauthorized + /// + /// + public bool IsUnauthorized => 401 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 401 Unauthorized + /// + /// + public Bandwidth.Standard.Model.ErrorResponse Unauthorized() + { + // This logic may be modified with the AsModel.mustache template + return IsUnauthorized + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 401 Unauthorized and the deserialized response is not null + /// + /// + /// + public bool TryUnauthorized(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = Unauthorized(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)401); + } + + return result != null; + } + + /// + /// Returns true if the response is 403 Forbidden + /// + /// + public bool IsForbidden => 403 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 403 Forbidden + /// + /// + public Bandwidth.Standard.Model.ErrorResponse Forbidden() + { + // This logic may be modified with the AsModel.mustache template + return IsForbidden + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 403 Forbidden and the deserialized response is not null + /// + /// + /// + public bool TryForbidden(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = Forbidden(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)403); + } + + return result != null; + } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 404 NotFound + /// + /// + public Bandwidth.Standard.Model.ErrorResponse NotFound() + { + // This logic may be modified with the AsModel.mustache template + return IsNotFound + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 404 NotFound and the deserialized response is not null + /// + /// + /// + public bool TryNotFound(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = NotFound(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)404); + } + + return result != null; + } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 405 MethodNotAllowed + /// + /// + public Bandwidth.Standard.Model.ErrorResponse MethodNotAllowed() + { + // This logic may be modified with the AsModel.mustache template + return IsMethodNotAllowed + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 405 MethodNotAllowed and the deserialized response is not null + /// + /// + /// + public bool TryMethodNotAllowed(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = MethodNotAllowed(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)405); + } + + return result != null; + } + + /// + /// Returns true if the response is 415 UnsupportedMediaType + /// + /// + public bool IsUnsupportedMediaType => 415 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 415 UnsupportedMediaType + /// + /// + public Bandwidth.Standard.Model.ErrorResponse UnsupportedMediaType() + { + // This logic may be modified with the AsModel.mustache template + return IsUnsupportedMediaType + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 415 UnsupportedMediaType and the deserialized response is not null + /// + /// + /// + public bool TryUnsupportedMediaType(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = UnsupportedMediaType(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)415); + } + + return result != null; + } + + /// + /// Returns true if the response is 429 TooManyRequests + /// + /// + public bool IsTooManyRequests => 429 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 429 TooManyRequests + /// + /// + public Bandwidth.Standard.Model.ErrorResponse TooManyRequests() + { + // This logic may be modified with the AsModel.mustache template + return IsTooManyRequests + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 429 TooManyRequests and the deserialized response is not null + /// + /// + /// + public bool TryTooManyRequests(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = TooManyRequests(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)429); + } + + return result != null; + } + + /// + /// Returns true if the response is 500 InternalServerError + /// + /// + public bool IsInternalServerError => 500 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 500 InternalServerError + /// + /// + public Bandwidth.Standard.Model.ErrorResponse InternalServerError() + { + // This logic may be modified with the AsModel.mustache template + return IsInternalServerError + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 500 InternalServerError and the deserialized response is not null + /// + /// + /// + public bool TryInternalServerError(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = InternalServerError(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)500); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdateEndpointBxml(ref string accountId, ref string endpointId, ref string body); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + private void ValidateUpdateEndpointBxml(string accountId, string endpointId, string body) + { + if (accountId == null) + throw new ArgumentNullException(nameof(accountId)); + + if (endpointId == null) + throw new ArgumentNullException(nameof(endpointId)); + + if (body == null) + throw new ArgumentNullException(nameof(body)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUpdateEndpointBxmlDefaultImplementation(IUpdateEndpointBxmlApiResponse apiResponseLocalVar, string accountId, string endpointId, string body) + { + bool suppressDefaultLog = false; + AfterUpdateEndpointBxml(ref suppressDefaultLog, apiResponseLocalVar, accountId, endpointId, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUpdateEndpointBxml(ref bool suppressDefaultLog, IUpdateEndpointBxmlApiResponse apiResponseLocalVar, string accountId, string endpointId, string body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUpdateEndpointBxmlDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string accountId, string endpointId, string body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdateEndpointBxml(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, accountId, endpointId, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdateEndpointBxml(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string accountId, string endpointId, string body); + + /// + /// Update Endpoint BXML Updates the BXML for the specified endpoint. + /// + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdateEndpointBxmlOrDefaultAsync(string accountId, string endpointId, string body, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdateEndpointBxmlAsync(accountId, endpointId, body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Update Endpoint BXML Updates the BXML for the specified endpoint. + /// + /// Thrown when fails to make API call + /// Your Bandwidth Account ID. + /// BRTC Endpoint ID. + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdateEndpointBxmlAsync(string accountId, string endpointId, string body, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdateEndpointBxml(accountId, endpointId, body); + + FormatUpdateEndpointBxml(ref accountId, ref endpointId, ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("https://api.bandwidth.com/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BaccountId%7D", Uri.EscapeDataString(accountId.ToString())); + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BendpointId%7D", Uri.EscapeDataString(endpointId.ToString())); + + httpRequestMessageLocalVar.Content = (body as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BasicToken basicTokenLocalVar1 = (BasicToken) await BasicTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(basicTokenLocalVar1); + + basicTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "application/xml" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + UpdateEndpointBxmlApiResponse apiResponseLocalVar; + + switch ((int)httpResponseMessageLocalVar.StatusCode) { + default: { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + apiResponseLocalVar = new UpdateEndpointBxmlApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/accounts/{accountId}/endpoints/{endpointId}/bxml", requestedAtLocalVar, _jsonSerializerOptions); + + break; + } + } + + AfterUpdateEndpointBxmlDefaultImplementation(apiResponseLocalVar, accountId, endpointId, body); + + Events.ExecuteOnUpdateEndpointBxml(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdateEndpointBxmlDefaultImplementation(e, "/accounts/{accountId}/endpoints/{endpointId}/bxml", uriBuilderLocalVar.Path, accountId, endpointId, body); + Events.ExecuteOnErrorUpdateEndpointBxml(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdateEndpointBxmlApiResponse : Bandwidth.Standard.Client.ApiResponse, IUpdateEndpointBxmlApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdateEndpointBxmlApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdateEndpointBxmlApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, System.IO.Stream contentStream, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, contentStream, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 204 NoContent + /// + /// + public bool IsNoContent => 204 == (int)StatusCode; + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 400 BadRequest + /// + /// + public Bandwidth.Standard.Model.ErrorResponse BadRequest() + { + // This logic may be modified with the AsModel.mustache template + return IsBadRequest + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 400 BadRequest and the deserialized response is not null + /// + /// + /// + public bool TryBadRequest(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = BadRequest(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)400); + } + + return result != null; + } + + /// + /// Returns true if the response is 401 Unauthorized + /// + /// + public bool IsUnauthorized => 401 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 401 Unauthorized + /// + /// + public Bandwidth.Standard.Model.ErrorResponse Unauthorized() + { + // This logic may be modified with the AsModel.mustache template + return IsUnauthorized + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 401 Unauthorized and the deserialized response is not null + /// + /// + /// + public bool TryUnauthorized(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = Unauthorized(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)401); + } + + return result != null; + } + + /// + /// Returns true if the response is 403 Forbidden + /// + /// + public bool IsForbidden => 403 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 403 Forbidden + /// + /// + public Bandwidth.Standard.Model.ErrorResponse Forbidden() + { + // This logic may be modified with the AsModel.mustache template + return IsForbidden + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 403 Forbidden and the deserialized response is not null + /// + /// + /// + public bool TryForbidden(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = Forbidden(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)403); + } + + return result != null; + } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 404 NotFound + /// + /// + public Bandwidth.Standard.Model.ErrorResponse NotFound() + { + // This logic may be modified with the AsModel.mustache template + return IsNotFound + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 404 NotFound and the deserialized response is not null + /// + /// + /// + public bool TryNotFound(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = NotFound(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)404); + } + + return result != null; + } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 405 MethodNotAllowed + /// + /// + public Bandwidth.Standard.Model.ErrorResponse MethodNotAllowed() + { + // This logic may be modified with the AsModel.mustache template + return IsMethodNotAllowed + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 405 MethodNotAllowed and the deserialized response is not null + /// + /// + /// + public bool TryMethodNotAllowed(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = MethodNotAllowed(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)405); + } + + return result != null; + } + + /// + /// Returns true if the response is 415 UnsupportedMediaType + /// + /// + public bool IsUnsupportedMediaType => 415 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 415 UnsupportedMediaType + /// + /// + public Bandwidth.Standard.Model.ErrorResponse UnsupportedMediaType() + { + // This logic may be modified with the AsModel.mustache template + return IsUnsupportedMediaType + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 415 UnsupportedMediaType and the deserialized response is not null + /// + /// + /// + public bool TryUnsupportedMediaType(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = UnsupportedMediaType(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)415); + } + + return result != null; + } + + /// + /// Returns true if the response is 429 TooManyRequests + /// + /// + public bool IsTooManyRequests => 429 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 429 TooManyRequests + /// + /// + public Bandwidth.Standard.Model.ErrorResponse TooManyRequests() + { + // This logic may be modified with the AsModel.mustache template + return IsTooManyRequests + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 429 TooManyRequests and the deserialized response is not null + /// + /// + /// + public bool TryTooManyRequests(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = TooManyRequests(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)429); + } + + return result != null; + } + + /// + /// Returns true if the response is 500 InternalServerError + /// + /// + public bool IsInternalServerError => 500 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 500 InternalServerError + /// + /// + public Bandwidth.Standard.Model.ErrorResponse InternalServerError() + { + // This logic may be modified with the AsModel.mustache template + return IsInternalServerError + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : default; + } + + /// + /// Returns true if the response is 500 InternalServerError and the deserialized response is not null + /// + /// + /// + public bool TryInternalServerError(out Bandwidth.Standard.Model.ErrorResponse result) + { + result = null; + + try + { + result = InternalServerError(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)500); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/src/Bandwidth.Standard/Api/IApi.cs b/src/Bandwidth.Standard/Api/IApi.cs new file mode 100644 index 00000000..8366d97b --- /dev/null +++ b/src/Bandwidth.Standard/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Bandwidth.Standard.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/src/Bandwidth.Standard/Client/ApiException.cs b/src/Bandwidth.Standard/Client/ApiException.cs index 883962b3..4174f730 100644 --- a/src/Bandwidth.Standard/Client/ApiException.cs +++ b/src/Bandwidth.Standard/Client/ApiException.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,7 +9,6 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; namespace Bandwidth.Standard.Client @@ -19,51 +19,33 @@ namespace Bandwidth.Standard.Client public class ApiException : Exception { /// - /// Gets or sets the error code (HTTP status code) - /// - /// The error code (HTTP status code). - public int ErrorCode { get; set; } - - /// - /// Gets or sets the error content (body json object) + /// The reason the api request failed /// - /// The error content (Http response body). - public object ErrorContent { get; private set; } + public string ReasonPhrase { get; } /// - /// Gets or sets the HTTP headers + /// The HttpStatusCode /// - /// HTTP headers - public Multimap Headers { get; private set; } + public System.Net.HttpStatusCode StatusCode { get; } /// - /// Initializes a new instance of the class. + /// The raw data returned by the api /// - public ApiException() { } - + public string RawContent { get; } + /// - /// Initializes a new instance of the class. + /// Construct the ApiException from parts of the response /// - /// HTTP status code. - /// Error message. - public ApiException(int errorCode, string message) : base(message) + /// + /// + /// + public ApiException(string reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) { - this.ErrorCode = errorCode; - } + ReasonPhrase = reasonPhrase; - /// - /// Initializes a new instance of the class. - /// - /// HTTP status code. - /// Error message. - /// Error content. - /// HTTP Headers. - public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) - { - this.ErrorCode = errorCode; - this.ErrorContent = errorContent; - this.Headers = headers; + StatusCode = statusCode; + + RawContent = rawContent; } } - } diff --git a/src/Bandwidth.Standard/Client/ApiFactory.cs b/src/Bandwidth.Standard/Client/ApiFactory.cs new file mode 100644 index 00000000..049764c6 --- /dev/null +++ b/src/Bandwidth.Standard/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Bandwidth.Standard.Api; + +namespace Bandwidth.Standard.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/src/Bandwidth.Standard/Client/ApiResponseEventArgs.cs b/src/Bandwidth.Standard/Client/ApiResponseEventArgs.cs new file mode 100644 index 00000000..905f4ac1 --- /dev/null +++ b/src/Bandwidth.Standard/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Bandwidth.Standard.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/src/Bandwidth.Standard/Client/ApiResponse`1.cs b/src/Bandwidth.Standard/Client/ApiResponse`1.cs new file mode 100644 index 00000000..470b6d74 --- /dev/null +++ b/src/Bandwidth.Standard/Client/ApiResponse`1.cs @@ -0,0 +1,484 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Net; + +namespace Bandwidth.Standard.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The raw binary stream (only set for binary responses) + /// + System.IO.Stream ContentStream { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The raw binary stream (only set for binary responses) + /// + public System.IO.Stream ContentStream { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, System.IO.Stream contentStream, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + ContentStream = contentStream; + RawContent = string.Empty; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } + + /// + /// An interface for responses of type + /// + /// + public interface IForbidden : IApiResponse + { + /// + /// Deserializes the response if the response is Forbidden + /// + /// + TType Forbidden(); + + /// + /// Returns true if the response is Forbidden and the deserialized response is not null + /// + /// + /// + bool TryForbidden(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IUnsupportedMediaType : IApiResponse + { + /// + /// Deserializes the response if the response is UnsupportedMediaType + /// + /// + TType UnsupportedMediaType(); + + /// + /// Returns true if the response is UnsupportedMediaType and the deserialized response is not null + /// + /// + /// + bool TryUnsupportedMediaType(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IDefault : IApiResponse + { + /// + /// Deserializes the response if the response is Default + /// + /// + TType Default(); + + /// + /// Returns true if the response is Default and the deserialized response is not null + /// + /// + /// + bool TryDefault(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IInternalServerError : IApiResponse + { + /// + /// Deserializes the response if the response is InternalServerError + /// + /// + TType InternalServerError(); + + /// + /// Returns true if the response is InternalServerError and the deserialized response is not null + /// + /// + /// + bool TryInternalServerError(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IAccepted : IApiResponse + { + /// + /// Deserializes the response if the response is Accepted + /// + /// + TType Accepted(); + + /// + /// Returns true if the response is Accepted and the deserialized response is not null + /// + /// + /// + bool TryAccepted(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface ICreated : IApiResponse + { + /// + /// Deserializes the response if the response is Created + /// + /// + TType Created(); + + /// + /// Returns true if the response is Created and the deserialized response is not null + /// + /// + /// + bool TryCreated(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IBadRequest : IApiResponse + { + /// + /// Deserializes the response if the response is BadRequest + /// + /// + TType BadRequest(); + + /// + /// Returns true if the response is BadRequest and the deserialized response is not null + /// + /// + /// + bool TryBadRequest(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IMethodNotAllowed : IApiResponse + { + /// + /// Deserializes the response if the response is MethodNotAllowed + /// + /// + TType MethodNotAllowed(); + + /// + /// Returns true if the response is MethodNotAllowed and the deserialized response is not null + /// + /// + /// + bool TryMethodNotAllowed(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IConflict : IApiResponse + { + /// + /// Deserializes the response if the response is Conflict + /// + /// + TType Conflict(); + + /// + /// Returns true if the response is Conflict and the deserialized response is not null + /// + /// + /// + bool TryConflict(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface ITooManyRequests : IApiResponse + { + /// + /// Deserializes the response if the response is TooManyRequests + /// + /// + TType TooManyRequests(); + + /// + /// Returns true if the response is TooManyRequests and the deserialized response is not null + /// + /// + /// + bool TryTooManyRequests(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IUnauthorized : IApiResponse + { + /// + /// Deserializes the response if the response is Unauthorized + /// + /// + TType Unauthorized(); + + /// + /// Returns true if the response is Unauthorized and the deserialized response is not null + /// + /// + /// + bool TryUnauthorized(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IServiceUnavailable : IApiResponse + { + /// + /// Deserializes the response if the response is ServiceUnavailable + /// + /// + TType ServiceUnavailable(); + + /// + /// Returns true if the response is ServiceUnavailable and the deserialized response is not null + /// + /// + /// + bool TryServiceUnavailable(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IOk : IApiResponse + { + /// + /// Deserializes the response if the response is Ok + /// + /// + TType Ok(); + + /// + /// Returns true if the response is Ok and the deserialized response is not null + /// + /// + /// + bool TryOk(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface INotAcceptable : IApiResponse + { + /// + /// Deserializes the response if the response is NotAcceptable + /// + /// + TType NotAcceptable(); + + /// + /// Returns true if the response is NotAcceptable and the deserialized response is not null + /// + /// + /// + bool TryNotAcceptable(out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface INotFound : IApiResponse + { + /// + /// Deserializes the response if the response is NotFound + /// + /// + TType NotFound(); + + /// + /// Returns true if the response is NotFound and the deserialized response is not null + /// + /// + /// + bool TryNotFound(out TType result); + } +} diff --git a/src/Bandwidth.Standard/Client/BasicToken.cs b/src/Bandwidth.Standard/Client/BasicToken.cs new file mode 100644 index 00000000..de213812 --- /dev/null +++ b/src/Bandwidth.Standard/Client/BasicToken.cs @@ -0,0 +1,42 @@ +// + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Bandwidth.Standard.Client +{ + /// + /// A token constructed from a username and password. + /// + public class BasicToken : TokenBase + { + private string _username; + + private string _password; + + /// + /// Constructs a BasicToken object. + /// + /// + /// + /// + public BasicToken(string username, string password, TimeSpan? timeout = null) : base(timeout) + { + _username = username; + + _password = password; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Bandwidth.Standard.Client.ClientUtils.Base64Encode(_username + ":" + _password)); + } + } +} \ No newline at end of file diff --git a/src/Bandwidth.Standard/Client/ClientUtils.cs b/src/Bandwidth.Standard/Client/ClientUtils.cs index 103f6d79..78ab3fee 100644 --- a/src/Bandwidth.Standard/Client/ClientUtils.cs +++ b/src/Bandwidth.Standard/Client/ClientUtils.cs @@ -8,16 +8,18 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; using System.IO; using System.Linq; -using System.Runtime.Serialization; +using System.Collections; +using System.Collections.Generic; using System.Text; +using System.Text.Json; using System.Text.RegularExpressions; +using Bandwidth.Standard.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Bandwidth.Standard.Test")] namespace Bandwidth.Standard.Client { @@ -26,57 +28,58 @@ namespace Bandwidth.Standard.Client /// public static class ClientUtils { + /// - /// Sanitize filename by removing the path + /// A delegate for events. /// - /// Filename - /// Filename - public static string SanitizeFilename(string filename) - { - Match match = Regex.Match(filename, @".*[/\\](.*)$"); - return match.Success ? match.Groups[1].Value : filename; - } + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; /// - /// Convert params to key/value pairs. - /// Use collectionFormat to properly format lists and collections. + /// Returns true when deserialization succeeds. /// - /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi - /// Key name. - /// Value object. - /// A multimap of keys with 1..n associated values. - public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) { - var parameters = new Multimap(); - - if (value is ICollection collection && collectionFormat == "multi") + try { - foreach (var item in collection) - { - parameters.Add(name, ParameterToString(item)); - } + result = JsonSerializer.Deserialize(json, options); + return result != null; } - else if (value is IDictionary dictionary) + catch (Exception) { - if(collectionFormat == "deepObject") { - foreach (DictionaryEntry entry in dictionary) - { - parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); - } - } - else { - foreach (DictionaryEntry entry in dictionary) - { - parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); - } - } + result = default; + return false; } - else + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + { + try { - parameters.Add(name, ParameterToString(value)); + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; } - - return parameters; } /// @@ -85,44 +88,152 @@ public static Multimap ParameterToMultiMap(string collectionForm /// Otherwise just return the string. /// /// The parameter (header, path, query, form). - /// An optional configuration instance, providing formatting options used in processing. + /// The DateTime serialization format. /// Formatted string. - public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + public static string ParameterToString(object obj, string format = ISO8601_DATETIME_FORMAT) { if (obj is DateTime dateTime) // Return a formatted date string - Can be customized with Configuration.DateTimeFormat // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 - return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + return dateTime.ToString(format); if (obj is DateTimeOffset dateTimeOffset) // Return a formatted date string - Can be customized with Configuration.DateTimeFormat // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 - return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + return dateTimeOffset.ToString(format); if (obj is bool boolean) - return boolean ? "true" : "false"; - if (obj is ICollection collection) { + return boolean + ? "true" + : "false"; + if (obj is BusinessEntityTypeEnum businessEntityTypeEnum) + return BusinessEntityTypeEnumValueConverter.ToJsonValue(businessEntityTypeEnum); + if (obj is BusinessRegistrationTypeEnum businessRegistrationTypeEnum) + return BusinessRegistrationTypeEnumValueConverter.ToJsonValue(businessRegistrationTypeEnum); + if (obj is CallDirectionEnum callDirectionEnum) + return CallDirectionEnumValueConverter.ToJsonValue(callDirectionEnum); + if (obj is CallStateEnum callStateEnum) + return CallStateEnumValueConverter.ToJsonValue(callStateEnum); + if (obj is CallTranscriptionDetectedLanguageEnum callTranscriptionDetectedLanguageEnum) + return CallTranscriptionDetectedLanguageEnumValueConverter.ToJsonValue(callTranscriptionDetectedLanguageEnum); + if (obj is CallTranscriptionTrackEnum callTranscriptionTrackEnum) + return CallTranscriptionTrackEnumValueConverter.ToJsonValue(callTranscriptionTrackEnum); + if (obj is CallbackMethodEnum callbackMethodEnum) + return CallbackMethodEnumValueConverter.ToJsonValue(callbackMethodEnum); + if (obj is CardWidthEnum cardWidthEnum) + return CardWidthEnumValueConverter.ToJsonValue(cardWidthEnum); + if (obj is CompletedLookupStatusEnum completedLookupStatusEnum) + return CompletedLookupStatusEnumValueConverter.ToJsonValue(completedLookupStatusEnum); + if (obj is ConferenceStateEnum conferenceStateEnum) + return ConferenceStateEnumValueConverter.ToJsonValue(conferenceStateEnum); + if (obj is DeactivationEventEnum deactivationEventEnum) + return DeactivationEventEnumValueConverter.ToJsonValue(deactivationEventEnum); + if (obj is DeviceStatusEnum deviceStatusEnum) + return DeviceStatusEnumValueConverter.ToJsonValue(deviceStatusEnum); + if (obj is EndpointDirectionEnum endpointDirectionEnum) + return EndpointDirectionEnumValueConverter.ToJsonValue(endpointDirectionEnum); + if (obj is EndpointEventTypeEnum endpointEventTypeEnum) + return EndpointEventTypeEnumValueConverter.ToJsonValue(endpointEventTypeEnum); + if (obj is EndpointStatusEnum endpointStatusEnum) + return EndpointStatusEnumValueConverter.ToJsonValue(endpointStatusEnum); + if (obj is EndpointTypeEnum endpointTypeEnum) + return EndpointTypeEnumValueConverter.ToJsonValue(endpointTypeEnum); + if (obj is FileFormatEnum fileFormatEnum) + return FileFormatEnumValueConverter.ToJsonValue(fileFormatEnum); + if (obj is InProgressLookupStatusEnum inProgressLookupStatusEnum) + return InProgressLookupStatusEnumValueConverter.ToJsonValue(inProgressLookupStatusEnum); + if (obj is InboundCallbackTypeEnum inboundCallbackTypeEnum) + return InboundCallbackTypeEnumValueConverter.ToJsonValue(inboundCallbackTypeEnum); + if (obj is LatestMessageDeliveryStatusEnum latestMessageDeliveryStatusEnum) + return LatestMessageDeliveryStatusEnumValueConverter.ToJsonValue(latestMessageDeliveryStatusEnum); + if (obj is LineTypeEnum lineTypeEnum) + return LineTypeEnumValueConverter.ToJsonValue(lineTypeEnum); + if (obj is ListMessageDirectionEnum listMessageDirectionEnum) + return ListMessageDirectionEnumValueConverter.ToJsonValue(listMessageDirectionEnum); + if (obj is MachineDetectionModeEnum machineDetectionModeEnum) + return MachineDetectionModeEnumValueConverter.ToJsonValue(machineDetectionModeEnum); + if (obj is MessageDirectionEnum messageDirectionEnum) + return MessageDirectionEnumValueConverter.ToJsonValue(messageDirectionEnum); + if (obj is MessageStatusEnum messageStatusEnum) + return MessageStatusEnumValueConverter.ToJsonValue(messageStatusEnum); + if (obj is MessageTypeEnum messageTypeEnum) + return MessageTypeEnumValueConverter.ToJsonValue(messageTypeEnum); + if (obj is MultiChannelMessageChannelEnum multiChannelMessageChannelEnum) + return MultiChannelMessageChannelEnumValueConverter.ToJsonValue(multiChannelMessageChannelEnum); + if (obj is PriorityEnum priorityEnum) + return PriorityEnumValueConverter.ToJsonValue(priorityEnum); + if (obj is ProductTypeEnum productTypeEnum) + return ProductTypeEnumValueConverter.ToJsonValue(productTypeEnum); + if (obj is RbmActionTypeEnum rbmActionTypeEnum) + return RbmActionTypeEnumValueConverter.ToJsonValue(rbmActionTypeEnum); + if (obj is RbmMediaHeightEnum rbmMediaHeightEnum) + return RbmMediaHeightEnumValueConverter.ToJsonValue(rbmMediaHeightEnum); + if (obj is RbmOpenUrlEnum rbmOpenUrlEnum) + return RbmOpenUrlEnumValueConverter.ToJsonValue(rbmOpenUrlEnum); + if (obj is RbmWebViewEnum rbmWebViewEnum) + return RbmWebViewEnumValueConverter.ToJsonValue(rbmWebViewEnum); + if (obj is RecordingStateEnum recordingStateEnum) + return RecordingStateEnumValueConverter.ToJsonValue(recordingStateEnum); + if (obj is RedirectMethodEnum redirectMethodEnum) + return RedirectMethodEnumValueConverter.ToJsonValue(redirectMethodEnum); + if (obj is StandaloneCardOrientationEnum standaloneCardOrientationEnum) + return StandaloneCardOrientationEnumValueConverter.ToJsonValue(standaloneCardOrientationEnum); + if (obj is StatusCallbackTypeEnum statusCallbackTypeEnum) + return StatusCallbackTypeEnumValueConverter.ToJsonValue(statusCallbackTypeEnum); + if (obj is TfvCallbackStatusEnum tfvCallbackStatusEnum) + return TfvCallbackStatusEnumValueConverter.ToJsonValue(tfvCallbackStatusEnum); + if (obj is TfvStatusEnum tfvStatusEnum) + return TfvStatusEnumValueConverter.ToJsonValue(tfvStatusEnum); + if (obj is ThumbnailAlignmentEnum thumbnailAlignmentEnum) + return ThumbnailAlignmentEnumValueConverter.ToJsonValue(thumbnailAlignmentEnum); + if (obj is WebhookSubscriptionTypeEnum webhookSubscriptionTypeEnum) + return WebhookSubscriptionTypeEnumValueConverter.ToJsonValue(webhookSubscriptionTypeEnum); + if (obj is ICollection collection) + { List entries = new List(); foreach (var entry in collection) - entries.Add(ParameterToString(entry, configuration)); + entries.Add(ParameterToString(entry)); return string.Join(",", entries); } - if (obj is Enum && HasEnumMemberAttrValue(obj)) - return GetEnumMemberAttrValue(obj); - return Convert.ToString(obj, CultureInfo.InvariantCulture); + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); } /// - /// Serializes the given object when not null. Otherwise return null. + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 /// - /// The object to serialize. - /// Serialized string. - public static string Serialize(object obj) + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) { - return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); } /// @@ -132,7 +243,7 @@ public static string Serialize(object obj) /// Encoded string. public static string Base64Encode(string text) { - return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); } /// @@ -191,7 +302,7 @@ public static string SelectHeaderAccept(string[] accepts) /// /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. /// - public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + private static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); /// /// Check if the given MIME is a JSON MIME. @@ -211,38 +322,65 @@ public static bool IsJsonMime(string mime) } /// - /// Is the Enum decorated with EnumMember Attribute + /// Get the discriminator /// - /// - /// true if found - private static bool HasEnumMemberAttrValue(object enumVal) + /// + /// + /// + /// + public static string GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) { - if (enumVal == null) - throw new ArgumentNullException(nameof(enumVal)); - var enumType = enumVal.GetType(); - var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); - var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); - if (attr != null) return true; - return false; - } + int currentDepth = utf8JsonReader.CurrentDepth; - /// - /// Get the EnumMember value - /// - /// - /// EnumMember value as string otherwise null - private static string GetEnumMemberAttrValue(object enumVal) - { - if (enumVal == null) - throw new ArgumentNullException(nameof(enumVal)); - var enumType = enumVal.GetType(); - var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); - var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); - if (attr != null) + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) { - return attr.Value; + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } } - return null; + + throw new JsonException("The specified discriminator was not found."); } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://localhost"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = ""; + + /// + /// The host of the API + /// + public const string HOST = "localhost"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; } } diff --git a/src/Bandwidth.Standard/Client/CookieContainer.cs b/src/Bandwidth.Standard/Client/CookieContainer.cs new file mode 100644 index 00000000..6a551aee --- /dev/null +++ b/src/Bandwidth.Standard/Client/CookieContainer.cs @@ -0,0 +1,18 @@ +// + +using System.Linq; +using System.Collections.Generic; + +namespace Bandwidth.Standard.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/src/Bandwidth.Standard/Client/DateTimeJsonConverter.cs b/src/Bandwidth.Standard/Client/DateTimeJsonConverter.cs new file mode 100644 index 00000000..4a679a53 --- /dev/null +++ b/src/Bandwidth.Standard/Client/DateTimeJsonConverter.cs @@ -0,0 +1,78 @@ +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Bandwidth.Standard.Client +{ + /// + /// Formatter for 'date' and 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyy'-'MM'-'dd", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + "yyyyMMdd" + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString(); + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/src/Bandwidth.Standard/Client/DateTimeNullableJsonConverter.cs b/src/Bandwidth.Standard/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 00000000..c74b91dd --- /dev/null +++ b/src/Bandwidth.Standard/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,83 @@ +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Bandwidth.Standard.Client +{ + /// + /// Formatter for 'date' and 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyy'-'MM'-'dd", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + "yyyyMMdd" + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString(); + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/src/Bandwidth.Standard/Client/ExceptionEventArgs.cs b/src/Bandwidth.Standard/Client/ExceptionEventArgs.cs new file mode 100644 index 00000000..36a04400 --- /dev/null +++ b/src/Bandwidth.Standard/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Bandwidth.Standard.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExceptionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/src/Bandwidth.Standard/Client/HostConfiguration.cs b/src/Bandwidth.Standard/Client/HostConfiguration.cs new file mode 100644 index 00000000..753607d9 --- /dev/null +++ b/src/Bandwidth.Standard/Client/HostConfiguration.cs @@ -0,0 +1,386 @@ +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Bandwidth.Standard.Api; +using Bandwidth.Standard.Model; + +namespace Bandwidth.Standard.Client +{ + /// + /// Provides hosting configuration for Bandwidth.Standard + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new AccountStatisticsJsonConverter()); + _jsonOptions.Converters.Add(new AdditionalDenialReasonJsonConverter()); + _jsonOptions.Converters.Add(new AddressJsonConverter()); + _jsonOptions.Converters.Add(new AnswerCallbackJsonConverter()); + _jsonOptions.Converters.Add(new AsyncLookupRequestJsonConverter()); + _jsonOptions.Converters.Add(new BlockedWebhookJsonConverter()); + _jsonOptions.Converters.Add(new BridgeCompleteCallbackJsonConverter()); + _jsonOptions.Converters.Add(new BridgeTargetCompleteCallbackJsonConverter()); + _jsonOptions.Converters.Add(new BusinessEntityTypeEnumJsonConverter()); + _jsonOptions.Converters.Add(new BusinessEntityTypeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new BusinessRegistrationTypeEnumJsonConverter()); + _jsonOptions.Converters.Add(new BusinessRegistrationTypeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new CallDirectionEnumJsonConverter()); + _jsonOptions.Converters.Add(new CallDirectionEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new CallRecordingMetadataJsonConverter()); + _jsonOptions.Converters.Add(new CallStateJsonConverter()); + _jsonOptions.Converters.Add(new CallStateEnumJsonConverter()); + _jsonOptions.Converters.Add(new CallStateEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new CallTranscriptionJsonConverter()); + _jsonOptions.Converters.Add(new CallTranscriptionDetectedLanguageEnumJsonConverter()); + _jsonOptions.Converters.Add(new CallTranscriptionDetectedLanguageEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new CallTranscriptionMetadataJsonConverter()); + _jsonOptions.Converters.Add(new CallTranscriptionResponseJsonConverter()); + _jsonOptions.Converters.Add(new CallTranscriptionTrackEnumJsonConverter()); + _jsonOptions.Converters.Add(new CallTranscriptionTrackEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new CallbackJsonConverter()); + _jsonOptions.Converters.Add(new CallbackMethodEnumJsonConverter()); + _jsonOptions.Converters.Add(new CallbackMethodEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new CardWidthEnumJsonConverter()); + _jsonOptions.Converters.Add(new CardWidthEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new CodeRequestJsonConverter()); + _jsonOptions.Converters.Add(new CompletedLookupStatusEnumJsonConverter()); + _jsonOptions.Converters.Add(new CompletedLookupStatusEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new ConferenceJsonConverter()); + _jsonOptions.Converters.Add(new ConferenceCompletedCallbackJsonConverter()); + _jsonOptions.Converters.Add(new ConferenceCreatedCallbackJsonConverter()); + _jsonOptions.Converters.Add(new ConferenceMemberJsonConverter()); + _jsonOptions.Converters.Add(new ConferenceMemberExitCallbackJsonConverter()); + _jsonOptions.Converters.Add(new ConferenceMemberJoinCallbackJsonConverter()); + _jsonOptions.Converters.Add(new ConferenceRecordingAvailableCallbackJsonConverter()); + _jsonOptions.Converters.Add(new ConferenceRecordingMetadataJsonConverter()); + _jsonOptions.Converters.Add(new ConferenceRedirectCallbackJsonConverter()); + _jsonOptions.Converters.Add(new ConferenceStateEnumJsonConverter()); + _jsonOptions.Converters.Add(new ConferenceStateEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new ContactJsonConverter()); + _jsonOptions.Converters.Add(new CreateAsyncBulkLookupResponseJsonConverter()); + _jsonOptions.Converters.Add(new CreateAsyncBulkLookupResponseDataJsonConverter()); + _jsonOptions.Converters.Add(new CreateCallJsonConverter()); + _jsonOptions.Converters.Add(new CreateCallResponseJsonConverter()); + _jsonOptions.Converters.Add(new CreateEndpointRequestBaseJsonConverter()); + _jsonOptions.Converters.Add(new CreateEndpointResponseJsonConverter()); + _jsonOptions.Converters.Add(new CreateEndpointResponseObjectJsonConverter()); + _jsonOptions.Converters.Add(new CreateMessageRequestErrorJsonConverter()); + _jsonOptions.Converters.Add(new CreateMultiChannelMessageResponseJsonConverter()); + _jsonOptions.Converters.Add(new CreateSyncLookupResponseJsonConverter()); + _jsonOptions.Converters.Add(new CreateSyncLookupResponseDataJsonConverter()); + _jsonOptions.Converters.Add(new CreateWebRtcConnectionRequestJsonConverter()); + _jsonOptions.Converters.Add(new DeactivationEventEnumJsonConverter()); + _jsonOptions.Converters.Add(new DeactivationEventEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new DeviceJsonConverter()); + _jsonOptions.Converters.Add(new DeviceStatusEnumJsonConverter()); + _jsonOptions.Converters.Add(new DeviceStatusEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new DisconnectCallbackJsonConverter()); + _jsonOptions.Converters.Add(new DiversionJsonConverter()); + _jsonOptions.Converters.Add(new DtmfCallbackJsonConverter()); + _jsonOptions.Converters.Add(new EndpointJsonConverter()); + _jsonOptions.Converters.Add(new EndpointDirectionEnumJsonConverter()); + _jsonOptions.Converters.Add(new EndpointDirectionEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new EndpointEventJsonConverter()); + _jsonOptions.Converters.Add(new EndpointEventTypeEnumJsonConverter()); + _jsonOptions.Converters.Add(new EndpointEventTypeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new EndpointResponseJsonConverter()); + _jsonOptions.Converters.Add(new EndpointStatusEnumJsonConverter()); + _jsonOptions.Converters.Add(new EndpointStatusEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new EndpointTypeEnumJsonConverter()); + _jsonOptions.Converters.Add(new EndpointTypeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new EndpointsJsonConverter()); + _jsonOptions.Converters.Add(new ErrorJsonConverter()); + _jsonOptions.Converters.Add(new ErrorObjectJsonConverter()); + _jsonOptions.Converters.Add(new ErrorResponseJsonConverter()); + _jsonOptions.Converters.Add(new ErrorSourceJsonConverter()); + _jsonOptions.Converters.Add(new FailureWebhookJsonConverter()); + _jsonOptions.Converters.Add(new FieldErrorJsonConverter()); + _jsonOptions.Converters.Add(new FileFormatEnumJsonConverter()); + _jsonOptions.Converters.Add(new FileFormatEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new GatherCallbackJsonConverter()); + _jsonOptions.Converters.Add(new GetAsyncBulkLookupResponseJsonConverter()); + _jsonOptions.Converters.Add(new GetAsyncBulkLookupResponseDataJsonConverter()); + _jsonOptions.Converters.Add(new InProgressLookupStatusEnumJsonConverter()); + _jsonOptions.Converters.Add(new InProgressLookupStatusEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new InboundCallbackJsonConverter()); + _jsonOptions.Converters.Add(new InboundCallbackMessageJsonConverter()); + _jsonOptions.Converters.Add(new InboundCallbackTypeEnumJsonConverter()); + _jsonOptions.Converters.Add(new InboundCallbackTypeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new InitiateCallbackJsonConverter()); + _jsonOptions.Converters.Add(new LatestMessageDeliveryStatusEnumJsonConverter()); + _jsonOptions.Converters.Add(new LatestMessageDeliveryStatusEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new LineTypeEnumJsonConverter()); + _jsonOptions.Converters.Add(new LineTypeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new LinkJsonConverter()); + _jsonOptions.Converters.Add(new LinkSchemaJsonConverter()); + _jsonOptions.Converters.Add(new LinksObjectJsonConverter()); + _jsonOptions.Converters.Add(new ListEndpointsResponseJsonConverter()); + _jsonOptions.Converters.Add(new ListMessageDirectionEnumJsonConverter()); + _jsonOptions.Converters.Add(new ListMessageDirectionEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new ListMessageItemJsonConverter()); + _jsonOptions.Converters.Add(new LookupErrorResponseJsonConverter()); + _jsonOptions.Converters.Add(new LookupErrorSchemaJsonConverter()); + _jsonOptions.Converters.Add(new LookupErrorSchemaMetaJsonConverter()); + _jsonOptions.Converters.Add(new LookupResultJsonConverter()); + _jsonOptions.Converters.Add(new MachineDetectionCompleteCallbackJsonConverter()); + _jsonOptions.Converters.Add(new MachineDetectionConfigurationJsonConverter()); + _jsonOptions.Converters.Add(new MachineDetectionModeEnumJsonConverter()); + _jsonOptions.Converters.Add(new MachineDetectionModeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new MachineDetectionResultJsonConverter()); + _jsonOptions.Converters.Add(new MediaJsonConverter()); + _jsonOptions.Converters.Add(new MessageJsonConverter()); + _jsonOptions.Converters.Add(new MessageDirectionEnumJsonConverter()); + _jsonOptions.Converters.Add(new MessageDirectionEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new MessageRequestJsonConverter()); + _jsonOptions.Converters.Add(new MessageStatusEnumJsonConverter()); + _jsonOptions.Converters.Add(new MessageStatusEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new MessageTypeEnumJsonConverter()); + _jsonOptions.Converters.Add(new MessageTypeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new MessagesListJsonConverter()); + _jsonOptions.Converters.Add(new MessagingCodeResponseJsonConverter()); + _jsonOptions.Converters.Add(new MessagingRequestErrorJsonConverter()); + _jsonOptions.Converters.Add(new MfaForbiddenRequestErrorJsonConverter()); + _jsonOptions.Converters.Add(new MfaRequestErrorJsonConverter()); + _jsonOptions.Converters.Add(new MfaUnauthorizedRequestErrorJsonConverter()); + _jsonOptions.Converters.Add(new MmsMessageContentJsonConverter()); + _jsonOptions.Converters.Add(new MmsMessageContentFileJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelActionJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelActionCalendarEventJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelChannelListMMSObjectJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelChannelListMMSResponseObjectJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelChannelListObjectBaseJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelChannelListOwnerObjectJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelChannelListRBMObjectJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelChannelListRBMObjectAllOfContentJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelChannelListRBMResponseObjectJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelChannelListRequestObjectJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelChannelListResponseObjectJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelChannelListSMSObjectJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelChannelListSMSResponseObjectJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelErrorJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelMessageChannelEnumJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelMessageChannelEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelMessageContentJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelMessageRequestJsonConverter()); + _jsonOptions.Converters.Add(new MultiChannelMessageResponseDataJsonConverter()); + _jsonOptions.Converters.Add(new OptInWorkflowJsonConverter()); + _jsonOptions.Converters.Add(new PageJsonConverter()); + _jsonOptions.Converters.Add(new PageInfoJsonConverter()); + _jsonOptions.Converters.Add(new PriorityEnumJsonConverter()); + _jsonOptions.Converters.Add(new PriorityEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new ProductTypeEnumJsonConverter()); + _jsonOptions.Converters.Add(new ProductTypeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new RbmActionBaseJsonConverter()); + _jsonOptions.Converters.Add(new RbmActionDialJsonConverter()); + _jsonOptions.Converters.Add(new RbmActionOpenUrlJsonConverter()); + _jsonOptions.Converters.Add(new RbmActionTypeEnumJsonConverter()); + _jsonOptions.Converters.Add(new RbmActionTypeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new RbmActionViewLocationJsonConverter()); + _jsonOptions.Converters.Add(new RbmCardContentJsonConverter()); + _jsonOptions.Converters.Add(new RbmCardContentMediaJsonConverter()); + _jsonOptions.Converters.Add(new RbmLocationResponseJsonConverter()); + _jsonOptions.Converters.Add(new RbmMediaHeightEnumJsonConverter()); + _jsonOptions.Converters.Add(new RbmMediaHeightEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new RbmMessageCarouselCardJsonConverter()); + _jsonOptions.Converters.Add(new RbmMessageContentFileJsonConverter()); + _jsonOptions.Converters.Add(new RbmMessageContentRichCardJsonConverter()); + _jsonOptions.Converters.Add(new RbmMessageContentTextJsonConverter()); + _jsonOptions.Converters.Add(new RbmMessageMediaJsonConverter()); + _jsonOptions.Converters.Add(new RbmOpenUrlEnumJsonConverter()); + _jsonOptions.Converters.Add(new RbmOpenUrlEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new RbmStandaloneCardJsonConverter()); + _jsonOptions.Converters.Add(new RbmSuggestionResponseJsonConverter()); + _jsonOptions.Converters.Add(new RbmWebViewEnumJsonConverter()); + _jsonOptions.Converters.Add(new RbmWebViewEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new RecordingAvailableCallbackJsonConverter()); + _jsonOptions.Converters.Add(new RecordingCompleteCallbackJsonConverter()); + _jsonOptions.Converters.Add(new RecordingStateEnumJsonConverter()); + _jsonOptions.Converters.Add(new RecordingStateEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new RecordingTranscriptionMetadataJsonConverter()); + _jsonOptions.Converters.Add(new RecordingTranscriptionsJsonConverter()); + _jsonOptions.Converters.Add(new RedirectCallbackJsonConverter()); + _jsonOptions.Converters.Add(new RedirectMethodEnumJsonConverter()); + _jsonOptions.Converters.Add(new RedirectMethodEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new SipConnectionMetadataJsonConverter()); + _jsonOptions.Converters.Add(new SipCredentialsJsonConverter()); + _jsonOptions.Converters.Add(new SmsMessageContentJsonConverter()); + _jsonOptions.Converters.Add(new StandaloneCardOrientationEnumJsonConverter()); + _jsonOptions.Converters.Add(new StandaloneCardOrientationEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new StatusCallbackJsonConverter()); + _jsonOptions.Converters.Add(new StatusCallbackMessageJsonConverter()); + _jsonOptions.Converters.Add(new StatusCallbackTypeEnumJsonConverter()); + _jsonOptions.Converters.Add(new StatusCallbackTypeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new StirShakenJsonConverter()); + _jsonOptions.Converters.Add(new SyncLookupRequestJsonConverter()); + _jsonOptions.Converters.Add(new TelephoneNumberJsonConverter()); + _jsonOptions.Converters.Add(new TfvBasicAuthenticationJsonConverter()); + _jsonOptions.Converters.Add(new TfvCallbackStatusEnumJsonConverter()); + _jsonOptions.Converters.Add(new TfvCallbackStatusEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new TfvErrorJsonConverter()); + _jsonOptions.Converters.Add(new TfvStatusJsonConverter()); + _jsonOptions.Converters.Add(new TfvStatusEnumJsonConverter()); + _jsonOptions.Converters.Add(new TfvStatusEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new TfvSubmissionInfoJsonConverter()); + _jsonOptions.Converters.Add(new TfvSubmissionWrapperJsonConverter()); + _jsonOptions.Converters.Add(new ThumbnailAlignmentEnumJsonConverter()); + _jsonOptions.Converters.Add(new ThumbnailAlignmentEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new TranscribeRecordingJsonConverter()); + _jsonOptions.Converters.Add(new TranscriptionJsonConverter()); + _jsonOptions.Converters.Add(new TranscriptionAvailableCallbackJsonConverter()); + _jsonOptions.Converters.Add(new TransferAnswerCallbackJsonConverter()); + _jsonOptions.Converters.Add(new TransferCompleteCallbackJsonConverter()); + _jsonOptions.Converters.Add(new TransferDisconnectCallbackJsonConverter()); + _jsonOptions.Converters.Add(new UpdateCallJsonConverter()); + _jsonOptions.Converters.Add(new UpdateCallRecordingJsonConverter()); + _jsonOptions.Converters.Add(new UpdateConferenceJsonConverter()); + _jsonOptions.Converters.Add(new UpdateConferenceMemberJsonConverter()); + _jsonOptions.Converters.Add(new VerificationDenialWebhookJsonConverter()); + _jsonOptions.Converters.Add(new VerificationRequestJsonConverter()); + _jsonOptions.Converters.Add(new VerificationUpdateRequestJsonConverter()); + _jsonOptions.Converters.Add(new VerificationWebhookJsonConverter()); + _jsonOptions.Converters.Add(new VerifyCodeRequestJsonConverter()); + _jsonOptions.Converters.Add(new VerifyCodeResponseJsonConverter()); + _jsonOptions.Converters.Add(new VoiceApiErrorJsonConverter()); + _jsonOptions.Converters.Add(new VoiceCodeResponseJsonConverter()); + _jsonOptions.Converters.Add(new WebhookSubscriptionJsonConverter()); + _jsonOptions.Converters.Add(new WebhookSubscriptionBasicAuthenticationJsonConverter()); + _jsonOptions.Converters.Add(new WebhookSubscriptionRequestSchemaJsonConverter()); + _jsonOptions.Converters.Add(new WebhookSubscriptionTypeEnumJsonConverter()); + _jsonOptions.Converters.Add(new WebhookSubscriptionTypeEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new WebhookSubscriptionsListBodyJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddSingleton(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddBandwidthHttpClients + ( + Action client = null, Action builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/src/Bandwidth.Standard/Client/JsonSerializerOptionsProvider.cs b/src/Bandwidth.Standard/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 00000000..10292ac4 --- /dev/null +++ b/src/Bandwidth.Standard/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,25 @@ +// + +using System.Text.Json; + +namespace Bandwidth.Standard.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/src/Bandwidth.Standard/Client/OAuthToken.cs b/src/Bandwidth.Standard/Client/OAuthToken.cs new file mode 100644 index 00000000..a2a4e1bc --- /dev/null +++ b/src/Bandwidth.Standard/Client/OAuthToken.cs @@ -0,0 +1,37 @@ +// + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Bandwidth.Standard.Client +{ + /// + /// A token constructed with OAuth. + /// + public class OAuthToken : TokenBase + { + private string _raw; + + /// + /// Consturcts an OAuthToken object. + /// + /// + /// + public OAuthToken(string value, TimeSpan? timeout = null) : base(timeout) + { + _raw = value; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); + } + } +} \ No newline at end of file diff --git a/src/Bandwidth.Standard/Client/Option.cs b/src/Bandwidth.Standard/Client/Option.cs new file mode 100644 index 00000000..7af7d530 --- /dev/null +++ b/src/Bandwidth.Standard/Client/Option.cs @@ -0,0 +1,52 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +namespace Bandwidth.Standard.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/src/Bandwidth.Standard/Client/RateLimitProvider`1.cs b/src/Bandwidth.Standard/Client/RateLimitProvider`1.cs new file mode 100644 index 00000000..600a52b8 --- /dev/null +++ b/src/Bandwidth.Standard/Client/RateLimitProvider`1.cs @@ -0,0 +1,57 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Bandwidth.Standard.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new Dictionary>(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + global::System.Threading.Channels.BoundedChannelOptions options = new global::System.Threading.Channels.BoundedChannelOptions(_tokens.Length) + { + FullMode = global::System.Threading.Channels.BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, global::System.Threading.Channels.Channel.CreateBounded(options)); + + foreach (var availableToken in AvailableTokens) + foreach(TTokenBase token in _tokens) + { + token.TokenBecameAvailable += ((sender) => availableToken.Value.Writer.TryWrite((TTokenBase)sender)); + } + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out global::System.Threading.Channels.Channel tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/src/Bandwidth.Standard/Client/TokenBase.cs b/src/Bandwidth.Standard/Client/TokenBase.cs new file mode 100644 index 00000000..cf1291a0 --- /dev/null +++ b/src/Bandwidth.Standard/Client/TokenBase.cs @@ -0,0 +1,69 @@ +// + +using System; + +namespace Bandwidth.Standard.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/src/Bandwidth.Standard/Client/TokenContainer`1.cs b/src/Bandwidth.Standard/Client/TokenContainer`1.cs new file mode 100644 index 00000000..5b093ef7 --- /dev/null +++ b/src/Bandwidth.Standard/Client/TokenContainer`1.cs @@ -0,0 +1,35 @@ +// + +using System.Linq; +using System.Collections.Generic; + +namespace Bandwidth.Standard.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/src/Bandwidth.Standard/Client/TokenProvider`1.cs b/src/Bandwidth.Standard/Client/TokenProvider`1.cs new file mode 100644 index 00000000..694335f9 --- /dev/null +++ b/src/Bandwidth.Standard/Client/TokenProvider`1.cs @@ -0,0 +1,43 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.Collections.Generic; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/src/Bandwidth.Standard/Extensions/IHostBuilderExtensions.cs b/src/Bandwidth.Standard/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 00000000..79066000 --- /dev/null +++ b/src/Bandwidth.Standard/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,42 @@ +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureBandwidth(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddBandwidth(services, config); + }); + + return builder; + } + } +} diff --git a/src/Bandwidth.Standard/Extensions/IHttpClientBuilderExtensions.cs b/src/Bandwidth.Standard/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 00000000..fb976410 --- /dev/null +++ b/src/Bandwidth.Standard/Extensions/IHttpClientBuilderExtensions.cs @@ -0,0 +1,78 @@ +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Bandwidth.Standard.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/src/Bandwidth.Standard/Extensions/IServiceCollectionExtensions.cs b/src/Bandwidth.Standard/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 00000000..91556a03 --- /dev/null +++ b/src/Bandwidth.Standard/Extensions/IServiceCollectionExtensions.cs @@ -0,0 +1,62 @@ +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddBandwidth(this IServiceCollection services, Action options) + { + HostConfiguration config = new HostConfiguration(services); + options(config); + AddBandwidth(services, config); + } + + internal static void AddBandwidth(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddBandwidthHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/src/Bandwidth.Standard/Model/Endpoint.cs b/src/Bandwidth.Standard/Model/Endpoint.cs new file mode 100644 index 00000000..f263a28d --- /dev/null +++ b/src/Bandwidth.Standard/Model/Endpoint.cs @@ -0,0 +1,331 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// Endpoint + /// + public partial class Endpoint : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The unique ID of the endpoint. + /// type + /// status + /// The time the endpoint was created. In ISO-8601 format. + /// The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + /// A tag for the endpoint. + /// devices + [JsonConstructor] + public Endpoint(string endpointId, EndpointTypeEnum type, EndpointStatusEnum status, DateTime creationTimestamp, DateTime expirationTimestamp, Option tag = default, Option> devices = default) + { + EndpointId = endpointId; + Type = type; + Status = status; + CreationTimestamp = creationTimestamp; + ExpirationTimestamp = expirationTimestamp; + TagOption = tag; + DevicesOption = devices; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Type + /// + [JsonPropertyName("type")] + public EndpointTypeEnum Type { get; set; } + + /// + /// Gets or Sets Status + /// + [JsonPropertyName("status")] + public EndpointStatusEnum Status { get; set; } + + /// + /// The unique ID of the endpoint. + /// + /// The unique ID of the endpoint. + /* e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 */ + [JsonPropertyName("endpointId")] + public string EndpointId { get; set; } + + /// + /// The time the endpoint was created. In ISO-8601 format. + /// + /// The time the endpoint was created. In ISO-8601 format. + /* 2021-01-01T00:00Z */ + [JsonPropertyName("creationTimestamp")] + public DateTime CreationTimestamp { get; set; } + + /// + /// The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + /// + /// The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + /* 2021-01-02T00:00Z */ + [JsonPropertyName("expirationTimestamp")] + public DateTime ExpirationTimestamp { get; set; } + + /// + /// Used to track the state of Tag + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TagOption { get; private set; } + + /// + /// A tag for the endpoint. + /// + /// A tag for the endpoint. + /* my-tag */ + [JsonPropertyName("tag")] + public string Tag { get { return this.TagOption; } set { this.TagOption = new Option(value); } } + + /// + /// Used to track the state of Devices + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> DevicesOption { get; private set; } + + /// + /// Gets or Sets Devices + /// + [JsonPropertyName("devices")] + public List Devices { get { return this.DevicesOption; } set { this.DevicesOption = new Option>(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Endpoint {\n"); + sb.Append(" EndpointId: ").Append(EndpointId).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" CreationTimestamp: ").Append(CreationTimestamp).Append("\n"); + sb.Append(" ExpirationTimestamp: ").Append(ExpirationTimestamp).Append("\n"); + sb.Append(" Tag: ").Append(Tag).Append("\n"); + sb.Append(" Devices: ").Append(Devices).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EndpointJsonConverter : JsonConverter + { + /// + /// The format to use to serialize CreationTimestamp + /// + public static string CreationTimestampFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize ExpirationTimestamp + /// + public static string ExpirationTimestampFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Endpoint Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option endpointId = default; + Option type = default; + Option status = default; + Option creationTimestamp = default; + Option expirationTimestamp = default; + Option tag = default; + Option> devices = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "endpointId": + endpointId = new Option(utf8JsonReader.GetString()); + break; + case "type": + string typeRawValue = utf8JsonReader.GetString(); + if (typeRawValue != null) + type = new Option(EndpointTypeEnumValueConverter.FromStringOrDefault(typeRawValue)); + break; + case "status": + string statusRawValue = utf8JsonReader.GetString(); + if (statusRawValue != null) + status = new Option(EndpointStatusEnumValueConverter.FromStringOrDefault(statusRawValue)); + break; + case "creationTimestamp": + creationTimestamp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "expirationTimestamp": + expirationTimestamp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "tag": + tag = new Option(utf8JsonReader.GetString()); + break; + case "devices": + devices = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (!endpointId.IsSet) + throw new ArgumentException("Property is required for class Endpoint.", nameof(endpointId)); + + if (!type.IsSet) + throw new ArgumentException("Property is required for class Endpoint.", nameof(type)); + + if (!status.IsSet) + throw new ArgumentException("Property is required for class Endpoint.", nameof(status)); + + if (!creationTimestamp.IsSet) + throw new ArgumentException("Property is required for class Endpoint.", nameof(creationTimestamp)); + + if (!expirationTimestamp.IsSet) + throw new ArgumentException("Property is required for class Endpoint.", nameof(expirationTimestamp)); + + if (endpointId.IsSet && endpointId.Value == null) + throw new ArgumentNullException(nameof(endpointId), "Property is not nullable for class Endpoint."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Endpoint."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Endpoint."); + + if (creationTimestamp.IsSet && creationTimestamp.Value == null) + throw new ArgumentNullException(nameof(creationTimestamp), "Property is not nullable for class Endpoint."); + + if (expirationTimestamp.IsSet && expirationTimestamp.Value == null) + throw new ArgumentNullException(nameof(expirationTimestamp), "Property is not nullable for class Endpoint."); + + if (tag.IsSet && tag.Value == null) + throw new ArgumentNullException(nameof(tag), "Property is not nullable for class Endpoint."); + + if (devices.IsSet && devices.Value == null) + throw new ArgumentNullException(nameof(devices), "Property is not nullable for class Endpoint."); + + return new Endpoint(endpointId.Value, type.Value.Value, status.Value.Value, creationTimestamp.Value.Value, expirationTimestamp.Value.Value, tag, devices); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Endpoint endpoint, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, endpoint, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Endpoint endpoint, JsonSerializerOptions jsonSerializerOptions) + { + if (endpoint.EndpointId == null) + throw new ArgumentNullException(nameof(endpoint.EndpointId), "Property is required for class Endpoint."); + + if (endpoint.TagOption.IsSet && endpoint.Tag == null) + throw new ArgumentNullException(nameof(endpoint.Tag), "Property is required for class Endpoint."); + + if (endpoint.DevicesOption.IsSet && endpoint.Devices == null) + throw new ArgumentNullException(nameof(endpoint.Devices), "Property is required for class Endpoint."); + + writer.WriteString("endpointId", endpoint.EndpointId); + + var typeRawValue = EndpointTypeEnumValueConverter.ToJsonValue(endpoint.Type); + writer.WriteString("type", typeRawValue); + + var statusRawValue = EndpointStatusEnumValueConverter.ToJsonValue(endpoint.Status); + writer.WriteString("status", statusRawValue); + + writer.WriteString("creationTimestamp", endpoint.CreationTimestamp.ToString(CreationTimestampFormat)); + + writer.WriteString("expirationTimestamp", endpoint.ExpirationTimestamp.ToString(ExpirationTimestampFormat)); + + if (endpoint.TagOption.IsSet) + writer.WriteString("tag", endpoint.Tag); + + if (endpoint.DevicesOption.IsSet) + { + writer.WritePropertyName("devices"); + JsonSerializer.Serialize(writer, endpoint.Devices, jsonSerializerOptions); + } + } + } +} diff --git a/src/Bandwidth.Standard/Model/EndpointDirectionEnum.cs b/src/Bandwidth.Standard/Model/EndpointDirectionEnum.cs new file mode 100644 index 00000000..21476f70 --- /dev/null +++ b/src/Bandwidth.Standard/Model/EndpointDirectionEnum.cs @@ -0,0 +1,188 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// Defines endpointDirectionEnum + /// + public enum EndpointDirectionEnum + { + /// + /// Enum INBOUND for value: INBOUND + /// + INBOUND = 1, + + /// + /// Enum OUTBOUND for value: OUTBOUND + /// + OUTBOUND = 2, + + /// + /// Enum BIDIRECTIONAL for value: BIDIRECTIONAL + /// + BIDIRECTIONAL = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class EndpointDirectionEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EndpointDirectionEnum FromString(string value) + { + if (value.Equals("INBOUND")) + return EndpointDirectionEnum.INBOUND; + + if (value.Equals("OUTBOUND")) + return EndpointDirectionEnum.OUTBOUND; + + if (value.Equals("BIDIRECTIONAL")) + return EndpointDirectionEnum.BIDIRECTIONAL; + + throw new NotImplementedException($"Could not convert value to type EndpointDirectionEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EndpointDirectionEnum? FromStringOrDefault(string value) + { + if (value.Equals("INBOUND")) + return EndpointDirectionEnum.INBOUND; + + if (value.Equals("OUTBOUND")) + return EndpointDirectionEnum.OUTBOUND; + + if (value.Equals("BIDIRECTIONAL")) + return EndpointDirectionEnum.BIDIRECTIONAL; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(EndpointDirectionEnum value) + { + if (value == EndpointDirectionEnum.INBOUND) + return "INBOUND"; + + if (value == EndpointDirectionEnum.OUTBOUND) + return "OUTBOUND"; + + if (value == EndpointDirectionEnum.BIDIRECTIONAL) + return "BIDIRECTIONAL"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class EndpointDirectionEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EndpointDirectionEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EndpointDirectionEnum? result = rawValue == null + ? null + : EndpointDirectionEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EndpointDirectionEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EndpointDirectionEnum endpointDirectionEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(EndpointDirectionEnumValueConverter.ToJsonValue(endpointDirectionEnum).ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EndpointDirectionEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a EndpointDirectionEnum from the Json object + /// + /// + /// + /// + /// + public override EndpointDirectionEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EndpointDirectionEnum? result = rawValue == null + ? null + : EndpointDirectionEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EndpointDirectionEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EndpointDirectionEnum? endpointDirectionEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(endpointDirectionEnum.HasValue ? EndpointDirectionEnumValueConverter.ToJsonValue(endpointDirectionEnum.Value).ToString() : "null"); + } + } +} diff --git a/src/Bandwidth.Standard/Model/EndpointEvent.cs b/src/Bandwidth.Standard/Model/EndpointEvent.cs new file mode 100644 index 00000000..34223fea --- /dev/null +++ b/src/Bandwidth.Standard/Model/EndpointEvent.cs @@ -0,0 +1,383 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// An event that occurred on an endpoint. + /// + public partial class EndpointEvent : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The unique ID of the endpoint. + /// type + /// status + /// The time the endpoint was created. In ISO-8601 format. + /// The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + /// The time the event occurred. In ISO-8601 format. + /// eventType + /// A tag for the endpoint. + /// device + [JsonConstructor] + public EndpointEvent(string endpointId, EndpointTypeEnum type, EndpointStatusEnum status, DateTime creationTimestamp, DateTime expirationTimestamp, DateTime eventTime, EndpointEventTypeEnum eventType, Option tag = default, Option device = default) + { + EndpointId = endpointId; + Type = type; + Status = status; + CreationTimestamp = creationTimestamp; + ExpirationTimestamp = expirationTimestamp; + EventTime = eventTime; + EventType = eventType; + TagOption = tag; + DeviceOption = device; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Type + /// + [JsonPropertyName("type")] + public EndpointTypeEnum Type { get; set; } + + /// + /// Gets or Sets Status + /// + [JsonPropertyName("status")] + public EndpointStatusEnum Status { get; set; } + + /// + /// Gets or Sets EventType + /// + [JsonPropertyName("eventType")] + public EndpointEventTypeEnum EventType { get; set; } + + /// + /// The unique ID of the endpoint. + /// + /// The unique ID of the endpoint. + /* e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 */ + [JsonPropertyName("endpointId")] + public string EndpointId { get; set; } + + /// + /// The time the endpoint was created. In ISO-8601 format. + /// + /// The time the endpoint was created. In ISO-8601 format. + /* 2021-01-01T00:00Z */ + [JsonPropertyName("creationTimestamp")] + public DateTime CreationTimestamp { get; set; } + + /// + /// The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + /// + /// The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + /* 2021-01-02T00:00Z */ + [JsonPropertyName("expirationTimestamp")] + public DateTime ExpirationTimestamp { get; set; } + + /// + /// The time the event occurred. In ISO-8601 format. + /// + /// The time the event occurred. In ISO-8601 format. + /* 2021-01-01T00:00Z */ + [JsonPropertyName("eventTime")] + public DateTime EventTime { get; set; } + + /// + /// Used to track the state of Tag + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TagOption { get; private set; } + + /// + /// A tag for the endpoint. + /// + /// A tag for the endpoint. + /* my-tag */ + [JsonPropertyName("tag")] + public string Tag { get { return this.TagOption; } set { this.TagOption = new Option(value); } } + + /// + /// Used to track the state of Device + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeviceOption { get; private set; } + + /// + /// Gets or Sets Device + /// + [JsonPropertyName("device")] + public Device Device { get { return this.DeviceOption; } set { this.DeviceOption = new Option(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EndpointEvent {\n"); + sb.Append(" EndpointId: ").Append(EndpointId).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" CreationTimestamp: ").Append(CreationTimestamp).Append("\n"); + sb.Append(" ExpirationTimestamp: ").Append(ExpirationTimestamp).Append("\n"); + sb.Append(" EventTime: ").Append(EventTime).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" Tag: ").Append(Tag).Append("\n"); + sb.Append(" Device: ").Append(Device).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EndpointEventJsonConverter : JsonConverter + { + /// + /// The format to use to serialize CreationTimestamp + /// + public static string CreationTimestampFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize ExpirationTimestamp + /// + public static string ExpirationTimestampFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize EventTime + /// + public static string EventTimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EndpointEvent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option endpointId = default; + Option type = default; + Option status = default; + Option creationTimestamp = default; + Option expirationTimestamp = default; + Option eventTime = default; + Option eventType = default; + Option tag = default; + Option device = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "endpointId": + endpointId = new Option(utf8JsonReader.GetString()); + break; + case "type": + string typeRawValue = utf8JsonReader.GetString(); + if (typeRawValue != null) + type = new Option(EndpointTypeEnumValueConverter.FromStringOrDefault(typeRawValue)); + break; + case "status": + string statusRawValue = utf8JsonReader.GetString(); + if (statusRawValue != null) + status = new Option(EndpointStatusEnumValueConverter.FromStringOrDefault(statusRawValue)); + break; + case "creationTimestamp": + creationTimestamp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "expirationTimestamp": + expirationTimestamp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "eventTime": + eventTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "eventType": + string eventTypeRawValue = utf8JsonReader.GetString(); + if (eventTypeRawValue != null) + eventType = new Option(EndpointEventTypeEnumValueConverter.FromStringOrDefault(eventTypeRawValue)); + break; + case "tag": + tag = new Option(utf8JsonReader.GetString()); + break; + case "device": + device = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (!endpointId.IsSet) + throw new ArgumentException("Property is required for class EndpointEvent.", nameof(endpointId)); + + if (!type.IsSet) + throw new ArgumentException("Property is required for class EndpointEvent.", nameof(type)); + + if (!status.IsSet) + throw new ArgumentException("Property is required for class EndpointEvent.", nameof(status)); + + if (!creationTimestamp.IsSet) + throw new ArgumentException("Property is required for class EndpointEvent.", nameof(creationTimestamp)); + + if (!expirationTimestamp.IsSet) + throw new ArgumentException("Property is required for class EndpointEvent.", nameof(expirationTimestamp)); + + if (!eventTime.IsSet) + throw new ArgumentException("Property is required for class EndpointEvent.", nameof(eventTime)); + + if (!eventType.IsSet) + throw new ArgumentException("Property is required for class EndpointEvent.", nameof(eventType)); + + if (endpointId.IsSet && endpointId.Value == null) + throw new ArgumentNullException(nameof(endpointId), "Property is not nullable for class EndpointEvent."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class EndpointEvent."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class EndpointEvent."); + + if (creationTimestamp.IsSet && creationTimestamp.Value == null) + throw new ArgumentNullException(nameof(creationTimestamp), "Property is not nullable for class EndpointEvent."); + + if (expirationTimestamp.IsSet && expirationTimestamp.Value == null) + throw new ArgumentNullException(nameof(expirationTimestamp), "Property is not nullable for class EndpointEvent."); + + if (eventTime.IsSet && eventTime.Value == null) + throw new ArgumentNullException(nameof(eventTime), "Property is not nullable for class EndpointEvent."); + + if (eventType.IsSet && eventType.Value == null) + throw new ArgumentNullException(nameof(eventType), "Property is not nullable for class EndpointEvent."); + + if (tag.IsSet && tag.Value == null) + throw new ArgumentNullException(nameof(tag), "Property is not nullable for class EndpointEvent."); + + if (device.IsSet && device.Value == null) + throw new ArgumentNullException(nameof(device), "Property is not nullable for class EndpointEvent."); + + return new EndpointEvent(endpointId.Value, type.Value.Value, status.Value.Value, creationTimestamp.Value.Value, expirationTimestamp.Value.Value, eventTime.Value.Value, eventType.Value.Value, tag, device); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EndpointEvent endpointEvent, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, endpointEvent, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EndpointEvent endpointEvent, JsonSerializerOptions jsonSerializerOptions) + { + if (endpointEvent.EndpointId == null) + throw new ArgumentNullException(nameof(endpointEvent.EndpointId), "Property is required for class EndpointEvent."); + + if (endpointEvent.TagOption.IsSet && endpointEvent.Tag == null) + throw new ArgumentNullException(nameof(endpointEvent.Tag), "Property is required for class EndpointEvent."); + + if (endpointEvent.DeviceOption.IsSet && endpointEvent.Device == null) + throw new ArgumentNullException(nameof(endpointEvent.Device), "Property is required for class EndpointEvent."); + + writer.WriteString("endpointId", endpointEvent.EndpointId); + + var typeRawValue = EndpointTypeEnumValueConverter.ToJsonValue(endpointEvent.Type); + writer.WriteString("type", typeRawValue); + + var statusRawValue = EndpointStatusEnumValueConverter.ToJsonValue(endpointEvent.Status); + writer.WriteString("status", statusRawValue); + + writer.WriteString("creationTimestamp", endpointEvent.CreationTimestamp.ToString(CreationTimestampFormat)); + + writer.WriteString("expirationTimestamp", endpointEvent.ExpirationTimestamp.ToString(ExpirationTimestampFormat)); + + writer.WriteString("eventTime", endpointEvent.EventTime.ToString(EventTimeFormat)); + + var eventTypeRawValue = EndpointEventTypeEnumValueConverter.ToJsonValue(endpointEvent.EventType); + writer.WriteString("eventType", eventTypeRawValue); + + if (endpointEvent.TagOption.IsSet) + writer.WriteString("tag", endpointEvent.Tag); + + if (endpointEvent.DeviceOption.IsSet) + { + writer.WritePropertyName("device"); + JsonSerializer.Serialize(writer, endpointEvent.Device, jsonSerializerOptions); + } + } + } +} diff --git a/src/Bandwidth.Standard/Model/EndpointEventTypeEnum.cs b/src/Bandwidth.Standard/Model/EndpointEventTypeEnum.cs new file mode 100644 index 00000000..8ada946d --- /dev/null +++ b/src/Bandwidth.Standard/Model/EndpointEventTypeEnum.cs @@ -0,0 +1,174 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// Defines endpointEventTypeEnum + /// + public enum EndpointEventTypeEnum + { + /// + /// Enum DEVICECONNECTED for value: DEVICE_CONNECTED + /// + DEVICECONNECTED = 1, + + /// + /// Enum DEVICEDISCONNECTED for value: DEVICE_DISCONNECTED + /// + DEVICEDISCONNECTED = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class EndpointEventTypeEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EndpointEventTypeEnum FromString(string value) + { + if (value.Equals("DEVICE_CONNECTED")) + return EndpointEventTypeEnum.DEVICECONNECTED; + + if (value.Equals("DEVICE_DISCONNECTED")) + return EndpointEventTypeEnum.DEVICEDISCONNECTED; + + throw new NotImplementedException($"Could not convert value to type EndpointEventTypeEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EndpointEventTypeEnum? FromStringOrDefault(string value) + { + if (value.Equals("DEVICE_CONNECTED")) + return EndpointEventTypeEnum.DEVICECONNECTED; + + if (value.Equals("DEVICE_DISCONNECTED")) + return EndpointEventTypeEnum.DEVICEDISCONNECTED; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(EndpointEventTypeEnum value) + { + if (value == EndpointEventTypeEnum.DEVICECONNECTED) + return "DEVICE_CONNECTED"; + + if (value == EndpointEventTypeEnum.DEVICEDISCONNECTED) + return "DEVICE_DISCONNECTED"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class EndpointEventTypeEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EndpointEventTypeEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EndpointEventTypeEnum? result = rawValue == null + ? null + : EndpointEventTypeEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EndpointEventTypeEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EndpointEventTypeEnum endpointEventTypeEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(EndpointEventTypeEnumValueConverter.ToJsonValue(endpointEventTypeEnum).ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EndpointEventTypeEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a EndpointEventTypeEnum from the Json object + /// + /// + /// + /// + /// + public override EndpointEventTypeEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EndpointEventTypeEnum? result = rawValue == null + ? null + : EndpointEventTypeEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EndpointEventTypeEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EndpointEventTypeEnum? endpointEventTypeEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(endpointEventTypeEnum.HasValue ? EndpointEventTypeEnumValueConverter.ToJsonValue(endpointEventTypeEnum.Value).ToString() : "null"); + } + } +} diff --git a/src/Bandwidth.Standard/Model/EndpointResponse.cs b/src/Bandwidth.Standard/Model/EndpointResponse.cs new file mode 100644 index 00000000..76eb14ae --- /dev/null +++ b/src/Bandwidth.Standard/Model/EndpointResponse.cs @@ -0,0 +1,211 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// EndpointResponse + /// + public partial class EndpointResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// links + /// data + /// errors + [JsonConstructor] + public EndpointResponse(List links, Endpoint data, List errors) + { + Links = links; + Data = data; + Errors = errors; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Links + /// + [JsonPropertyName("links")] + public List Links { get; set; } + + /// + /// Gets or Sets Data + /// + [JsonPropertyName("data")] + public Endpoint Data { get; set; } + + /// + /// Gets or Sets Errors + /// + [JsonPropertyName("errors")] + public List Errors { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EndpointResponse {\n"); + sb.Append(" Links: ").Append(Links).Append("\n"); + sb.Append(" Data: ").Append(Data).Append("\n"); + sb.Append(" Errors: ").Append(Errors).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EndpointResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EndpointResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> links = default; + Option data = default; + Option> errors = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "links": + links = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "data": + data = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "errors": + errors = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (!links.IsSet) + throw new ArgumentException("Property is required for class EndpointResponse.", nameof(links)); + + if (!data.IsSet) + throw new ArgumentException("Property is required for class EndpointResponse.", nameof(data)); + + if (!errors.IsSet) + throw new ArgumentException("Property is required for class EndpointResponse.", nameof(errors)); + + if (links.IsSet && links.Value == null) + throw new ArgumentNullException(nameof(links), "Property is not nullable for class EndpointResponse."); + + if (data.IsSet && data.Value == null) + throw new ArgumentNullException(nameof(data), "Property is not nullable for class EndpointResponse."); + + if (errors.IsSet && errors.Value == null) + throw new ArgumentNullException(nameof(errors), "Property is not nullable for class EndpointResponse."); + + return new EndpointResponse(links.Value, data.Value, errors.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EndpointResponse endpointResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, endpointResponse, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EndpointResponse endpointResponse, JsonSerializerOptions jsonSerializerOptions) + { + if (endpointResponse.Links == null) + throw new ArgumentNullException(nameof(endpointResponse.Links), "Property is required for class EndpointResponse."); + + if (endpointResponse.Data == null) + throw new ArgumentNullException(nameof(endpointResponse.Data), "Property is required for class EndpointResponse."); + + if (endpointResponse.Errors == null) + throw new ArgumentNullException(nameof(endpointResponse.Errors), "Property is required for class EndpointResponse."); + + writer.WritePropertyName("links"); + JsonSerializer.Serialize(writer, endpointResponse.Links, jsonSerializerOptions); + writer.WritePropertyName("data"); + JsonSerializer.Serialize(writer, endpointResponse.Data, jsonSerializerOptions); + writer.WritePropertyName("errors"); + JsonSerializer.Serialize(writer, endpointResponse.Errors, jsonSerializerOptions); + } + } +} diff --git a/src/Bandwidth.Standard/Model/EndpointStatusEnum.cs b/src/Bandwidth.Standard/Model/EndpointStatusEnum.cs new file mode 100644 index 00000000..209bc954 --- /dev/null +++ b/src/Bandwidth.Standard/Model/EndpointStatusEnum.cs @@ -0,0 +1,174 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// Defines endpointStatusEnum + /// + public enum EndpointStatusEnum + { + /// + /// Enum CONNECTED for value: CONNECTED + /// + CONNECTED = 1, + + /// + /// Enum DISCONNECTED for value: DISCONNECTED + /// + DISCONNECTED = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class EndpointStatusEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EndpointStatusEnum FromString(string value) + { + if (value.Equals("CONNECTED")) + return EndpointStatusEnum.CONNECTED; + + if (value.Equals("DISCONNECTED")) + return EndpointStatusEnum.DISCONNECTED; + + throw new NotImplementedException($"Could not convert value to type EndpointStatusEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EndpointStatusEnum? FromStringOrDefault(string value) + { + if (value.Equals("CONNECTED")) + return EndpointStatusEnum.CONNECTED; + + if (value.Equals("DISCONNECTED")) + return EndpointStatusEnum.DISCONNECTED; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(EndpointStatusEnum value) + { + if (value == EndpointStatusEnum.CONNECTED) + return "CONNECTED"; + + if (value == EndpointStatusEnum.DISCONNECTED) + return "DISCONNECTED"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class EndpointStatusEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EndpointStatusEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EndpointStatusEnum? result = rawValue == null + ? null + : EndpointStatusEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EndpointStatusEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EndpointStatusEnum endpointStatusEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(EndpointStatusEnumValueConverter.ToJsonValue(endpointStatusEnum).ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EndpointStatusEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a EndpointStatusEnum from the Json object + /// + /// + /// + /// + /// + public override EndpointStatusEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EndpointStatusEnum? result = rawValue == null + ? null + : EndpointStatusEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EndpointStatusEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EndpointStatusEnum? endpointStatusEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(endpointStatusEnum.HasValue ? EndpointStatusEnumValueConverter.ToJsonValue(endpointStatusEnum.Value).ToString() : "null"); + } + } +} diff --git a/src/Bandwidth.Standard/Model/EndpointTypeEnum.cs b/src/Bandwidth.Standard/Model/EndpointTypeEnum.cs new file mode 100644 index 00000000..ceabd97f --- /dev/null +++ b/src/Bandwidth.Standard/Model/EndpointTypeEnum.cs @@ -0,0 +1,160 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// Defines endpointTypeEnum + /// + public enum EndpointTypeEnum + { + /// + /// Enum WEBRTC for value: WEBRTC + /// + WEBRTC = 1 + } + + /// + /// Converts to and from the JSON value + /// + public static class EndpointTypeEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EndpointTypeEnum FromString(string value) + { + if (value.Equals("WEBRTC")) + return EndpointTypeEnum.WEBRTC; + + throw new NotImplementedException($"Could not convert value to type EndpointTypeEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EndpointTypeEnum? FromStringOrDefault(string value) + { + if (value.Equals("WEBRTC")) + return EndpointTypeEnum.WEBRTC; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(EndpointTypeEnum value) + { + if (value == EndpointTypeEnum.WEBRTC) + return "WEBRTC"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class EndpointTypeEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EndpointTypeEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EndpointTypeEnum? result = rawValue == null + ? null + : EndpointTypeEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EndpointTypeEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EndpointTypeEnum endpointTypeEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(EndpointTypeEnumValueConverter.ToJsonValue(endpointTypeEnum).ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EndpointTypeEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a EndpointTypeEnum from the Json object + /// + /// + /// + /// + /// + public override EndpointTypeEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EndpointTypeEnum? result = rawValue == null + ? null + : EndpointTypeEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EndpointTypeEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EndpointTypeEnum? endpointTypeEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(endpointTypeEnum.HasValue ? EndpointTypeEnumValueConverter.ToJsonValue(endpointTypeEnum.Value).ToString() : "null"); + } + } +} diff --git a/src/Bandwidth.Standard/Model/Endpoints.cs b/src/Bandwidth.Standard/Model/Endpoints.cs new file mode 100644 index 00000000..ce7646ce --- /dev/null +++ b/src/Bandwidth.Standard/Model/Endpoints.cs @@ -0,0 +1,299 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// Endpoints + /// + public partial class Endpoints : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The unique ID of the endpoint. + /// type + /// status + /// The time the endpoint was created. In ISO-8601 format. + /// The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + /// A tag for the endpoint. + [JsonConstructor] + public Endpoints(string endpointId, EndpointTypeEnum type, EndpointStatusEnum status, DateTime creationTimestamp, DateTime expirationTimestamp, Option tag = default) + { + EndpointId = endpointId; + Type = type; + Status = status; + CreationTimestamp = creationTimestamp; + ExpirationTimestamp = expirationTimestamp; + TagOption = tag; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Type + /// + [JsonPropertyName("type")] + public EndpointTypeEnum Type { get; set; } + + /// + /// Gets or Sets Status + /// + [JsonPropertyName("status")] + public EndpointStatusEnum Status { get; set; } + + /// + /// The unique ID of the endpoint. + /// + /// The unique ID of the endpoint. + /* e-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 */ + [JsonPropertyName("endpointId")] + public string EndpointId { get; set; } + + /// + /// The time the endpoint was created. In ISO-8601 format. + /// + /// The time the endpoint was created. In ISO-8601 format. + /* 2021-01-01T00:00Z */ + [JsonPropertyName("creationTimestamp")] + public DateTime CreationTimestamp { get; set; } + + /// + /// The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + /// + /// The time the endpoint token will expire. In ISO-8601 format. Tokens last 24 hours. + /* 2021-01-02T00:00Z */ + [JsonPropertyName("expirationTimestamp")] + public DateTime ExpirationTimestamp { get; set; } + + /// + /// Used to track the state of Tag + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TagOption { get; private set; } + + /// + /// A tag for the endpoint. + /// + /// A tag for the endpoint. + /* my-tag */ + [JsonPropertyName("tag")] + public string Tag { get { return this.TagOption; } set { this.TagOption = new Option(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Endpoints {\n"); + sb.Append(" EndpointId: ").Append(EndpointId).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" CreationTimestamp: ").Append(CreationTimestamp).Append("\n"); + sb.Append(" ExpirationTimestamp: ").Append(ExpirationTimestamp).Append("\n"); + sb.Append(" Tag: ").Append(Tag).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EndpointsJsonConverter : JsonConverter + { + /// + /// The format to use to serialize CreationTimestamp + /// + public static string CreationTimestampFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize ExpirationTimestamp + /// + public static string ExpirationTimestampFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Endpoints Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option endpointId = default; + Option type = default; + Option status = default; + Option creationTimestamp = default; + Option expirationTimestamp = default; + Option tag = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "endpointId": + endpointId = new Option(utf8JsonReader.GetString()); + break; + case "type": + string typeRawValue = utf8JsonReader.GetString(); + if (typeRawValue != null) + type = new Option(EndpointTypeEnumValueConverter.FromStringOrDefault(typeRawValue)); + break; + case "status": + string statusRawValue = utf8JsonReader.GetString(); + if (statusRawValue != null) + status = new Option(EndpointStatusEnumValueConverter.FromStringOrDefault(statusRawValue)); + break; + case "creationTimestamp": + creationTimestamp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "expirationTimestamp": + expirationTimestamp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "tag": + tag = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!endpointId.IsSet) + throw new ArgumentException("Property is required for class Endpoints.", nameof(endpointId)); + + if (!type.IsSet) + throw new ArgumentException("Property is required for class Endpoints.", nameof(type)); + + if (!status.IsSet) + throw new ArgumentException("Property is required for class Endpoints.", nameof(status)); + + if (!creationTimestamp.IsSet) + throw new ArgumentException("Property is required for class Endpoints.", nameof(creationTimestamp)); + + if (!expirationTimestamp.IsSet) + throw new ArgumentException("Property is required for class Endpoints.", nameof(expirationTimestamp)); + + if (endpointId.IsSet && endpointId.Value == null) + throw new ArgumentNullException(nameof(endpointId), "Property is not nullable for class Endpoints."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Endpoints."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Endpoints."); + + if (creationTimestamp.IsSet && creationTimestamp.Value == null) + throw new ArgumentNullException(nameof(creationTimestamp), "Property is not nullable for class Endpoints."); + + if (expirationTimestamp.IsSet && expirationTimestamp.Value == null) + throw new ArgumentNullException(nameof(expirationTimestamp), "Property is not nullable for class Endpoints."); + + if (tag.IsSet && tag.Value == null) + throw new ArgumentNullException(nameof(tag), "Property is not nullable for class Endpoints."); + + return new Endpoints(endpointId.Value, type.Value.Value, status.Value.Value, creationTimestamp.Value.Value, expirationTimestamp.Value.Value, tag); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Endpoints endpoints, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, endpoints, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Endpoints endpoints, JsonSerializerOptions jsonSerializerOptions) + { + if (endpoints.EndpointId == null) + throw new ArgumentNullException(nameof(endpoints.EndpointId), "Property is required for class Endpoints."); + + if (endpoints.TagOption.IsSet && endpoints.Tag == null) + throw new ArgumentNullException(nameof(endpoints.Tag), "Property is required for class Endpoints."); + + writer.WriteString("endpointId", endpoints.EndpointId); + + var typeRawValue = EndpointTypeEnumValueConverter.ToJsonValue(endpoints.Type); + writer.WriteString("type", typeRawValue); + + var statusRawValue = EndpointStatusEnumValueConverter.ToJsonValue(endpoints.Status); + writer.WriteString("status", statusRawValue); + + writer.WriteString("creationTimestamp", endpoints.CreationTimestamp.ToString(CreationTimestampFormat)); + + writer.WriteString("expirationTimestamp", endpoints.ExpirationTimestamp.ToString(ExpirationTimestampFormat)); + + if (endpoints.TagOption.IsSet) + writer.WriteString("tag", endpoints.Tag); + } + } +} diff --git a/src/Bandwidth.Standard/Model/Error.cs b/src/Bandwidth.Standard/Model/Error.cs index 5a78134a..1c38a10a 100644 --- a/src/Bandwidth.Standard/Model/Error.cs +++ b/src/Bandwidth.Standard/Model/Error.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,60 +9,81 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { /// /// Error /// - [DataContract(Name = "error")] public partial class Error : IValidatableObject { /// /// Initializes a new instance of the class. /// - /// code. - /// description. - /// telephoneNumbers. - public Error(int code = default(int), string description = default(string), List telephoneNumbers = default(List)) + /// code + /// description + /// telephoneNumbers + [JsonConstructor] + public Error(Option code = default, Option description = default, Option> telephoneNumbers = default) { - this.Code = code; - this.Description = description; - this.TelephoneNumbers = telephoneNumbers; + CodeOption = code; + DescriptionOption = description; + TelephoneNumbersOption = telephoneNumbers; + OnCreated(); } + partial void OnCreated(); + + /// + /// Used to track the state of Code + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CodeOption { get; private set; } + /// /// Gets or Sets Code /// - [DataMember(Name = "code", EmitDefaultValue = false)] - public int Code { get; set; } + [JsonPropertyName("code")] + public int? Code { get { return this.CodeOption; } set { this.CodeOption = new Option(value); } } + + /// + /// Used to track the state of Description + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DescriptionOption { get; private set; } /// /// Gets or Sets Description /// - [DataMember(Name = "description", EmitDefaultValue = false)] - public string Description { get; set; } + [JsonPropertyName("description")] + public string Description { get { return this.DescriptionOption; } set { this.DescriptionOption = new Option(value); } } + + /// + /// Used to track the state of TelephoneNumbers + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> TelephoneNumbersOption { get; private set; } /// /// Gets or Sets TelephoneNumbers /// - [DataMember(Name = "telephoneNumbers", EmitDefaultValue = false)] - public List TelephoneNumbers { get; set; } + [JsonPropertyName("telephoneNumbers")] + public List TelephoneNumbers { get { return this.TelephoneNumbersOption; } set { this.TelephoneNumbersOption = new Option>(value); } } /// /// Returns the string presentation of the object @@ -78,15 +100,6 @@ public override string ToString() return sb.ToString(); } - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - /// /// To validate all properties of the instance /// @@ -98,4 +111,115 @@ IEnumerable IValidatableObject.Validate(ValidationContext vali } } + /// + /// A Json converter for type + /// + public class ErrorJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Error Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option code = default; + Option description = default; + Option> telephoneNumbers = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "code": + code = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); + break; + case "description": + description = new Option(utf8JsonReader.GetString()); + break; + case "telephoneNumbers": + telephoneNumbers = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (code.IsSet && code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class Error."); + + if (description.IsSet && description.Value == null) + throw new ArgumentNullException(nameof(description), "Property is not nullable for class Error."); + + if (telephoneNumbers.IsSet && telephoneNumbers.Value == null) + throw new ArgumentNullException(nameof(telephoneNumbers), "Property is not nullable for class Error."); + + return new Error(code, description, telephoneNumbers); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Error error, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, error, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Error error, JsonSerializerOptions jsonSerializerOptions) + { + if (error.DescriptionOption.IsSet && error.Description == null) + throw new ArgumentNullException(nameof(error.Description), "Property is required for class Error."); + + if (error.TelephoneNumbersOption.IsSet && error.TelephoneNumbers == null) + throw new ArgumentNullException(nameof(error.TelephoneNumbers), "Property is required for class Error."); + + if (error.CodeOption.IsSet) + writer.WriteNumber("code", error.CodeOption.Value.Value); + + if (error.DescriptionOption.IsSet) + writer.WriteString("description", error.Description); + + if (error.TelephoneNumbersOption.IsSet) + { + writer.WritePropertyName("telephoneNumbers"); + JsonSerializer.Serialize(writer, error.TelephoneNumbers, jsonSerializerOptions); + } + } + } } diff --git a/src/Bandwidth.Standard/Model/ErrorObject.cs b/src/Bandwidth.Standard/Model/ErrorObject.cs index b9b7ce7b..ea6e01ad 100644 --- a/src/Bandwidth.Standard/Model/ErrorObject.cs +++ b/src/Bandwidth.Standard/Model/ErrorObject.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,81 +9,61 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { /// /// ErrorObject /// - [DataContract(Name = "errorObject")] public partial class ErrorObject : IValidatableObject { /// /// Initializes a new instance of the class. /// - [JsonConstructorAttribute] - protected ErrorObject() { } - /// - /// Initializes a new instance of the class. - /// - /// A concise summary of the error used for categorization. (required). - /// A detailed explanation of the error. (required). - /// source (required). - public ErrorObject(string type = default(string), string description = default(string), ErrorSource source = default(ErrorSource)) + /// A concise summary of the error used for categorization. + /// A detailed explanation of the error. + /// source + [JsonConstructor] + public ErrorObject(string type, string description, ErrorSource source) { - // to ensure "type" is required (not null) - if (type == null) - { - throw new ArgumentNullException("type is a required property for ErrorObject and cannot be null"); - } - this.Type = type; - // to ensure "description" is required (not null) - if (description == null) - { - throw new ArgumentNullException("description is a required property for ErrorObject and cannot be null"); - } - this.Description = description; - // to ensure "source" is required (not null) - if (source == null) - { - throw new ArgumentNullException("source is a required property for ErrorObject and cannot be null"); - } - this.Source = source; + Type = type; + Description = description; + Source = source; + OnCreated(); } + partial void OnCreated(); + /// /// A concise summary of the error used for categorization. /// /// A concise summary of the error used for categorization. - [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + [JsonPropertyName("type")] public string Type { get; set; } /// /// A detailed explanation of the error. /// /// A detailed explanation of the error. - [DataMember(Name = "description", IsRequired = true, EmitDefaultValue = true)] + [JsonPropertyName("description")] public string Description { get; set; } /// /// Gets or Sets Source /// - [DataMember(Name = "source", IsRequired = true, EmitDefaultValue = true)] + [JsonPropertyName("source")] public ErrorSource Source { get; set; } /// @@ -100,15 +81,6 @@ public override string ToString() return sb.ToString(); } - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - /// /// To validate all properties of the instance /// @@ -120,4 +92,122 @@ IEnumerable IValidatableObject.Validate(ValidationContext vali } } + /// + /// A Json converter for type + /// + public class ErrorObjectJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ErrorObject Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option type = default; + Option description = default; + Option source = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "type": + type = new Option(utf8JsonReader.GetString()); + break; + case "description": + description = new Option(utf8JsonReader.GetString()); + break; + case "source": + source = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (!type.IsSet) + throw new ArgumentException("Property is required for class ErrorObject.", nameof(type)); + + if (!description.IsSet) + throw new ArgumentException("Property is required for class ErrorObject.", nameof(description)); + + if (!source.IsSet) + throw new ArgumentException("Property is required for class ErrorObject.", nameof(source)); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ErrorObject."); + + if (description.IsSet && description.Value == null) + throw new ArgumentNullException(nameof(description), "Property is not nullable for class ErrorObject."); + + if (source.IsSet && source.Value == null) + throw new ArgumentNullException(nameof(source), "Property is not nullable for class ErrorObject."); + + return new ErrorObject(type.Value, description.Value, source.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ErrorObject errorObject, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, errorObject, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ErrorObject errorObject, JsonSerializerOptions jsonSerializerOptions) + { + if (errorObject.Type == null) + throw new ArgumentNullException(nameof(errorObject.Type), "Property is required for class ErrorObject."); + + if (errorObject.Description == null) + throw new ArgumentNullException(nameof(errorObject.Description), "Property is required for class ErrorObject."); + + if (errorObject.Source == null) + throw new ArgumentNullException(nameof(errorObject.Source), "Property is required for class ErrorObject."); + + writer.WriteString("type", errorObject.Type); + + writer.WriteString("description", errorObject.Description); + + writer.WritePropertyName("source"); + JsonSerializer.Serialize(writer, errorObject.Source, jsonSerializerOptions); + } + } } diff --git a/src/Bandwidth.Standard/Model/ErrorResponse.cs b/src/Bandwidth.Standard/Model/ErrorResponse.cs new file mode 100644 index 00000000..0fdaf062 --- /dev/null +++ b/src/Bandwidth.Standard/Model/ErrorResponse.cs @@ -0,0 +1,210 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// ErrorResponse + /// + public partial class ErrorResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// links + /// errors + /// data + [JsonConstructor] + public ErrorResponse(List links, List errors, Object data = default) + { + Links = links; + Errors = errors; + Data = data; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Links + /// + [JsonPropertyName("links")] + public List Links { get; set; } + + /// + /// Gets or Sets Errors + /// + [JsonPropertyName("errors")] + public List Errors { get; set; } + + /// + /// Gets or Sets Data + /// + [JsonPropertyName("data")] + public Object Data { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ErrorResponse {\n"); + sb.Append(" Links: ").Append(Links).Append("\n"); + sb.Append(" Errors: ").Append(Errors).Append("\n"); + sb.Append(" Data: ").Append(Data).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ErrorResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ErrorResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> links = default; + Option> errors = default; + Option data = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "links": + links = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "errors": + errors = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "data": + data = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (!links.IsSet) + throw new ArgumentException("Property is required for class ErrorResponse.", nameof(links)); + + if (!errors.IsSet) + throw new ArgumentException("Property is required for class ErrorResponse.", nameof(errors)); + + if (!data.IsSet) + throw new ArgumentException("Property is required for class ErrorResponse.", nameof(data)); + + if (links.IsSet && links.Value == null) + throw new ArgumentNullException(nameof(links), "Property is not nullable for class ErrorResponse."); + + if (errors.IsSet && errors.Value == null) + throw new ArgumentNullException(nameof(errors), "Property is not nullable for class ErrorResponse."); + + return new ErrorResponse(links.Value, errors.Value, data.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ErrorResponse errorResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, errorResponse, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ErrorResponse errorResponse, JsonSerializerOptions jsonSerializerOptions) + { + if (errorResponse.Links == null) + throw new ArgumentNullException(nameof(errorResponse.Links), "Property is required for class ErrorResponse."); + + if (errorResponse.Errors == null) + throw new ArgumentNullException(nameof(errorResponse.Errors), "Property is required for class ErrorResponse."); + + writer.WritePropertyName("links"); + JsonSerializer.Serialize(writer, errorResponse.Links, jsonSerializerOptions); + writer.WritePropertyName("errors"); + JsonSerializer.Serialize(writer, errorResponse.Errors, jsonSerializerOptions); + if (errorResponse.Data != null) + { + writer.WritePropertyName("data"); + JsonSerializer.Serialize(writer, errorResponse.Data, jsonSerializerOptions); + } + else + writer.WriteNull("data"); + } + } +} diff --git a/src/Bandwidth.Standard/Model/ErrorSource.cs b/src/Bandwidth.Standard/Model/ErrorSource.cs index 1c9903a2..3a45fa5f 100644 --- a/src/Bandwidth.Standard/Model/ErrorSource.cs +++ b/src/Bandwidth.Standard/Model/ErrorSource.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,72 +9,100 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { /// /// Specifies relevant sources of the error, if any. /// - [DataContract(Name = "errorSource")] public partial class ErrorSource : IValidatableObject { /// /// Initializes a new instance of the class. /// - /// The relevant URI query parameter causing the error. - /// The request body field that led to the error. - /// The header field that contributed to the error. - /// A resource ID or path linked to the error. - public ErrorSource(string varParameter = default(string), string field = default(string), string header = default(string), string reference = default(string)) + /// The relevant URI query parameter causing the error + /// The request body field that led to the error + /// The header field that contributed to the error + /// A resource ID or path linked to the error + [JsonConstructor] + public ErrorSource(Option @parameter = default, Option field = default, Option header = default, Option reference = default) { - this.Parameter = varParameter; - this.Field = field; - this.Header = header; - this.Reference = reference; + ParameterOption = @parameter; + FieldOption = field; + HeaderOption = header; + ReferenceOption = reference; + OnCreated(); } + partial void OnCreated(); + + /// + /// Used to track the state of Parameter + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ParameterOption { get; private set; } + /// /// The relevant URI query parameter causing the error /// /// The relevant URI query parameter causing the error - [DataMember(Name = "parameter", EmitDefaultValue = false)] - public string Parameter { get; set; } + [JsonPropertyName("parameter")] + public string Parameter { get { return this.ParameterOption; } set { this.ParameterOption = new Option(value); } } + + /// + /// Used to track the state of Field + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FieldOption { get; private set; } /// /// The request body field that led to the error /// /// The request body field that led to the error - [DataMember(Name = "field", EmitDefaultValue = false)] - public string Field { get; set; } + [JsonPropertyName("field")] + public string Field { get { return this.FieldOption; } set { this.FieldOption = new Option(value); } } + + /// + /// Used to track the state of Header + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option HeaderOption { get; private set; } /// /// The header field that contributed to the error /// /// The header field that contributed to the error - [DataMember(Name = "header", EmitDefaultValue = false)] - public string Header { get; set; } + [JsonPropertyName("header")] + public string Header { get { return this.HeaderOption; } set { this.HeaderOption = new Option(value); } } + + /// + /// Used to track the state of Reference + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ReferenceOption { get; private set; } /// /// A resource ID or path linked to the error /// /// A resource ID or path linked to the error - [DataMember(Name = "reference", EmitDefaultValue = false)] - public string Reference { get; set; } + [JsonPropertyName("reference")] + public string Reference { get { return this.ReferenceOption; } set { this.ReferenceOption = new Option(value); } } /// /// Returns the string presentation of the object @@ -91,15 +120,6 @@ public override string ToString() return sb.ToString(); } - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - /// /// To validate all properties of the instance /// @@ -111,4 +131,128 @@ IEnumerable IValidatableObject.Validate(ValidationContext vali } } + /// + /// A Json converter for type + /// + public class ErrorSourceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ErrorSource Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varParameter = default; + Option field = default; + Option header = default; + Option reference = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "parameter": + varParameter = new Option(utf8JsonReader.GetString()); + break; + case "field": + field = new Option(utf8JsonReader.GetString()); + break; + case "header": + header = new Option(utf8JsonReader.GetString()); + break; + case "reference": + reference = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (varParameter.IsSet && varParameter.Value == null) + throw new ArgumentNullException(nameof(varParameter), "Property is not nullable for class ErrorSource."); + + if (field.IsSet && field.Value == null) + throw new ArgumentNullException(nameof(field), "Property is not nullable for class ErrorSource."); + + if (header.IsSet && header.Value == null) + throw new ArgumentNullException(nameof(header), "Property is not nullable for class ErrorSource."); + + if (reference.IsSet && reference.Value == null) + throw new ArgumentNullException(nameof(reference), "Property is not nullable for class ErrorSource."); + + return new ErrorSource(varParameter, field, header, reference); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ErrorSource errorSource, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, errorSource, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ErrorSource errorSource, JsonSerializerOptions jsonSerializerOptions) + { + if (errorSource.ParameterOption.IsSet && errorSource.Parameter == null) + throw new ArgumentNullException(nameof(errorSource.Parameter), "Property is required for class ErrorSource."); + + if (errorSource.FieldOption.IsSet && errorSource.Field == null) + throw new ArgumentNullException(nameof(errorSource.Field), "Property is required for class ErrorSource."); + + if (errorSource.HeaderOption.IsSet && errorSource.Header == null) + throw new ArgumentNullException(nameof(errorSource.Header), "Property is required for class ErrorSource."); + + if (errorSource.ReferenceOption.IsSet && errorSource.Reference == null) + throw new ArgumentNullException(nameof(errorSource.Reference), "Property is required for class ErrorSource."); + + if (errorSource.ParameterOption.IsSet) + writer.WriteString("parameter", errorSource.Parameter); + + if (errorSource.FieldOption.IsSet) + writer.WriteString("field", errorSource.Field); + + if (errorSource.HeaderOption.IsSet) + writer.WriteString("header", errorSource.Header); + + if (errorSource.ReferenceOption.IsSet) + writer.WriteString("reference", errorSource.Reference); + } + } } diff --git a/src/Bandwidth.Standard/Model/Page.cs b/src/Bandwidth.Standard/Model/Page.cs new file mode 100644 index 00000000..aeda1762 --- /dev/null +++ b/src/Bandwidth.Standard/Model/Page.cs @@ -0,0 +1,269 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// Page + /// + public partial class Page : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The number of items per page. + /// The total number of items. + /// The total number of pages. + /// The current page number. + [JsonConstructor] + public Page(int pageSize, Option totalElements = default, Option totalPages = default, Option pageNumber = default) + { + PageSize = pageSize; + TotalElementsOption = totalElements; + TotalPagesOption = totalPages; + PageNumberOption = pageNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The number of items per page. + /// + /// The number of items per page. + /* 10 */ + [JsonPropertyName("pageSize")] + public int PageSize { get; set; } + + /// + /// Used to track the state of TotalElements + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TotalElementsOption { get; private set; } + + /// + /// The total number of items. + /// + /// The total number of items. + /* 100 */ + [JsonPropertyName("totalElements")] + public int? TotalElements { get { return this.TotalElementsOption; } set { this.TotalElementsOption = new Option(value); } } + + /// + /// Used to track the state of TotalPages + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TotalPagesOption { get; private set; } + + /// + /// The total number of pages. + /// + /// The total number of pages. + /* 10 */ + [JsonPropertyName("totalPages")] + public int? TotalPages { get { return this.TotalPagesOption; } set { this.TotalPagesOption = new Option(value); } } + + /// + /// Used to track the state of PageNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PageNumberOption { get; private set; } + + /// + /// The current page number. + /// + /// The current page number. + /* 0 */ + [JsonPropertyName("pageNumber")] + public int? PageNumber { get { return this.PageNumberOption; } set { this.PageNumberOption = new Option(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Page {\n"); + sb.Append(" PageSize: ").Append(PageSize).Append("\n"); + sb.Append(" TotalElements: ").Append(TotalElements).Append("\n"); + sb.Append(" TotalPages: ").Append(TotalPages).Append("\n"); + sb.Append(" PageNumber: ").Append(PageNumber).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // PageSize (int) minimum + if (this.PageSize < (int)0) + { + yield return new ValidationResult("Invalid value for PageSize, must be a value greater than or equal to 0.", new [] { "PageSize" }); + } + + // TotalElements (int) minimum + if (this.TotalElementsOption.IsSet && this.TotalElementsOption.Value < (int)0) + { + yield return new ValidationResult("Invalid value for TotalElements, must be a value greater than or equal to 0.", new [] { "TotalElements" }); + } + + // TotalPages (int) minimum + if (this.TotalPagesOption.IsSet && this.TotalPagesOption.Value < (int)0) + { + yield return new ValidationResult("Invalid value for TotalPages, must be a value greater than or equal to 0.", new [] { "TotalPages" }); + } + + // PageNumber (int) minimum + if (this.PageNumberOption.IsSet && this.PageNumberOption.Value < (int)0) + { + yield return new ValidationResult("Invalid value for PageNumber, must be a value greater than or equal to 0.", new [] { "PageNumber" }); + } + + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PageJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Page Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option pageSize = default; + Option totalElements = default; + Option totalPages = default; + Option pageNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "pageSize": + pageSize = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); + break; + case "totalElements": + totalElements = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); + break; + case "totalPages": + totalPages = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); + break; + case "pageNumber": + pageNumber = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (!pageSize.IsSet) + throw new ArgumentException("Property is required for class Page.", nameof(pageSize)); + + if (pageSize.IsSet && pageSize.Value == null) + throw new ArgumentNullException(nameof(pageSize), "Property is not nullable for class Page."); + + if (totalElements.IsSet && totalElements.Value == null) + throw new ArgumentNullException(nameof(totalElements), "Property is not nullable for class Page."); + + if (totalPages.IsSet && totalPages.Value == null) + throw new ArgumentNullException(nameof(totalPages), "Property is not nullable for class Page."); + + if (pageNumber.IsSet && pageNumber.Value == null) + throw new ArgumentNullException(nameof(pageNumber), "Property is not nullable for class Page."); + + return new Page(pageSize.Value.Value, totalElements, totalPages, pageNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Page page, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, page, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Page page, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteNumber("pageSize", page.PageSize); + + if (page.TotalElementsOption.IsSet) + writer.WriteNumber("totalElements", page.TotalElementsOption.Value.Value); + + if (page.TotalPagesOption.IsSet) + writer.WriteNumber("totalPages", page.TotalPagesOption.Value.Value); + + if (page.PageNumberOption.IsSet) + writer.WriteNumber("pageNumber", page.PageNumberOption.Value.Value); + } + } +} diff --git a/src/Bandwidth.Standard/Model/PageInfo.cs b/src/Bandwidth.Standard/Model/PageInfo.cs index fb974ef4..084dc330 100644 --- a/src/Bandwidth.Standard/Model/PageInfo.cs +++ b/src/Bandwidth.Standard/Model/PageInfo.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,76 +9,104 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { /// /// PageInfo /// - [DataContract(Name = "pageInfo")] public partial class PageInfo : IValidatableObject { /// /// Initializes a new instance of the class. /// - /// The link to the previous page for pagination.. - /// The link to the next page for pagination.. - /// The isolated pagination token for the previous page.. - /// The isolated pagination token for the next page.. - public PageInfo(string prevPage = default(string), string nextPage = default(string), string prevPageToken = default(string), string nextPageToken = default(string)) + /// The link to the previous page for pagination. + /// The link to the next page for pagination. + /// The isolated pagination token for the previous page. + /// The isolated pagination token for the next page. + [JsonConstructor] + public PageInfo(Option prevPage = default, Option nextPage = default, Option prevPageToken = default, Option nextPageToken = default) { - this.PrevPage = prevPage; - this.NextPage = nextPage; - this.PrevPageToken = prevPageToken; - this.NextPageToken = nextPageToken; + PrevPageOption = prevPage; + NextPageOption = nextPage; + PrevPageTokenOption = prevPageToken; + NextPageTokenOption = nextPageToken; + OnCreated(); } + partial void OnCreated(); + + /// + /// Used to track the state of PrevPage + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PrevPageOption { get; private set; } + /// /// The link to the previous page for pagination. /// /// The link to the previous page for pagination. - /// https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&nextPage=DLAPE902 - [DataMember(Name = "prevPage", EmitDefaultValue = false)] - public string PrevPage { get; set; } + /* https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&nextPage=DLAPE902 */ + [JsonPropertyName("prevPage")] + public string PrevPage { get { return this.PrevPageOption; } set { this.PrevPageOption = new Option(value); } } + + /// + /// Used to track the state of NextPage + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NextPageOption { get; private set; } /// /// The link to the next page for pagination. /// /// The link to the next page for pagination. - /// https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&prevPage=GL83PD3C - [DataMember(Name = "nextPage", EmitDefaultValue = false)] - public string NextPage { get; set; } + /* https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&prevPage=GL83PD3C */ + [JsonPropertyName("nextPage")] + public string NextPage { get { return this.NextPageOption; } set { this.NextPageOption = new Option(value); } } + + /// + /// Used to track the state of PrevPageToken + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PrevPageTokenOption { get; private set; } /// /// The isolated pagination token for the previous page. /// /// The isolated pagination token for the previous page. - /// DLAPE902 - [DataMember(Name = "prevPageToken", EmitDefaultValue = false)] - public string PrevPageToken { get; set; } + /* DLAPE902 */ + [JsonPropertyName("prevPageToken")] + public string PrevPageToken { get { return this.PrevPageTokenOption; } set { this.PrevPageTokenOption = new Option(value); } } + + /// + /// Used to track the state of NextPageToken + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NextPageTokenOption { get; private set; } /// /// The isolated pagination token for the next page. /// /// The isolated pagination token for the next page. - /// GL83PD3C - [DataMember(Name = "nextPageToken", EmitDefaultValue = false)] - public string NextPageToken { get; set; } + /* GL83PD3C */ + [JsonPropertyName("nextPageToken")] + public string NextPageToken { get { return this.NextPageTokenOption; } set { this.NextPageTokenOption = new Option(value); } } /// /// Returns the string presentation of the object @@ -95,15 +124,6 @@ public override string ToString() return sb.ToString(); } - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - /// /// To validate all properties of the instance /// @@ -115,4 +135,128 @@ IEnumerable IValidatableObject.Validate(ValidationContext vali } } + /// + /// A Json converter for type + /// + public class PageInfoJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override PageInfo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option prevPage = default; + Option nextPage = default; + Option prevPageToken = default; + Option nextPageToken = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "prevPage": + prevPage = new Option(utf8JsonReader.GetString()); + break; + case "nextPage": + nextPage = new Option(utf8JsonReader.GetString()); + break; + case "prevPageToken": + prevPageToken = new Option(utf8JsonReader.GetString()); + break; + case "nextPageToken": + nextPageToken = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (prevPage.IsSet && prevPage.Value == null) + throw new ArgumentNullException(nameof(prevPage), "Property is not nullable for class PageInfo."); + + if (nextPage.IsSet && nextPage.Value == null) + throw new ArgumentNullException(nameof(nextPage), "Property is not nullable for class PageInfo."); + + if (prevPageToken.IsSet && prevPageToken.Value == null) + throw new ArgumentNullException(nameof(prevPageToken), "Property is not nullable for class PageInfo."); + + if (nextPageToken.IsSet && nextPageToken.Value == null) + throw new ArgumentNullException(nameof(nextPageToken), "Property is not nullable for class PageInfo."); + + return new PageInfo(prevPage, nextPage, prevPageToken, nextPageToken); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, PageInfo pageInfo, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, pageInfo, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, PageInfo pageInfo, JsonSerializerOptions jsonSerializerOptions) + { + if (pageInfo.PrevPageOption.IsSet && pageInfo.PrevPage == null) + throw new ArgumentNullException(nameof(pageInfo.PrevPage), "Property is required for class PageInfo."); + + if (pageInfo.NextPageOption.IsSet && pageInfo.NextPage == null) + throw new ArgumentNullException(nameof(pageInfo.NextPage), "Property is required for class PageInfo."); + + if (pageInfo.PrevPageTokenOption.IsSet && pageInfo.PrevPageToken == null) + throw new ArgumentNullException(nameof(pageInfo.PrevPageToken), "Property is required for class PageInfo."); + + if (pageInfo.NextPageTokenOption.IsSet && pageInfo.NextPageToken == null) + throw new ArgumentNullException(nameof(pageInfo.NextPageToken), "Property is required for class PageInfo."); + + if (pageInfo.PrevPageOption.IsSet) + writer.WriteString("prevPage", pageInfo.PrevPage); + + if (pageInfo.NextPageOption.IsSet) + writer.WriteString("nextPage", pageInfo.NextPage); + + if (pageInfo.PrevPageTokenOption.IsSet) + writer.WriteString("prevPageToken", pageInfo.PrevPageToken); + + if (pageInfo.NextPageTokenOption.IsSet) + writer.WriteString("nextPageToken", pageInfo.NextPageToken); + } + } } diff --git a/src/Bandwidth.Standard/Model/PriorityEnum.cs b/src/Bandwidth.Standard/Model/PriorityEnum.cs index 1252e93c..97895ed2 100644 --- a/src/Bandwidth.Standard/Model/PriorityEnum.cs +++ b/src/Bandwidth.Standard/Model/PriorityEnum.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,21 +9,18 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { @@ -30,20 +28,148 @@ namespace Bandwidth.Standard.Model /// 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. /// /// 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. - [JsonConverter(typeof(StringEnumConverter))] public enum PriorityEnum { /// /// Enum Default for value: default /// - [EnumMember(Value = "default")] Default = 1, /// /// Enum High for value: high /// - [EnumMember(Value = "high")] High = 2 } + /// + /// Converts to and from the JSON value + /// + public static class PriorityEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static PriorityEnum FromString(string value) + { + if (value.Equals("default")) + return PriorityEnum.Default; + + if (value.Equals("high")) + return PriorityEnum.High; + + throw new NotImplementedException($"Could not convert value to type PriorityEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static PriorityEnum? FromStringOrDefault(string value) + { + if (value.Equals("default")) + return PriorityEnum.Default; + + if (value.Equals("high")) + return PriorityEnum.High; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(PriorityEnum value) + { + if (value == PriorityEnum.Default) + return "default"; + + if (value == PriorityEnum.High) + return "high"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class PriorityEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override PriorityEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + PriorityEnum? result = rawValue == null + ? null + : PriorityEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the PriorityEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, PriorityEnum priorityEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(PriorityEnumValueConverter.ToJsonValue(priorityEnum).ToString()); + } + } + + /// + /// A Json converter for type + /// + public class PriorityEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a PriorityEnum from the Json object + /// + /// + /// + /// + /// + public override PriorityEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + PriorityEnum? result = rawValue == null + ? null + : PriorityEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the PriorityEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, PriorityEnum? priorityEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(priorityEnum.HasValue ? PriorityEnumValueConverter.ToJsonValue(priorityEnum.Value).ToString() : "null"); + } + } } diff --git a/src/Bandwidth.Standard/Model/ProductTypeEnum.cs b/src/Bandwidth.Standard/Model/ProductTypeEnum.cs index 1ebcdbcc..94bb0ab9 100644 --- a/src/Bandwidth.Standard/Model/ProductTypeEnum.cs +++ b/src/Bandwidth.Standard/Model/ProductTypeEnum.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,21 +9,18 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { @@ -30,62 +28,246 @@ namespace Bandwidth.Standard.Model /// The type of product associated with the message. /// /// The type of product associated with the message. - [JsonConverter(typeof(StringEnumConverter))] public enum ProductTypeEnum { /// /// Enum LOCALA2P for value: LOCAL_A2P /// - [EnumMember(Value = "LOCAL_A2P")] LOCALA2P = 1, /// /// Enum P2P for value: P2P /// - [EnumMember(Value = "P2P")] P2P = 2, /// /// Enum SHORTCODEREACH for value: SHORT_CODE_REACH /// - [EnumMember(Value = "SHORT_CODE_REACH")] SHORTCODEREACH = 3, /// /// Enum TOLLFREE for value: TOLL_FREE /// - [EnumMember(Value = "TOLL_FREE")] TOLLFREE = 4, /// /// Enum HOSTEDSHORTCODE for value: HOSTED_SHORT_CODE /// - [EnumMember(Value = "HOSTED_SHORT_CODE")] HOSTEDSHORTCODE = 5, /// /// Enum ALPHANUMERIC for value: ALPHA_NUMERIC /// - [EnumMember(Value = "ALPHA_NUMERIC")] ALPHANUMERIC = 6, /// /// Enum RBMMEDIA for value: RBM_MEDIA /// - [EnumMember(Value = "RBM_MEDIA")] RBMMEDIA = 7, /// /// Enum RBMRICH for value: RBM_RICH /// - [EnumMember(Value = "RBM_RICH")] RBMRICH = 8, /// /// Enum RBMCONVERSATIONAL for value: RBM_CONVERSATIONAL /// - [EnumMember(Value = "RBM_CONVERSATIONAL")] RBMCONVERSATIONAL = 9 } + /// + /// Converts to and from the JSON value + /// + public static class ProductTypeEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static ProductTypeEnum FromString(string value) + { + if (value.Equals("LOCAL_A2P")) + return ProductTypeEnum.LOCALA2P; + + if (value.Equals("P2P")) + return ProductTypeEnum.P2P; + + if (value.Equals("SHORT_CODE_REACH")) + return ProductTypeEnum.SHORTCODEREACH; + + if (value.Equals("TOLL_FREE")) + return ProductTypeEnum.TOLLFREE; + + if (value.Equals("HOSTED_SHORT_CODE")) + return ProductTypeEnum.HOSTEDSHORTCODE; + + if (value.Equals("ALPHA_NUMERIC")) + return ProductTypeEnum.ALPHANUMERIC; + + if (value.Equals("RBM_MEDIA")) + return ProductTypeEnum.RBMMEDIA; + + if (value.Equals("RBM_RICH")) + return ProductTypeEnum.RBMRICH; + + if (value.Equals("RBM_CONVERSATIONAL")) + return ProductTypeEnum.RBMCONVERSATIONAL; + + throw new NotImplementedException($"Could not convert value to type ProductTypeEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static ProductTypeEnum? FromStringOrDefault(string value) + { + if (value.Equals("LOCAL_A2P")) + return ProductTypeEnum.LOCALA2P; + + if (value.Equals("P2P")) + return ProductTypeEnum.P2P; + + if (value.Equals("SHORT_CODE_REACH")) + return ProductTypeEnum.SHORTCODEREACH; + + if (value.Equals("TOLL_FREE")) + return ProductTypeEnum.TOLLFREE; + + if (value.Equals("HOSTED_SHORT_CODE")) + return ProductTypeEnum.HOSTEDSHORTCODE; + + if (value.Equals("ALPHA_NUMERIC")) + return ProductTypeEnum.ALPHANUMERIC; + + if (value.Equals("RBM_MEDIA")) + return ProductTypeEnum.RBMMEDIA; + + if (value.Equals("RBM_RICH")) + return ProductTypeEnum.RBMRICH; + + if (value.Equals("RBM_CONVERSATIONAL")) + return ProductTypeEnum.RBMCONVERSATIONAL; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(ProductTypeEnum value) + { + if (value == ProductTypeEnum.LOCALA2P) + return "LOCAL_A2P"; + + if (value == ProductTypeEnum.P2P) + return "P2P"; + + if (value == ProductTypeEnum.SHORTCODEREACH) + return "SHORT_CODE_REACH"; + + if (value == ProductTypeEnum.TOLLFREE) + return "TOLL_FREE"; + + if (value == ProductTypeEnum.HOSTEDSHORTCODE) + return "HOSTED_SHORT_CODE"; + + if (value == ProductTypeEnum.ALPHANUMERIC) + return "ALPHA_NUMERIC"; + + if (value == ProductTypeEnum.RBMMEDIA) + return "RBM_MEDIA"; + + if (value == ProductTypeEnum.RBMRICH) + return "RBM_RICH"; + + if (value == ProductTypeEnum.RBMCONVERSATIONAL) + return "RBM_CONVERSATIONAL"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class ProductTypeEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override ProductTypeEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ProductTypeEnum? result = rawValue == null + ? null + : ProductTypeEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the ProductTypeEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ProductTypeEnum productTypeEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(ProductTypeEnumValueConverter.ToJsonValue(productTypeEnum).ToString()); + } + } + + /// + /// A Json converter for type + /// + public class ProductTypeEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a ProductTypeEnum from the Json object + /// + /// + /// + /// + /// + public override ProductTypeEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ProductTypeEnum? result = rawValue == null + ? null + : ProductTypeEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the ProductTypeEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ProductTypeEnum? productTypeEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(productTypeEnum.HasValue ? ProductTypeEnumValueConverter.ToJsonValue(productTypeEnum.Value).ToString() : "null"); + } + } } diff --git a/src/Bandwidth.Standard/Model/SipConnectionMetadata.cs b/src/Bandwidth.Standard/Model/SipConnectionMetadata.cs new file mode 100644 index 00000000..f1c848c3 --- /dev/null +++ b/src/Bandwidth.Standard/Model/SipConnectionMetadata.cs @@ -0,0 +1,259 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// SipConnectionMetadata + /// + public partial class SipConnectionMetadata : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The IP address of the SIP connection. + /// The port of the SIP connection. + /// credentials + /// The User-to-User Information header for the SIP connection. + [JsonConstructor] + public SipConnectionMetadata(Option ipAddress = default, Option port = default, Option credentials = default, Option uuiHeader = default) + { + IpAddressOption = ipAddress; + PortOption = port; + CredentialsOption = credentials; + UuiHeaderOption = uuiHeader; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of IpAddress + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IpAddressOption { get; private set; } + + /// + /// The IP address of the SIP connection. + /// + /// The IP address of the SIP connection. + /* 192.168.0.0 */ + [JsonPropertyName("ipAddress")] + public string IpAddress { get { return this.IpAddressOption; } set { this.IpAddressOption = new Option(value); } } + + /// + /// Used to track the state of Port + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PortOption { get; private set; } + + /// + /// The port of the SIP connection. + /// + /// The port of the SIP connection. + /* 5060 */ + [JsonPropertyName("port")] + public int? Port { get { return this.PortOption; } set { this.PortOption = new Option(value); } } + + /// + /// Used to track the state of Credentials + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CredentialsOption { get; private set; } + + /// + /// Gets or Sets Credentials + /// + [JsonPropertyName("credentials")] + public SipCredentials Credentials { get { return this.CredentialsOption; } set { this.CredentialsOption = new Option(value); } } + + /// + /// Used to track the state of UuiHeader + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuiHeaderOption { get; private set; } + + /// + /// The User-to-User Information header for the SIP connection. + /// + /// The User-to-User Information header for the SIP connection. + /* my-uui-header */ + [JsonPropertyName("uuiHeader")] + public string UuiHeader { get { return this.UuiHeaderOption; } set { this.UuiHeaderOption = new Option(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SipConnectionMetadata {\n"); + sb.Append(" IpAddress: ").Append(IpAddress).Append("\n"); + sb.Append(" Port: ").Append(Port).Append("\n"); + sb.Append(" Credentials: ").Append(Credentials).Append("\n"); + sb.Append(" UuiHeader: ").Append(UuiHeader).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class SipConnectionMetadataJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SipConnectionMetadata Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option ipAddress = default; + Option port = default; + Option credentials = default; + Option uuiHeader = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ipAddress": + ipAddress = new Option(utf8JsonReader.GetString()); + break; + case "port": + port = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); + break; + case "credentials": + credentials = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "uuiHeader": + uuiHeader = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (ipAddress.IsSet && ipAddress.Value == null) + throw new ArgumentNullException(nameof(ipAddress), "Property is not nullable for class SipConnectionMetadata."); + + if (port.IsSet && port.Value == null) + throw new ArgumentNullException(nameof(port), "Property is not nullable for class SipConnectionMetadata."); + + if (credentials.IsSet && credentials.Value == null) + throw new ArgumentNullException(nameof(credentials), "Property is not nullable for class SipConnectionMetadata."); + + if (uuiHeader.IsSet && uuiHeader.Value == null) + throw new ArgumentNullException(nameof(uuiHeader), "Property is not nullable for class SipConnectionMetadata."); + + return new SipConnectionMetadata(ipAddress, port, credentials, uuiHeader); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SipConnectionMetadata sipConnectionMetadata, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, sipConnectionMetadata, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SipConnectionMetadata sipConnectionMetadata, JsonSerializerOptions jsonSerializerOptions) + { + if (sipConnectionMetadata.IpAddressOption.IsSet && sipConnectionMetadata.IpAddress == null) + throw new ArgumentNullException(nameof(sipConnectionMetadata.IpAddress), "Property is required for class SipConnectionMetadata."); + + if (sipConnectionMetadata.CredentialsOption.IsSet && sipConnectionMetadata.Credentials == null) + throw new ArgumentNullException(nameof(sipConnectionMetadata.Credentials), "Property is required for class SipConnectionMetadata."); + + if (sipConnectionMetadata.UuiHeaderOption.IsSet && sipConnectionMetadata.UuiHeader == null) + throw new ArgumentNullException(nameof(sipConnectionMetadata.UuiHeader), "Property is required for class SipConnectionMetadata."); + + if (sipConnectionMetadata.IpAddressOption.IsSet) + writer.WriteString("ipAddress", sipConnectionMetadata.IpAddress); + + if (sipConnectionMetadata.PortOption.IsSet) + writer.WriteNumber("port", sipConnectionMetadata.PortOption.Value.Value); + + if (sipConnectionMetadata.CredentialsOption.IsSet) + { + writer.WritePropertyName("credentials"); + JsonSerializer.Serialize(writer, sipConnectionMetadata.Credentials, jsonSerializerOptions); + } + if (sipConnectionMetadata.UuiHeaderOption.IsSet) + writer.WriteString("uuiHeader", sipConnectionMetadata.UuiHeader); + } + } +} diff --git a/src/Bandwidth.Standard/Model/SipCredentials.cs b/src/Bandwidth.Standard/Model/SipCredentials.cs new file mode 100644 index 00000000..0878a09f --- /dev/null +++ b/src/Bandwidth.Standard/Model/SipCredentials.cs @@ -0,0 +1,200 @@ +// +/* + * Bandwidth + * + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Bandwidth.Standard.Client; + +namespace Bandwidth.Standard.Model +{ + /// + /// SipCredentials + /// + public partial class SipCredentials : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The username for the SIP connection. + /// The password for the SIP connection. + [JsonConstructor] + public SipCredentials(Option username = default, Option password = default) + { + UsernameOption = username; + PasswordOption = password; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Username + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UsernameOption { get; private set; } + + /// + /// The username for the SIP connection. + /// + /// The username for the SIP connection. + /* username */ + [JsonPropertyName("username")] + public string Username { get { return this.UsernameOption; } set { this.UsernameOption = new Option(value); } } + + /// + /// Used to track the state of Password + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PasswordOption { get; private set; } + + /// + /// The password for the SIP connection. + /// + /// The password for the SIP connection. + /* password */ + [JsonPropertyName("password")] + public string Password { get { return this.PasswordOption; } set { this.PasswordOption = new Option(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SipCredentials {\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class SipCredentialsJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SipCredentials Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option username = default; + Option password = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "username": + username = new Option(utf8JsonReader.GetString()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (username.IsSet && username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class SipCredentials."); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class SipCredentials."); + + return new SipCredentials(username, password); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SipCredentials sipCredentials, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, sipCredentials, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SipCredentials sipCredentials, JsonSerializerOptions jsonSerializerOptions) + { + if (sipCredentials.UsernameOption.IsSet && sipCredentials.Username == null) + throw new ArgumentNullException(nameof(sipCredentials.Username), "Property is required for class SipCredentials."); + + if (sipCredentials.PasswordOption.IsSet && sipCredentials.Password == null) + throw new ArgumentNullException(nameof(sipCredentials.Password), "Property is required for class SipCredentials."); + + if (sipCredentials.UsernameOption.IsSet) + writer.WriteString("username", sipCredentials.Username); + + if (sipCredentials.PasswordOption.IsSet) + writer.WriteString("password", sipCredentials.Password); + } + } +} diff --git a/src/Bandwidth.Standard/Model/SmsMessageContent.cs b/src/Bandwidth.Standard/Model/SmsMessageContent.cs index 61596584..5b52a3bc 100644 --- a/src/Bandwidth.Standard/Model/SmsMessageContent.cs +++ b/src/Bandwidth.Standard/Model/SmsMessageContent.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,55 +9,45 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { /// /// SmsMessageContent /// - [DataContract(Name = "smsMessageContent")] public partial class SmsMessageContent : IValidatableObject { /// /// Initializes a new instance of the class. /// - [JsonConstructorAttribute] - protected SmsMessageContent() { } - /// - /// Initializes a new instance of the class. - /// - /// The contents of the text message. Must be 2048 characters or less. (required). - public SmsMessageContent(string text = default(string)) + /// The contents of the text message. Must be 2048 characters or less. + [JsonConstructor] + public SmsMessageContent(string text) { - // to ensure "text" is required (not null) - if (text == null) - { - throw new ArgumentNullException("text is a required property for SmsMessageContent and cannot be null"); - } - this.Text = text; + Text = text; + OnCreated(); } + partial void OnCreated(); + /// /// The contents of the text message. Must be 2048 characters or less. /// /// The contents of the text message. Must be 2048 characters or less. - /// Hello world - [DataMember(Name = "text", IsRequired = true, EmitDefaultValue = true)] + /* Hello world */ + [JsonPropertyName("text")] public string Text { get; set; } /// @@ -72,15 +63,6 @@ public override string ToString() return sb.ToString(); } - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - /// /// To validate all properties of the instance /// @@ -98,4 +80,91 @@ IEnumerable IValidatableObject.Validate(ValidationContext vali } } + /// + /// A Json converter for type + /// + public class SmsMessageContentJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SmsMessageContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option text = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "text": + text = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!text.IsSet) + throw new ArgumentException("Property is required for class SmsMessageContent.", nameof(text)); + + if (text.IsSet && text.Value == null) + throw new ArgumentNullException(nameof(text), "Property is not nullable for class SmsMessageContent."); + + return new SmsMessageContent(text.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SmsMessageContent smsMessageContent, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, smsMessageContent, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SmsMessageContent smsMessageContent, JsonSerializerOptions jsonSerializerOptions) + { + if (smsMessageContent.Text == null) + throw new ArgumentNullException(nameof(smsMessageContent.Text), "Property is required for class SmsMessageContent."); + + writer.WriteString("text", smsMessageContent.Text); + } + } } diff --git a/src/Bandwidth.Standard/Model/StandaloneCardOrientationEnum.cs b/src/Bandwidth.Standard/Model/StandaloneCardOrientationEnum.cs index 5af9f4cb..6b96b8de 100644 --- a/src/Bandwidth.Standard/Model/StandaloneCardOrientationEnum.cs +++ b/src/Bandwidth.Standard/Model/StandaloneCardOrientationEnum.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,41 +9,166 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { /// /// Defines standaloneCardOrientationEnum /// - [JsonConverter(typeof(StringEnumConverter))] public enum StandaloneCardOrientationEnum { /// /// Enum HORIZONTAL for value: HORIZONTAL /// - [EnumMember(Value = "HORIZONTAL")] HORIZONTAL = 1, /// /// Enum VERTICAL for value: VERTICAL /// - [EnumMember(Value = "VERTICAL")] VERTICAL = 2 } + /// + /// Converts to and from the JSON value + /// + public static class StandaloneCardOrientationEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static StandaloneCardOrientationEnum FromString(string value) + { + if (value.Equals("HORIZONTAL")) + return StandaloneCardOrientationEnum.HORIZONTAL; + + if (value.Equals("VERTICAL")) + return StandaloneCardOrientationEnum.VERTICAL; + + throw new NotImplementedException($"Could not convert value to type StandaloneCardOrientationEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static StandaloneCardOrientationEnum? FromStringOrDefault(string value) + { + if (value.Equals("HORIZONTAL")) + return StandaloneCardOrientationEnum.HORIZONTAL; + + if (value.Equals("VERTICAL")) + return StandaloneCardOrientationEnum.VERTICAL; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(StandaloneCardOrientationEnum value) + { + if (value == StandaloneCardOrientationEnum.HORIZONTAL) + return "HORIZONTAL"; + + if (value == StandaloneCardOrientationEnum.VERTICAL) + return "VERTICAL"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class StandaloneCardOrientationEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override StandaloneCardOrientationEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + StandaloneCardOrientationEnum? result = rawValue == null + ? null + : StandaloneCardOrientationEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the StandaloneCardOrientationEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, StandaloneCardOrientationEnum standaloneCardOrientationEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(StandaloneCardOrientationEnumValueConverter.ToJsonValue(standaloneCardOrientationEnum).ToString()); + } + } + + /// + /// A Json converter for type + /// + public class StandaloneCardOrientationEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a StandaloneCardOrientationEnum from the Json object + /// + /// + /// + /// + /// + public override StandaloneCardOrientationEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + StandaloneCardOrientationEnum? result = rawValue == null + ? null + : StandaloneCardOrientationEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the StandaloneCardOrientationEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, StandaloneCardOrientationEnum? standaloneCardOrientationEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(standaloneCardOrientationEnum.HasValue ? StandaloneCardOrientationEnumValueConverter.ToJsonValue(standaloneCardOrientationEnum.Value).ToString() : "null"); + } + } } diff --git a/src/Bandwidth.Standard/Model/StatusCallback.cs b/src/Bandwidth.Standard/Model/StatusCallback.cs index 71c7922e..c7acb626 100644 --- a/src/Bandwidth.Standard/Model/StatusCallback.cs +++ b/src/Bandwidth.Standard/Model/StatusCallback.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,131 +9,132 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { /// /// Represents a status callback for an outbound MT SMS or MMS or RBM message. /// - [DataContract(Name = "statusCallback")] public partial class StatusCallback : IValidatableObject { - - /// - /// Gets or Sets Type - /// - [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] - public StatusCallbackTypeEnum Type { get; set; } /// /// Initializes a new instance of the class. /// - [JsonConstructorAttribute] - protected StatusCallback() { } - /// - /// Initializes a new instance of the class. - /// - /// time (required). - /// Represents the time at which the message was read, for `message-read` callbacks.. - /// type (required). - /// The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number. (required). - /// A detailed description of the event described by the callback. (required). - /// message (required). - /// Optional error code, applicable only when type is `message-failed`.. - /// 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.. - public StatusCallback(DateTime time = default(DateTime), DateTime eventTime = default(DateTime), StatusCallbackTypeEnum type = default(StatusCallbackTypeEnum), string to = default(string), string description = default(string), StatusCallbackMessage message = default(StatusCallbackMessage), int errorCode = default(int), string carrierName = default(string)) + /// time + /// type + /// The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number. + /// A detailed description of the event described by the callback. + /// message + /// Represents the time at which the message was read, for `message-read` callbacks. + /// Optional error code, applicable only when type is `message-failed`. + /// 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. + [JsonConstructor] + public StatusCallback(DateTime time, StatusCallbackTypeEnum type, string to, string description, StatusCallbackMessage message, Option eventTime = default, Option errorCode = default, Option carrierName = default) { - this.Time = time; - this.Type = type; - // to ensure "to" is required (not null) - if (to == null) - { - throw new ArgumentNullException("to is a required property for StatusCallback and cannot be null"); - } - this.To = to; - // to ensure "description" is required (not null) - if (description == null) - { - throw new ArgumentNullException("description is a required property for StatusCallback and cannot be null"); - } - this.Description = description; - // to ensure "message" is required (not null) - if (message == null) - { - throw new ArgumentNullException("message is a required property for StatusCallback and cannot be null"); - } - this.Message = message; - this.EventTime = eventTime; - this.ErrorCode = errorCode; - this.CarrierName = carrierName; + Time = time; + Type = type; + To = to; + Description = description; + Message = message; + EventTimeOption = eventTime; + ErrorCodeOption = errorCode; + CarrierNameOption = carrierName; + OnCreated(); } + partial void OnCreated(); + /// - /// Gets or Sets Time + /// Gets or Sets Type /// - /// 2024-12-02T20:15:57.278Z - [DataMember(Name = "time", IsRequired = true, EmitDefaultValue = true)] - public DateTime Time { get; set; } + [JsonPropertyName("type")] + public StatusCallbackTypeEnum Type { get; set; } /// - /// Represents the time at which the message was read, for `message-read` callbacks. + /// Gets or Sets Time /// - /// Represents the time at which the message was read, for `message-read` callbacks. - /// 2024-12-02T20:15:58.278Z - [DataMember(Name = "eventTime", EmitDefaultValue = false)] - public DateTime EventTime { get; set; } + /* 2024-12-02T20:15:57.278Z */ + [JsonPropertyName("time")] + public DateTime Time { get; set; } /// /// The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number. /// /// The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number. - /// +15552223333 - [DataMember(Name = "to", IsRequired = true, EmitDefaultValue = true)] + /* +15552223333 */ + [JsonPropertyName("to")] public string To { get; set; } /// /// A detailed description of the event described by the callback. /// /// A detailed description of the event described by the callback. - /// Message delivered to carrier. - [DataMember(Name = "description", IsRequired = true, EmitDefaultValue = true)] + /* Message delivered to carrier. */ + [JsonPropertyName("description")] public string Description { get; set; } /// /// Gets or Sets Message /// - [DataMember(Name = "message", IsRequired = true, EmitDefaultValue = true)] + [JsonPropertyName("message")] public StatusCallbackMessage Message { get; set; } + /// + /// Used to track the state of EventTime + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EventTimeOption { get; private set; } + + /// + /// Represents the time at which the message was read, for `message-read` callbacks. + /// + /// Represents the time at which the message was read, for `message-read` callbacks. + /* 2024-12-02T20:15:58.278Z */ + [JsonPropertyName("eventTime")] + public DateTime? EventTime { get { return this.EventTimeOption; } set { this.EventTimeOption = new Option(value); } } + + /// + /// Used to track the state of ErrorCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ErrorCodeOption { get; private set; } + /// /// Optional error code, applicable only when type is `message-failed`. /// /// Optional error code, applicable only when type is `message-failed`. - /// 4405 - [DataMember(Name = "errorCode", EmitDefaultValue = false)] - public int ErrorCode { get; set; } + /* 4405 */ + [JsonPropertyName("errorCode")] + public int? ErrorCode { get { return this.ErrorCodeOption; } set { this.ErrorCodeOption = new Option(value); } } + + /// + /// Used to track the state of CarrierName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CarrierNameOption { get; private set; } /// - /// 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. + /// 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. /// - /// 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. - /// AT&T - [DataMember(Name = "carrierName", EmitDefaultValue = false)] - public string CarrierName { get; set; } + /// 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. + /* AT&T */ + [JsonPropertyName("carrierName")] + public string CarrierName { get { return this.CarrierNameOption; } set { this.CarrierNameOption = new Option(value); } } /// /// Returns the string presentation of the object @@ -143,26 +145,17 @@ public override string ToString() StringBuilder sb = new StringBuilder(); sb.Append("class StatusCallback {\n"); sb.Append(" Time: ").Append(Time).Append("\n"); - sb.Append(" EventTime: ").Append(EventTime).Append("\n"); sb.Append(" Type: ").Append(Type).Append("\n"); sb.Append(" To: ").Append(To).Append("\n"); sb.Append(" Description: ").Append(Description).Append("\n"); sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" EventTime: ").Append(EventTime).Append("\n"); sb.Append(" ErrorCode: ").Append(ErrorCode).Append("\n"); sb.Append(" CarrierName: ").Append(CarrierName).Append("\n"); sb.Append("}\n"); return sb.ToString(); } - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - /// /// To validate all properties of the instance /// @@ -174,4 +167,191 @@ IEnumerable IValidatableObject.Validate(ValidationContext vali } } + /// + /// A Json converter for type + /// + public class StatusCallbackJsonConverter : JsonConverter + { + /// + /// The format to use to serialize Time + /// + public static string TimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize EventTime + /// + public static string EventTimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override StatusCallback Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option time = default; + Option type = default; + Option to = default; + Option description = default; + Option message = default; + Option eventTime = default; + Option errorCode = default; + Option carrierName = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "time": + time = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "type": + string typeRawValue = utf8JsonReader.GetString(); + if (typeRawValue != null) + type = new Option(StatusCallbackTypeEnumValueConverter.FromStringOrDefault(typeRawValue)); + break; + case "to": + to = new Option(utf8JsonReader.GetString()); + break; + case "description": + description = new Option(utf8JsonReader.GetString()); + break; + case "message": + message = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "eventTime": + eventTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "errorCode": + errorCode = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); + break; + case "carrierName": + carrierName = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!time.IsSet) + throw new ArgumentException("Property is required for class StatusCallback.", nameof(time)); + + if (!type.IsSet) + throw new ArgumentException("Property is required for class StatusCallback.", nameof(type)); + + if (!to.IsSet) + throw new ArgumentException("Property is required for class StatusCallback.", nameof(to)); + + if (!description.IsSet) + throw new ArgumentException("Property is required for class StatusCallback.", nameof(description)); + + if (!message.IsSet) + throw new ArgumentException("Property is required for class StatusCallback.", nameof(message)); + + if (time.IsSet && time.Value == null) + throw new ArgumentNullException(nameof(time), "Property is not nullable for class StatusCallback."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class StatusCallback."); + + if (to.IsSet && to.Value == null) + throw new ArgumentNullException(nameof(to), "Property is not nullable for class StatusCallback."); + + if (description.IsSet && description.Value == null) + throw new ArgumentNullException(nameof(description), "Property is not nullable for class StatusCallback."); + + if (message.IsSet && message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class StatusCallback."); + + if (eventTime.IsSet && eventTime.Value == null) + throw new ArgumentNullException(nameof(eventTime), "Property is not nullable for class StatusCallback."); + + if (errorCode.IsSet && errorCode.Value == null) + throw new ArgumentNullException(nameof(errorCode), "Property is not nullable for class StatusCallback."); + + if (carrierName.IsSet && carrierName.Value == null) + throw new ArgumentNullException(nameof(carrierName), "Property is not nullable for class StatusCallback."); + + return new StatusCallback(time.Value.Value, type.Value.Value, to.Value, description.Value, message.Value, eventTime, errorCode, carrierName); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, StatusCallback statusCallback, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, statusCallback, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, StatusCallback statusCallback, JsonSerializerOptions jsonSerializerOptions) + { + if (statusCallback.To == null) + throw new ArgumentNullException(nameof(statusCallback.To), "Property is required for class StatusCallback."); + + if (statusCallback.Description == null) + throw new ArgumentNullException(nameof(statusCallback.Description), "Property is required for class StatusCallback."); + + if (statusCallback.Message == null) + throw new ArgumentNullException(nameof(statusCallback.Message), "Property is required for class StatusCallback."); + + if (statusCallback.CarrierNameOption.IsSet && statusCallback.CarrierName == null) + throw new ArgumentNullException(nameof(statusCallback.CarrierName), "Property is required for class StatusCallback."); + + writer.WriteString("time", statusCallback.Time.ToString(TimeFormat)); + + var typeRawValue = StatusCallbackTypeEnumValueConverter.ToJsonValue(statusCallback.Type); + writer.WriteString("type", typeRawValue); + + writer.WriteString("to", statusCallback.To); + + writer.WriteString("description", statusCallback.Description); + + writer.WritePropertyName("message"); + JsonSerializer.Serialize(writer, statusCallback.Message, jsonSerializerOptions); + if (statusCallback.EventTimeOption.IsSet) + writer.WriteString("eventTime", statusCallback.EventTimeOption.Value.Value.ToString(EventTimeFormat)); + + if (statusCallback.ErrorCodeOption.IsSet) + writer.WriteNumber("errorCode", statusCallback.ErrorCodeOption.Value.Value); + + if (statusCallback.CarrierNameOption.IsSet) + writer.WriteString("carrierName", statusCallback.CarrierName); + } + } } diff --git a/src/Bandwidth.Standard/Model/StatusCallbackMessage.cs b/src/Bandwidth.Standard/Model/StatusCallbackMessage.cs index b2da7234..e2cd27fa 100644 --- a/src/Bandwidth.Standard/Model/StatusCallbackMessage.cs +++ b/src/Bandwidth.Standard/Model/StatusCallbackMessage.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,188 +9,193 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { /// /// Message payload schema within a callback /// - [DataContract(Name = "statusCallbackMessage")] public partial class StatusCallbackMessage : IValidatableObject { + /// + /// Initializes a new instance of the class. + /// + /// A unique identifier of the message. + /// The Bandwidth phone number or alphanumeric identifier associated with the message. + /// The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. + /// time + /// The number of segments the user's message is broken into before sending over carrier networks. + /// direction + /// The phone number recipients of the message. + /// The Bandwidth phone number or alphanumeric identifier the message was sent from. + /// text + /// A custom string that will be included in callback events of the message. Max 1024 characters. + /// Optional media, not applicable for sms + /// priority + /// channel + [JsonConstructor] + public StatusCallbackMessage(string id, string owner, string applicationId, DateTime time, int segmentCount, MessageDirectionEnum direction, List to, string from, Option text = default, Option tag = default, Option> media = default, Option priority = default, Option channel = default) + { + Id = id; + Owner = owner; + ApplicationId = applicationId; + Time = time; + SegmentCount = segmentCount; + Direction = direction; + To = to; + From = from; + TextOption = text; + TagOption = tag; + MediaOption = media; + PriorityOption = priority; + ChannelOption = channel; + OnCreated(); + } + + partial void OnCreated(); /// /// Gets or Sets Direction /// - [DataMember(Name = "direction", IsRequired = true, EmitDefaultValue = true)] + [JsonPropertyName("direction")] public MessageDirectionEnum Direction { get; set; } /// - /// Gets or Sets Priority + /// Used to track the state of Priority /// - [DataMember(Name = "priority", EmitDefaultValue = false)] - public PriorityEnum? Priority { get; set; } + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PriorityOption { get; private set; } /// - /// Gets or Sets Channel + /// Gets or Sets Priority /// - [DataMember(Name = "channel", EmitDefaultValue = false)] - public MultiChannelMessageChannelEnum? Channel { get; set; } + [JsonPropertyName("priority")] + public PriorityEnum? Priority { get { return this.PriorityOption; } set { this.PriorityOption = new Option(value); } } + /// - /// Initializes a new instance of the class. + /// Used to track the state of Channel /// - [JsonConstructorAttribute] - protected StatusCallbackMessage() { } + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ChannelOption { get; private set; } + /// - /// Initializes a new instance of the class. + /// Gets or Sets Channel /// - /// A unique identifier of the message. (required). - /// The Bandwidth phone number or alphanumeric identifier associated with the message. (required). - /// The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. (required). - /// time (required). - /// The number of segments the user's message is broken into before sending over carrier networks. (required). - /// direction (required). - /// The phone number recipients of the message. (required). - /// The Bandwidth phone number or alphanumeric identifier the message was sent from. (required). - /// text. - /// A custom string that will be included in callback events of the message. Max 1024 characters.. - /// Optional media, not applicable for sms. - /// priority. - /// channel. - public StatusCallbackMessage(string id = default(string), string owner = default(string), string applicationId = default(string), DateTime time = default(DateTime), int segmentCount = default(int), MessageDirectionEnum direction = default(MessageDirectionEnum), List to = default(List), string from = default(string), string text = default(string), string tag = default(string), List media = default(List), PriorityEnum? priority = default(PriorityEnum?), MultiChannelMessageChannelEnum? channel = default(MultiChannelMessageChannelEnum?)) - { - // to ensure "id" is required (not null) - if (id == null) - { - throw new ArgumentNullException("id is a required property for StatusCallbackMessage and cannot be null"); - } - this.Id = id; - // to ensure "owner" is required (not null) - if (owner == null) - { - throw new ArgumentNullException("owner is a required property for StatusCallbackMessage and cannot be null"); - } - this.Owner = owner; - // to ensure "applicationId" is required (not null) - if (applicationId == null) - { - throw new ArgumentNullException("applicationId is a required property for StatusCallbackMessage and cannot be null"); - } - this.ApplicationId = applicationId; - this.Time = time; - this.SegmentCount = segmentCount; - this.Direction = direction; - // to ensure "to" is required (not null) - if (to == null) - { - throw new ArgumentNullException("to is a required property for StatusCallbackMessage and cannot be null"); - } - this.To = to; - // to ensure "from" is required (not null) - if (from == null) - { - throw new ArgumentNullException("from is a required property for StatusCallbackMessage and cannot be null"); - } - this.From = from; - this.Text = text; - this.Tag = tag; - this.Media = media; - this.Priority = priority; - this.Channel = channel; - } + [JsonPropertyName("channel")] + public MultiChannelMessageChannelEnum? Channel { get { return this.ChannelOption; } set { this.ChannelOption = new Option(value); } } /// /// A unique identifier of the message. /// /// A unique identifier of the message. - /// 1661365814859loidf7mcwd4qacn7 - [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + /* 1661365814859loidf7mcwd4qacn7 */ + [JsonPropertyName("id")] public string Id { get; set; } /// /// The Bandwidth phone number or alphanumeric identifier associated with the message. /// /// The Bandwidth phone number or alphanumeric identifier associated with the message. - /// +15553332222 - [DataMember(Name = "owner", IsRequired = true, EmitDefaultValue = true)] + /* +15553332222 */ + [JsonPropertyName("owner")] public string Owner { get; set; } /// /// The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. /// /// The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. - /// 93de2206-9669-4e07-948d-329f4b722ee2 - [DataMember(Name = "applicationId", IsRequired = true, EmitDefaultValue = true)] + /* 93de2206-9669-4e07-948d-329f4b722ee2 */ + [JsonPropertyName("applicationId")] public string ApplicationId { get; set; } /// /// Gets or Sets Time /// - /// 2024-12-02T20:15:57.666Z - [DataMember(Name = "time", IsRequired = true, EmitDefaultValue = true)] + /* 2024-12-02T20:15:57.666Z */ + [JsonPropertyName("time")] public DateTime Time { get; set; } /// /// The number of segments the user's message is broken into before sending over carrier networks. /// /// The number of segments the user's message is broken into before sending over carrier networks. - /// 1 - [DataMember(Name = "segmentCount", IsRequired = true, EmitDefaultValue = true)] + /* 1 */ + [JsonPropertyName("segmentCount")] public int SegmentCount { get; set; } /// /// The phone number recipients of the message. /// /// The phone number recipients of the message. - /// ["+15552223333"] - [DataMember(Name = "to", IsRequired = true, EmitDefaultValue = true)] + /* ["+15552223333"] */ + [JsonPropertyName("to")] public List To { get; set; } /// /// The Bandwidth phone number or alphanumeric identifier the message was sent from. /// /// The Bandwidth phone number or alphanumeric identifier the message was sent from. - /// +15553332222 - [DataMember(Name = "from", IsRequired = true, EmitDefaultValue = true)] + /* +15553332222 */ + [JsonPropertyName("from")] public string From { get; set; } + /// + /// Used to track the state of Text + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TextOption { get; private set; } + /// /// Gets or Sets Text /// - /// Hello world - [DataMember(Name = "text", EmitDefaultValue = false)] - public string Text { get; set; } + /* Hello world */ + [JsonPropertyName("text")] + public string Text { get { return this.TextOption; } set { this.TextOption = new Option(value); } } + + /// + /// Used to track the state of Tag + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TagOption { get; private set; } /// /// A custom string that will be included in callback events of the message. Max 1024 characters. /// /// A custom string that will be included in callback events of the message. Max 1024 characters. - /// custom string - [DataMember(Name = "tag", EmitDefaultValue = false)] - public string Tag { get; set; } + /* custom string */ + [JsonPropertyName("tag")] + public string Tag { get { return this.TagOption; } set { this.TagOption = new Option(value); } } + + /// + /// Used to track the state of Media + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> MediaOption { get; private set; } /// /// Optional media, not applicable for sms /// /// Optional media, not applicable for sms - /// ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"] - [DataMember(Name = "media", EmitDefaultValue = false)] - public List Media { get; set; } + /* ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"] */ + [JsonPropertyName("media")] + public List Media { get { return this.MediaOption; } set { this.MediaOption = new Option>(value); } } /// /// Returns the string presentation of the object @@ -216,15 +222,6 @@ public override string ToString() return sb.ToString(); } - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - /// /// To validate all properties of the instance /// @@ -236,4 +233,265 @@ IEnumerable IValidatableObject.Validate(ValidationContext vali } } + /// + /// A Json converter for type + /// + public class StatusCallbackMessageJsonConverter : JsonConverter + { + /// + /// The format to use to serialize Time + /// + public static string TimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override StatusCallbackMessage Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + Option owner = default; + Option applicationId = default; + Option time = default; + Option segmentCount = default; + Option direction = default; + Option> to = default; + Option from = default; + Option text = default; + Option tag = default; + Option> media = default; + Option priority = default; + Option channel = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + id = new Option(utf8JsonReader.GetString()); + break; + case "owner": + owner = new Option(utf8JsonReader.GetString()); + break; + case "applicationId": + applicationId = new Option(utf8JsonReader.GetString()); + break; + case "time": + time = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "segmentCount": + segmentCount = new Option(utf8JsonReader.TokenType == JsonTokenType.Null ? (int?)null : utf8JsonReader.GetInt32()); + break; + case "direction": + string directionRawValue = utf8JsonReader.GetString(); + if (directionRawValue != null) + direction = new Option(MessageDirectionEnumValueConverter.FromStringOrDefault(directionRawValue)); + break; + case "to": + to = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "from": + from = new Option(utf8JsonReader.GetString()); + break; + case "text": + text = new Option(utf8JsonReader.GetString()); + break; + case "tag": + tag = new Option(utf8JsonReader.GetString()); + break; + case "media": + media = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "priority": + string priorityRawValue = utf8JsonReader.GetString(); + if (priorityRawValue != null) + priority = new Option(PriorityEnumValueConverter.FromStringOrDefault(priorityRawValue)); + break; + case "channel": + string channelRawValue = utf8JsonReader.GetString(); + if (channelRawValue != null) + channel = new Option(MultiChannelMessageChannelEnumValueConverter.FromStringOrDefault(channelRawValue)); + break; + default: + break; + } + } + } + + if (!id.IsSet) + throw new ArgumentException("Property is required for class StatusCallbackMessage.", nameof(id)); + + if (!owner.IsSet) + throw new ArgumentException("Property is required for class StatusCallbackMessage.", nameof(owner)); + + if (!applicationId.IsSet) + throw new ArgumentException("Property is required for class StatusCallbackMessage.", nameof(applicationId)); + + if (!time.IsSet) + throw new ArgumentException("Property is required for class StatusCallbackMessage.", nameof(time)); + + if (!segmentCount.IsSet) + throw new ArgumentException("Property is required for class StatusCallbackMessage.", nameof(segmentCount)); + + if (!direction.IsSet) + throw new ArgumentException("Property is required for class StatusCallbackMessage.", nameof(direction)); + + if (!to.IsSet) + throw new ArgumentException("Property is required for class StatusCallbackMessage.", nameof(to)); + + if (!from.IsSet) + throw new ArgumentException("Property is required for class StatusCallbackMessage.", nameof(from)); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class StatusCallbackMessage."); + + if (owner.IsSet && owner.Value == null) + throw new ArgumentNullException(nameof(owner), "Property is not nullable for class StatusCallbackMessage."); + + if (applicationId.IsSet && applicationId.Value == null) + throw new ArgumentNullException(nameof(applicationId), "Property is not nullable for class StatusCallbackMessage."); + + if (time.IsSet && time.Value == null) + throw new ArgumentNullException(nameof(time), "Property is not nullable for class StatusCallbackMessage."); + + if (segmentCount.IsSet && segmentCount.Value == null) + throw new ArgumentNullException(nameof(segmentCount), "Property is not nullable for class StatusCallbackMessage."); + + if (direction.IsSet && direction.Value == null) + throw new ArgumentNullException(nameof(direction), "Property is not nullable for class StatusCallbackMessage."); + + if (to.IsSet && to.Value == null) + throw new ArgumentNullException(nameof(to), "Property is not nullable for class StatusCallbackMessage."); + + if (from.IsSet && from.Value == null) + throw new ArgumentNullException(nameof(from), "Property is not nullable for class StatusCallbackMessage."); + + if (text.IsSet && text.Value == null) + throw new ArgumentNullException(nameof(text), "Property is not nullable for class StatusCallbackMessage."); + + if (tag.IsSet && tag.Value == null) + throw new ArgumentNullException(nameof(tag), "Property is not nullable for class StatusCallbackMessage."); + + if (media.IsSet && media.Value == null) + throw new ArgumentNullException(nameof(media), "Property is not nullable for class StatusCallbackMessage."); + + if (priority.IsSet && priority.Value == null) + throw new ArgumentNullException(nameof(priority), "Property is not nullable for class StatusCallbackMessage."); + + if (channel.IsSet && channel.Value == null) + throw new ArgumentNullException(nameof(channel), "Property is not nullable for class StatusCallbackMessage."); + + return new StatusCallbackMessage(id.Value, owner.Value, applicationId.Value, time.Value.Value, segmentCount.Value.Value, direction.Value.Value, to.Value, from.Value, text, tag, media, priority, channel); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, StatusCallbackMessage statusCallbackMessage, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, statusCallbackMessage, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, StatusCallbackMessage statusCallbackMessage, JsonSerializerOptions jsonSerializerOptions) + { + if (statusCallbackMessage.Id == null) + throw new ArgumentNullException(nameof(statusCallbackMessage.Id), "Property is required for class StatusCallbackMessage."); + + if (statusCallbackMessage.Owner == null) + throw new ArgumentNullException(nameof(statusCallbackMessage.Owner), "Property is required for class StatusCallbackMessage."); + + if (statusCallbackMessage.ApplicationId == null) + throw new ArgumentNullException(nameof(statusCallbackMessage.ApplicationId), "Property is required for class StatusCallbackMessage."); + + if (statusCallbackMessage.To == null) + throw new ArgumentNullException(nameof(statusCallbackMessage.To), "Property is required for class StatusCallbackMessage."); + + if (statusCallbackMessage.From == null) + throw new ArgumentNullException(nameof(statusCallbackMessage.From), "Property is required for class StatusCallbackMessage."); + + if (statusCallbackMessage.TextOption.IsSet && statusCallbackMessage.Text == null) + throw new ArgumentNullException(nameof(statusCallbackMessage.Text), "Property is required for class StatusCallbackMessage."); + + if (statusCallbackMessage.TagOption.IsSet && statusCallbackMessage.Tag == null) + throw new ArgumentNullException(nameof(statusCallbackMessage.Tag), "Property is required for class StatusCallbackMessage."); + + if (statusCallbackMessage.MediaOption.IsSet && statusCallbackMessage.Media == null) + throw new ArgumentNullException(nameof(statusCallbackMessage.Media), "Property is required for class StatusCallbackMessage."); + + writer.WriteString("id", statusCallbackMessage.Id); + + writer.WriteString("owner", statusCallbackMessage.Owner); + + writer.WriteString("applicationId", statusCallbackMessage.ApplicationId); + + writer.WriteString("time", statusCallbackMessage.Time.ToString(TimeFormat)); + + writer.WriteNumber("segmentCount", statusCallbackMessage.SegmentCount); + + var directionRawValue = MessageDirectionEnumValueConverter.ToJsonValue(statusCallbackMessage.Direction); + writer.WriteString("direction", directionRawValue); + + writer.WritePropertyName("to"); + JsonSerializer.Serialize(writer, statusCallbackMessage.To, jsonSerializerOptions); + writer.WriteString("from", statusCallbackMessage.From); + + if (statusCallbackMessage.TextOption.IsSet) + writer.WriteString("text", statusCallbackMessage.Text); + + if (statusCallbackMessage.TagOption.IsSet) + writer.WriteString("tag", statusCallbackMessage.Tag); + + if (statusCallbackMessage.MediaOption.IsSet) + { + writer.WritePropertyName("media"); + JsonSerializer.Serialize(writer, statusCallbackMessage.Media, jsonSerializerOptions); + } + if (statusCallbackMessage.PriorityOption.IsSet) + { + var priorityRawValue = PriorityEnumValueConverter.ToJsonValue(statusCallbackMessage.Priority.Value); + writer.WriteString("priority", priorityRawValue); + } + if (statusCallbackMessage.ChannelOption.IsSet) + { + var channelRawValue = MultiChannelMessageChannelEnumValueConverter.ToJsonValue(statusCallbackMessage.Channel.Value); + writer.WriteString("channel", channelRawValue); + } + } + } } diff --git a/src/Bandwidth.Standard/Model/StatusCallbackTypeEnum.cs b/src/Bandwidth.Standard/Model/StatusCallbackTypeEnum.cs index 325e4a37..31c00773 100644 --- a/src/Bandwidth.Standard/Model/StatusCallbackTypeEnum.cs +++ b/src/Bandwidth.Standard/Model/StatusCallbackTypeEnum.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,21 +9,18 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { @@ -30,32 +28,176 @@ namespace Bandwidth.Standard.Model /// 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-delivered` indicates that the message was successfully sent. - `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. /// /// 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-delivered` indicates that the message was successfully sent. - `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. - [JsonConverter(typeof(StringEnumConverter))] public enum StatusCallbackTypeEnum { /// - /// Enum Sending for value: message-sending + /// Enum MessageSending for value: message-sending + /// + MessageSending = 1, + + /// + /// Enum MessageDelivered for value: message-delivered + /// + MessageDelivered = 2, + + /// + /// Enum MessageFailed for value: message-failed /// - [EnumMember(Value = "message-sending")] - Sending = 1, + MessageFailed = 3, /// - /// Enum Delivered for value: message-delivered + /// Enum MessageRead for value: message-read + /// + MessageRead = 4 + } + + /// + /// Converts to and from the JSON value + /// + public static class StatusCallbackTypeEnumValueConverter + { + /// + /// Parses a given value to /// - [EnumMember(Value = "message-delivered")] - Delivered = 2, + /// + /// + public static StatusCallbackTypeEnum FromString(string value) + { + if (value.Equals("message-sending")) + return StatusCallbackTypeEnum.MessageSending; + + if (value.Equals("message-delivered")) + return StatusCallbackTypeEnum.MessageDelivered; + + if (value.Equals("message-failed")) + return StatusCallbackTypeEnum.MessageFailed; + + if (value.Equals("message-read")) + return StatusCallbackTypeEnum.MessageRead; + + throw new NotImplementedException($"Could not convert value to type StatusCallbackTypeEnum: '{value}'"); + } /// - /// Enum Failed for value: message-failed + /// Parses a given value to /// - [EnumMember(Value = "message-failed")] - Failed = 3, + /// + /// + public static StatusCallbackTypeEnum? FromStringOrDefault(string value) + { + if (value.Equals("message-sending")) + return StatusCallbackTypeEnum.MessageSending; + + if (value.Equals("message-delivered")) + return StatusCallbackTypeEnum.MessageDelivered; + + if (value.Equals("message-failed")) + return StatusCallbackTypeEnum.MessageFailed; + + if (value.Equals("message-read")) + return StatusCallbackTypeEnum.MessageRead; + + return null; + } /// - /// Enum Read for value: message-read + /// Converts the to the json value /// - [EnumMember(Value = "message-read")] - Read = 4 + /// + /// + /// + public static string ToJsonValue(StatusCallbackTypeEnum value) + { + if (value == StatusCallbackTypeEnum.MessageSending) + return "message-sending"; + + if (value == StatusCallbackTypeEnum.MessageDelivered) + return "message-delivered"; + + if (value == StatusCallbackTypeEnum.MessageFailed) + return "message-failed"; + + if (value == StatusCallbackTypeEnum.MessageRead) + return "message-read"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } } + /// + /// A Json converter for type + /// + /// + public class StatusCallbackTypeEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override StatusCallbackTypeEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + StatusCallbackTypeEnum? result = rawValue == null + ? null + : StatusCallbackTypeEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the StatusCallbackTypeEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, StatusCallbackTypeEnum statusCallbackTypeEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(StatusCallbackTypeEnumValueConverter.ToJsonValue(statusCallbackTypeEnum).ToString()); + } + } + + /// + /// A Json converter for type + /// + public class StatusCallbackTypeEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a StatusCallbackTypeEnum from the Json object + /// + /// + /// + /// + /// + public override StatusCallbackTypeEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + StatusCallbackTypeEnum? result = rawValue == null + ? null + : StatusCallbackTypeEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the StatusCallbackTypeEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, StatusCallbackTypeEnum? statusCallbackTypeEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(statusCallbackTypeEnum.HasValue ? StatusCallbackTypeEnumValueConverter.ToJsonValue(statusCallbackTypeEnum.Value).ToString() : "null"); + } + } } diff --git a/src/Bandwidth.Standard/Model/StirShaken.cs b/src/Bandwidth.Standard/Model/StirShaken.cs index ecc36538..4f395625 100644 --- a/src/Bandwidth.Standard/Model/StirShaken.cs +++ b/src/Bandwidth.Standard/Model/StirShaken.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,66 +9,87 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { /// /// StirShaken /// - [DataContract(Name = "stirShaken")] public partial class StirShaken : IValidatableObject { /// /// Initializes a new instance of the class. /// - /// (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Validation-Passed and TN-Validation-Failed.. - /// (optional) The attestation level verified by Bandwidth. Possible values are A (full), B (partial) or C (gateway).. - /// (optional) A unique origination identifier.. - public StirShaken(string verstat = default(string), string attestationIndicator = default(string), string originatingId = default(string)) + /// (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Validation-Passed and TN-Validation-Failed. + /// (optional) The attestation level verified by Bandwidth. Possible values are A (full), B (partial) or C (gateway). + /// (optional) A unique origination identifier. + [JsonConstructor] + public StirShaken(Option verstat = default, Option attestationIndicator = default, Option originatingId = default) { - this.Verstat = verstat; - this.AttestationIndicator = attestationIndicator; - this.OriginatingId = originatingId; + VerstatOption = verstat; + AttestationIndicatorOption = attestationIndicator; + OriginatingIdOption = originatingId; + OnCreated(); } + partial void OnCreated(); + + /// + /// Used to track the state of Verstat + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VerstatOption { get; private set; } + /// /// (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Validation-Passed and TN-Validation-Failed. /// /// (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Validation-Passed and TN-Validation-Failed. - /// Tn-Validation-Passed - [DataMember(Name = "verstat", EmitDefaultValue = false)] - public string Verstat { get; set; } + /* Tn-Validation-Passed */ + [JsonPropertyName("verstat")] + public string Verstat { get { return this.VerstatOption; } set { this.VerstatOption = new Option(value); } } + + /// + /// Used to track the state of AttestationIndicator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AttestationIndicatorOption { get; private set; } /// /// (optional) The attestation level verified by Bandwidth. Possible values are A (full), B (partial) or C (gateway). /// /// (optional) The attestation level verified by Bandwidth. Possible values are A (full), B (partial) or C (gateway). - /// A - [DataMember(Name = "attestationIndicator", EmitDefaultValue = false)] - public string AttestationIndicator { get; set; } + /* A */ + [JsonPropertyName("attestationIndicator")] + public string AttestationIndicator { get { return this.AttestationIndicatorOption; } set { this.AttestationIndicatorOption = new Option(value); } } + + /// + /// Used to track the state of OriginatingId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OriginatingIdOption { get; private set; } /// /// (optional) A unique origination identifier. /// /// (optional) A unique origination identifier. - /// 99759086-1335-11ed-9bcf-5f7d464e91af - [DataMember(Name = "originatingId", EmitDefaultValue = false)] - public string OriginatingId { get; set; } + /* 99759086-1335-11ed-9bcf-5f7d464e91af */ + [JsonPropertyName("originatingId")] + public string OriginatingId { get { return this.OriginatingIdOption; } set { this.OriginatingIdOption = new Option(value); } } /// /// Returns the string presentation of the object @@ -84,15 +106,6 @@ public override string ToString() return sb.ToString(); } - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - /// /// To validate all properties of the instance /// @@ -104,4 +117,115 @@ IEnumerable IValidatableObject.Validate(ValidationContext vali } } + /// + /// A Json converter for type + /// + public class StirShakenJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override StirShaken Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option verstat = default; + Option attestationIndicator = default; + Option originatingId = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "verstat": + verstat = new Option(utf8JsonReader.GetString()); + break; + case "attestationIndicator": + attestationIndicator = new Option(utf8JsonReader.GetString()); + break; + case "originatingId": + originatingId = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (verstat.IsSet && verstat.Value == null) + throw new ArgumentNullException(nameof(verstat), "Property is not nullable for class StirShaken."); + + if (attestationIndicator.IsSet && attestationIndicator.Value == null) + throw new ArgumentNullException(nameof(attestationIndicator), "Property is not nullable for class StirShaken."); + + if (originatingId.IsSet && originatingId.Value == null) + throw new ArgumentNullException(nameof(originatingId), "Property is not nullable for class StirShaken."); + + return new StirShaken(verstat, attestationIndicator, originatingId); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, StirShaken stirShaken, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, stirShaken, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, StirShaken stirShaken, JsonSerializerOptions jsonSerializerOptions) + { + if (stirShaken.VerstatOption.IsSet && stirShaken.Verstat == null) + throw new ArgumentNullException(nameof(stirShaken.Verstat), "Property is required for class StirShaken."); + + if (stirShaken.AttestationIndicatorOption.IsSet && stirShaken.AttestationIndicator == null) + throw new ArgumentNullException(nameof(stirShaken.AttestationIndicator), "Property is required for class StirShaken."); + + if (stirShaken.OriginatingIdOption.IsSet && stirShaken.OriginatingId == null) + throw new ArgumentNullException(nameof(stirShaken.OriginatingId), "Property is required for class StirShaken."); + + if (stirShaken.VerstatOption.IsSet) + writer.WriteString("verstat", stirShaken.Verstat); + + if (stirShaken.AttestationIndicatorOption.IsSet) + writer.WriteString("attestationIndicator", stirShaken.AttestationIndicator); + + if (stirShaken.OriginatingIdOption.IsSet) + writer.WriteString("originatingId", stirShaken.OriginatingId); + } + } } diff --git a/src/Bandwidth.Standard/Model/SyncLookupRequest.cs b/src/Bandwidth.Standard/Model/SyncLookupRequest.cs index 486b7841..c1859327 100644 --- a/src/Bandwidth.Standard/Model/SyncLookupRequest.cs +++ b/src/Bandwidth.Standard/Model/SyncLookupRequest.cs @@ -1,3 +1,4 @@ +// /* * Bandwidth * @@ -8,54 +9,44 @@ * Generated by: https://github.com/openapitools/openapi-generator.git */ - using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; -using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter; +using Bandwidth.Standard.Client; namespace Bandwidth.Standard.Model { /// /// SyncLookupRequest /// - [DataContract(Name = "syncLookupRequest")] public partial class SyncLookupRequest : IValidatableObject { /// /// Initializes a new instance of the class. /// - [JsonConstructorAttribute] - protected SyncLookupRequest() { } - /// - /// Initializes a new instance of the class. - /// - /// Telephone numbers in E.164 format. (required). - public SyncLookupRequest(List phoneNumbers = default(List)) + /// Telephone numbers in E.164 format. + [JsonConstructor] + public SyncLookupRequest(List phoneNumbers) { - // to ensure "phoneNumbers" is required (not null) - if (phoneNumbers == null) - { - throw new ArgumentNullException("phoneNumbers is a required property for SyncLookupRequest and cannot be null"); - } - this.PhoneNumbers = phoneNumbers; + PhoneNumbers = phoneNumbers; + OnCreated(); } + partial void OnCreated(); + /// /// Telephone numbers in E.164 format. /// /// Telephone numbers in E.164 format. - [DataMember(Name = "phoneNumbers", IsRequired = true, EmitDefaultValue = true)] + [JsonPropertyName("phoneNumbers")] public List PhoneNumbers { get; set; } /// @@ -71,15 +62,6 @@ public override string ToString() return sb.ToString(); } - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - /// /// To validate all properties of the instance /// @@ -91,4 +73,92 @@ IEnumerable IValidatableObject.Validate(ValidationContext vali } } + /// + /// A Json converter for type + /// + public class SyncLookupRequestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SyncLookupRequest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> phoneNumbers = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "phoneNumbers": + phoneNumbers = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (!phoneNumbers.IsSet) + throw new ArgumentException("Property is required for class SyncLookupRequest.", nameof(phoneNumbers)); + + if (phoneNumbers.IsSet && phoneNumbers.Value == null) + throw new ArgumentNullException(nameof(phoneNumbers), "Property is not nullable for class SyncLookupRequest."); + + return new SyncLookupRequest(phoneNumbers.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SyncLookupRequest syncLookupRequest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, syncLookupRequest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SyncLookupRequest syncLookupRequest, JsonSerializerOptions jsonSerializerOptions) + { + if (syncLookupRequest.PhoneNumbers == null) + throw new ArgumentNullException(nameof(syncLookupRequest.PhoneNumbers), "Property is required for class SyncLookupRequest."); + + writer.WritePropertyName("phoneNumbers"); + JsonSerializer.Serialize(writer, syncLookupRequest.PhoneNumbers, jsonSerializerOptions); + } + } } diff --git a/src/Bandwidth.Standard/README.md b/src/Bandwidth.Standard/README.md new file mode 100644 index 00000000..9d3887be --- /dev/null +++ b/src/Bandwidth.Standard/README.md @@ -0,0 +1,119 @@ +# Created with Openapi Generator + + +## Creating the library +Create a config.yaml file similar to what is below, then run the following powershell command to generate the library `java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate -c config.yaml` + +```yaml +generatorName: csharp +inputSpec: bandwidth.yml +outputDir: out + +# https://openapi-generator.tech/docs/generators/csharp +additionalProperties: + packageGuid: '{D91CCDA0-F131-43F2-A229-AF5A3D89E2F3}' + +# https://openapi-generator.tech/docs/integrations/#github-integration +# gitHost: +# gitUserId: +# gitRepoId: + +# https://openapi-generator.tech/docs/globals +# globalProperties: + +# https://openapi-generator.tech/docs/customization/#inline-schema-naming +# inlineSchemaOptions: + +# https://openapi-generator.tech/docs/customization/#name-mapping +# modelNameMappings: +# nameMappings: + +# https://openapi-generator.tech/docs/customization/#openapi-normalizer +# openapiNormalizer: + +# templateDir: https://openapi-generator.tech/docs/templating/#modifying-templates + +# releaseNote: +``` + + +## Using the library in your project + +```cs +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Bandwidth.Standard.Api; +using Bandwidth.Standard.Client; +using Bandwidth.Standard.Model; +using Org.OpenAPITools.Extensions; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + ICreateCallApiResponse apiResponse = await api.CreateCallAsync("todo"); + CreateCallResponse model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureBandwidth((context, services, options) => + { + // The type of token here depends on the api security specifications + // Available token types are ApiKeyToken, BasicToken, BearerToken, HttpSigningToken, and OAuthToken. + BearerToken token = new(""); + options.AddTokens(token); + + // optionally choose the method the tokens will be provided with, default is RateLimitProvider + options.UseProvider, BearerToken>(); + + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddBandwidthHttpClients(client => + { + // client configuration + }, builder => + { + builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)); + // add whatever middleware you prefer + } + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + Configure Polly in the IHttpClientBuilder +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After partial methods in the api classes. + +## Api Information +- appName: Bandwidth +- appVersion: 1.0.0 +- appDescription: Bandwidth's Communication APIs + +## Build +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. + +- SDK version: 1.0.0 +- Generator version: 7.17.0 +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen