From 0a3593d451cd2d6591d01daf7dfed837e4075c77 Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Fri, 14 Oct 2022 11:07:49 -0400 Subject: [PATCH 01/10] DX-2935 Remove WebRTC --- .openapi-generator/FILES | 26 - README.md | 22 - bandwidth/api/participants_api.py | 488 ----------- bandwidth/api/statistics_api.py | 179 ---- bandwidth/apis/__init__.py | 2 - bandwidth/model/create_participant_request.py | 286 ------- .../model/create_participant_response.py | 274 ------- bandwidth/model/device_api_version_enum.py | 282 ------- bandwidth/model/forbidden_request.py | 264 ------ bandwidth/model/participant.py | 302 ------- bandwidth/model/participant_subscription.py | 276 ------- bandwidth/model/publish_permissions_enum.py | 291 ------- bandwidth/model/request_error.py | 268 ------ bandwidth/model/session.py | 268 ------ bandwidth/model/subscriptions.py | 274 ------- bandwidth/model/unauthorized_request.py | 264 ------ bandwidth/models/__init__.py | 11 - docs/CreateParticipantRequest.md | 16 - docs/CreateParticipantResponse.md | 14 - docs/DeviceApiVersionEnum.md | 12 - docs/ForbiddenRequest.md | 12 - docs/Participant.md | 19 - docs/ParticipantSubscription.md | 13 - docs/ParticipantsApi.md | 289 ------- docs/Session.md | 14 - docs/SessionsApi.md | 772 ------------------ docs/Subscriptions.md | 13 - docs/UnauthorizedRequest.md | 12 - test/integration/test_webrtc_api.py | 258 ------ 29 files changed, 5221 deletions(-) delete mode 100644 bandwidth/api/participants_api.py delete mode 100644 bandwidth/api/statistics_api.py delete mode 100644 bandwidth/model/create_participant_request.py delete mode 100644 bandwidth/model/create_participant_response.py delete mode 100644 bandwidth/model/device_api_version_enum.py delete mode 100644 bandwidth/model/forbidden_request.py delete mode 100644 bandwidth/model/participant.py delete mode 100644 bandwidth/model/participant_subscription.py delete mode 100644 bandwidth/model/publish_permissions_enum.py delete mode 100644 bandwidth/model/request_error.py delete mode 100644 bandwidth/model/session.py delete mode 100644 bandwidth/model/subscriptions.py delete mode 100644 bandwidth/model/unauthorized_request.py delete mode 100644 docs/CreateParticipantRequest.md delete mode 100644 docs/CreateParticipantResponse.md delete mode 100644 docs/DeviceApiVersionEnum.md delete mode 100644 docs/ForbiddenRequest.md delete mode 100644 docs/Participant.md delete mode 100644 docs/ParticipantSubscription.md delete mode 100644 docs/ParticipantsApi.md delete mode 100644 docs/Session.md delete mode 100644 docs/SessionsApi.md delete mode 100644 docs/Subscriptions.md delete mode 100644 docs/UnauthorizedRequest.md delete mode 100644 test/integration/test_webrtc_api.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 47e2a5a1..ae594a2e 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -8,10 +8,8 @@ bandwidth/api/conferences_api.py bandwidth/api/media_api.py bandwidth/api/messages_api.py bandwidth/api/mfa_api.py -bandwidth/api/participants_api.py bandwidth/api/phone_number_lookup_api.py bandwidth/api/recordings_api.py -bandwidth/api/sessions_api.py bandwidth/api/statistics_api.py bandwidth/api_client.py bandwidth/apis/__init__.py @@ -42,16 +40,12 @@ bandwidth/model/create_call.py bandwidth/model/create_call_response.py bandwidth/model/create_lookup_response.py bandwidth/model/create_message_request_error.py -bandwidth/model/create_participant_request.py -bandwidth/model/create_participant_response.py bandwidth/model/deferred_result.py -bandwidth/model/device_api_version_enum.py bandwidth/model/disconenct_callback.py bandwidth/model/diversion.py bandwidth/model/dtmf_callback.py bandwidth/model/field_error.py bandwidth/model/file_format_enum.py -bandwidth/model/forbidden_request.py bandwidth/model/gather_callback.py bandwidth/model/initiate_callback.py bandwidth/model/list_message_direction_enum.py @@ -76,19 +70,13 @@ bandwidth/model/mfa_forbidden_request_error.py bandwidth/model/mfa_request_error.py bandwidth/model/mfa_unauthorized_request_error.py bandwidth/model/page_info.py -bandwidth/model/participant.py -bandwidth/model/participant_subscription.py bandwidth/model/priority_enum.py -bandwidth/model/publish_permissions_enum.py bandwidth/model/recording_available_callback.py bandwidth/model/recording_complete_callback.py bandwidth/model/recording_state_enum.py bandwidth/model/redirect_callback.py bandwidth/model/redirect_method_enum.py -bandwidth/model/request_error.py -bandwidth/model/session.py bandwidth/model/stir_shaken.py -bandwidth/model/subscriptions.py bandwidth/model/tag.py bandwidth/model/tn_lookup_request_error.py bandwidth/model/transcribe_recording.py @@ -99,7 +87,6 @@ bandwidth/model/transcription_metadata.py bandwidth/model/transfer_answer_callback.py bandwidth/model/transfer_complete_callback.py bandwidth/model/transfer_disconnect_callback.py -bandwidth/model/unauthorized_request.py bandwidth/model/update_call.py bandwidth/model/update_call_recording.py bandwidth/model/update_conference.py @@ -137,16 +124,12 @@ docs/CreateCall.md docs/CreateCallResponse.md docs/CreateLookupResponse.md docs/CreateMessageRequestError.md -docs/CreateParticipantRequest.md -docs/CreateParticipantResponse.md docs/DeferredResult.md -docs/DeviceApiVersionEnum.md docs/DisconenctCallback.md docs/Diversion.md docs/DtmfCallback.md docs/FieldError.md docs/FileFormatEnum.md -docs/ForbiddenRequest.md docs/GatherCallback.md docs/InitiateCallback.md docs/ListMessageDirectionEnum.md @@ -174,24 +157,16 @@ docs/MfaForbiddenRequestError.md docs/MfaRequestError.md docs/MfaUnauthorizedRequestError.md docs/PageInfo.md -docs/Participant.md -docs/ParticipantSubscription.md -docs/ParticipantsApi.md docs/PhoneNumberLookupApi.md docs/PriorityEnum.md -docs/PublishPermissionsEnum.md docs/RecordingAvailableCallback.md docs/RecordingCompleteCallback.md docs/RecordingStateEnum.md docs/RecordingsApi.md docs/RedirectCallback.md docs/RedirectMethodEnum.md -docs/RequestError.md -docs/Session.md -docs/SessionsApi.md docs/StatisticsApi.md docs/StirShaken.md -docs/Subscriptions.md docs/Tag.md docs/TnLookupRequestError.md docs/TranscribeRecording.md @@ -202,7 +177,6 @@ docs/TranscriptionMetadata.md docs/TransferAnswerCallback.md docs/TransferCompleteCallback.md docs/TransferDisconnectCallback.md -docs/UnauthorizedRequest.md docs/UpdateCall.md docs/UpdateCallRecording.md docs/UpdateConference.md diff --git a/README.md b/README.md index 5f9b2047..2c93e413 100644 --- a/README.md +++ b/README.md @@ -153,9 +153,6 @@ Class | Method | HTTP request | Description *MediaApi* | [**upload_media**](docs/MediaApi.md#upload_media) | **PUT** /users/{accountId}/media/{mediaId} | Upload Media *MessagesApi* | [**create_message**](docs/MessagesApi.md#create_message) | **POST** /users/{accountId}/messages | Create Message *MessagesApi* | [**list_messages**](docs/MessagesApi.md#list_messages) | **GET** /users/{accountId}/messages | List Messages -*ParticipantsApi* | [**create_participant**](docs/ParticipantsApi.md#create_participant) | **POST** /accounts/{accountId}/participants | Create Participant -*ParticipantsApi* | [**delete_participant**](docs/ParticipantsApi.md#delete_participant) | **DELETE** /accounts/{accountId}/participants/{participantId} | Delete Participant -*ParticipantsApi* | [**get_participant**](docs/ParticipantsApi.md#get_participant) | **GET** /accounts/{accountId}/participants/{participantId} | Get Participant *PhoneNumberLookupApi* | [**create_lookup**](docs/PhoneNumberLookupApi.md#create_lookup) | **POST** /accounts/{accountId}/tnlookup | Create Lookup *PhoneNumberLookupApi* | [**get_lookup_status**](docs/PhoneNumberLookupApi.md#get_lookup_status) | **GET** /accounts/{accountId}/tnlookup/{requestId} | Get Lookup Request Status *RecordingsApi* | [**delete_call_transcription**](docs/RecordingsApi.md#delete_call_transcription) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Delete Transcription @@ -168,14 +165,6 @@ Class | Method | HTTP request | Description *RecordingsApi* | [**list_call_recordings**](docs/RecordingsApi.md#list_call_recordings) | **GET** /accounts/{accountId}/calls/{callId}/recordings | List Call Recordings *RecordingsApi* | [**transcribe_call_recording**](docs/RecordingsApi.md#transcribe_call_recording) | **POST** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Create Transcription Request *RecordingsApi* | [**update_call_recording_state**](docs/RecordingsApi.md#update_call_recording_state) | **PUT** /accounts/{accountId}/calls/{callId}/recording | Update Recording -*SessionsApi* | [**add_participant_to_session**](docs/SessionsApi.md#add_participant_to_session) | **PUT** /accounts/{accountId}/sessions/{sessionId}/participants/{participantId} | Add Participant to Session -*SessionsApi* | [**create_session**](docs/SessionsApi.md#create_session) | **POST** /accounts/{accountId}/sessions | Create Session -*SessionsApi* | [**delete_session**](docs/SessionsApi.md#delete_session) | **DELETE** /accounts/{accountId}/sessions/{sessionId} | Delete Session -*SessionsApi* | [**get_participant_subscriptions**](docs/SessionsApi.md#get_participant_subscriptions) | **GET** /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions | Get Participant Subscriptions -*SessionsApi* | [**get_session**](docs/SessionsApi.md#get_session) | **GET** /accounts/{accountId}/sessions/{sessionId} | Get Session -*SessionsApi* | [**list_session_participants**](docs/SessionsApi.md#list_session_participants) | **GET** /accounts/{accountId}/sessions/{sessionId}/participants | List Participants in Session -*SessionsApi* | [**remove_participant_from_session**](docs/SessionsApi.md#remove_participant_from_session) | **DELETE** /accounts/{accountId}/sessions/{sessionId}/participants/{participantId} | Remove Participant from Session -*SessionsApi* | [**update_participant_subscriptions**](docs/SessionsApi.md#update_participant_subscriptions) | **PUT** /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions | Update Participant Subscriptions *StatisticsApi* | [**get_statistics**](docs/StatisticsApi.md#get_statistics) | **GET** /accounts/{accountId}/statistics | Get Account Statistics @@ -205,16 +194,12 @@ Class | Method | HTTP request | Description - [CreateCallResponse](docs/CreateCallResponse.md) - [CreateLookupResponse](docs/CreateLookupResponse.md) - [CreateMessageRequestError](docs/CreateMessageRequestError.md) - - [CreateParticipantRequest](docs/CreateParticipantRequest.md) - - [CreateParticipantResponse](docs/CreateParticipantResponse.md) - [DeferredResult](docs/DeferredResult.md) - - [DeviceApiVersionEnum](docs/DeviceApiVersionEnum.md) - [DisconenctCallback](docs/DisconenctCallback.md) - [Diversion](docs/Diversion.md) - [DtmfCallback](docs/DtmfCallback.md) - [FieldError](docs/FieldError.md) - [FileFormatEnum](docs/FileFormatEnum.md) - - [ForbiddenRequest](docs/ForbiddenRequest.md) - [GatherCallback](docs/GatherCallback.md) - [InitiateCallback](docs/InitiateCallback.md) - [ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) @@ -239,19 +224,13 @@ Class | Method | HTTP request | Description - [MfaRequestError](docs/MfaRequestError.md) - [MfaUnauthorizedRequestError](docs/MfaUnauthorizedRequestError.md) - [PageInfo](docs/PageInfo.md) - - [Participant](docs/Participant.md) - - [ParticipantSubscription](docs/ParticipantSubscription.md) - [PriorityEnum](docs/PriorityEnum.md) - - [PublishPermissionsEnum](docs/PublishPermissionsEnum.md) - [RecordingAvailableCallback](docs/RecordingAvailableCallback.md) - [RecordingCompleteCallback](docs/RecordingCompleteCallback.md) - [RecordingStateEnum](docs/RecordingStateEnum.md) - [RedirectCallback](docs/RedirectCallback.md) - [RedirectMethodEnum](docs/RedirectMethodEnum.md) - - [RequestError](docs/RequestError.md) - - [Session](docs/Session.md) - [StirShaken](docs/StirShaken.md) - - [Subscriptions](docs/Subscriptions.md) - [Tag](docs/Tag.md) - [TnLookupRequestError](docs/TnLookupRequestError.md) - [TranscribeRecording](docs/TranscribeRecording.md) @@ -262,7 +241,6 @@ Class | Method | HTTP request | Description - [TransferAnswerCallback](docs/TransferAnswerCallback.md) - [TransferCompleteCallback](docs/TransferCompleteCallback.md) - [TransferDisconnectCallback](docs/TransferDisconnectCallback.md) - - [UnauthorizedRequest](docs/UnauthorizedRequest.md) - [UpdateCall](docs/UpdateCall.md) - [UpdateCallRecording](docs/UpdateCallRecording.md) - [UpdateConference](docs/UpdateConference.md) diff --git a/bandwidth/api/participants_api.py b/bandwidth/api/participants_api.py deleted file mode 100644 index 1e6cf02a..00000000 --- a/bandwidth/api/participants_api.py +++ /dev/null @@ -1,488 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.api_client import ApiClient, Endpoint as _Endpoint -from bandwidth.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from bandwidth.model.create_participant_request import CreateParticipantRequest -from bandwidth.model.create_participant_response import CreateParticipantResponse -from bandwidth.model.forbidden_request import ForbiddenRequest -from bandwidth.model.participant import Participant -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest - - -class ParticipantsApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - self.create_participant_endpoint = _Endpoint( - settings={ - 'response_type': (CreateParticipantResponse,), - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/participants', - 'operation_id': 'create_participant', - 'http_method': 'POST', - 'servers': [ - { - 'url': "https://api.webrtc.bandwidth.com/v1", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - 'create_participant_request', - ], - 'required': [ - 'account_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - 'create_participant_request': - (CreateParticipantRequest,), - }, - 'attribute_map': { - 'account_id': 'accountId', - }, - 'location_map': { - 'account_id': 'path', - 'create_participant_request': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.delete_participant_endpoint = _Endpoint( - settings={ - 'response_type': None, - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/participants/{participantId}', - 'operation_id': 'delete_participant', - 'http_method': 'DELETE', - 'servers': [ - { - 'url': "https://api.webrtc.bandwidth.com/v1", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - 'participant_id', - ], - 'required': [ - 'account_id', - 'participant_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - 'participant_id': - (str,), - }, - 'attribute_map': { - 'account_id': 'accountId', - 'participant_id': 'participantId', - }, - 'location_map': { - 'account_id': 'path', - 'participant_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.get_participant_endpoint = _Endpoint( - settings={ - 'response_type': (Participant,), - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/participants/{participantId}', - 'operation_id': 'get_participant', - 'http_method': 'GET', - 'servers': [ - { - 'url': "https://api.webrtc.bandwidth.com/v1", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - 'participant_id', - ], - 'required': [ - 'account_id', - 'participant_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - 'participant_id': - (str,), - }, - 'attribute_map': { - 'account_id': 'accountId', - 'participant_id': 'participantId', - }, - 'location_map': { - 'account_id': 'path', - 'participant_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - - def create_participant( - self, - account_id, - **kwargs - ): - """Create Participant # noqa: E501 - - Create a new participant under this account. Participants are idempotent, so relevant parameters must be set in this function if desired. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_participant(account_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Account ID - - Keyword Args: - create_participant_request (CreateParticipantRequest): Create participant request body.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - CreateParticipantResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - return self.create_participant_endpoint.call_with_http_info(**kwargs) - - def delete_participant( - self, - account_id, - participant_id, - **kwargs - ): - """Delete Participant # noqa: E501 - - Delete participant by ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_participant(account_id, participant_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Account ID - participant_id (str): Participant ID - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - kwargs['participant_id'] = \ - participant_id - return self.delete_participant_endpoint.call_with_http_info(**kwargs) - - def get_participant( - self, - account_id, - participant_id, - **kwargs - ): - """Get Participant # noqa: E501 - - Get participant by ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_participant(account_id, participant_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Account ID - participant_id (str): Participant ID - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - Participant - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - kwargs['participant_id'] = \ - participant_id - return self.get_participant_endpoint.call_with_http_info(**kwargs) - diff --git a/bandwidth/api/statistics_api.py b/bandwidth/api/statistics_api.py deleted file mode 100644 index e7190d50..00000000 --- a/bandwidth/api/statistics_api.py +++ /dev/null @@ -1,179 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.api_client import ApiClient, Endpoint as _Endpoint -from bandwidth.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from bandwidth.model.account_statistics import AccountStatistics -from bandwidth.model.voice_api_error import VoiceApiError - - -class StatisticsApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - self.get_statistics_endpoint = _Endpoint( - settings={ - 'response_type': (AccountStatistics,), - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/statistics', - 'operation_id': 'get_statistics', - 'http_method': 'GET', - 'servers': [ - { - 'url': "https://voice.bandwidth.com/api/v2", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - ], - 'required': [ - 'account_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - }, - 'attribute_map': { - 'account_id': 'accountId', - }, - 'location_map': { - 'account_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - - def get_statistics( - self, - account_id, - **kwargs - ): - """Get Account Statistics # noqa: E501 - - Returns details about the current state of the account. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_statistics(account_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Your Bandwidth Account ID - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - AccountStatistics - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - return self.get_statistics_endpoint.call_with_http_info(**kwargs) - diff --git a/bandwidth/apis/__init__.py b/bandwidth/apis/__init__.py index 24153c58..80e9c676 100644 --- a/bandwidth/apis/__init__.py +++ b/bandwidth/apis/__init__.py @@ -19,8 +19,6 @@ from bandwidth.api.mfa_api import MFAApi from bandwidth.api.media_api import MediaApi from bandwidth.api.messages_api import MessagesApi -from bandwidth.api.participants_api import ParticipantsApi from bandwidth.api.phone_number_lookup_api import PhoneNumberLookupApi from bandwidth.api.recordings_api import RecordingsApi -from bandwidth.api.sessions_api import SessionsApi from bandwidth.api.statistics_api import StatisticsApi diff --git a/bandwidth/model/create_participant_request.py b/bandwidth/model/create_participant_request.py deleted file mode 100644 index 8c7584be..00000000 --- a/bandwidth/model/create_participant_request.py +++ /dev/null @@ -1,286 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from bandwidth.exceptions import ApiAttributeError - - -def lazy_import(): - from bandwidth.model.device_api_version_enum import DeviceApiVersionEnum - from bandwidth.model.publish_permissions_enum import PublishPermissionsEnum - globals()['DeviceApiVersionEnum'] = DeviceApiVersionEnum - globals()['PublishPermissionsEnum'] = PublishPermissionsEnum - - -class CreateParticipantRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - ('publish_permissions',): { - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - lazy_import() - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - lazy_import() - return { - 'callback_url': (str, none_type,), # noqa: E501 - 'publish_permissions': ([PublishPermissionsEnum],), # noqa: E501 - 'tag': (str,), # noqa: E501 - 'device_api_version': (DeviceApiVersionEnum,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'callback_url': 'callbackUrl', # noqa: E501 - 'publish_permissions': 'publishPermissions', # noqa: E501 - 'tag': 'tag', # noqa: E501 - 'device_api_version': 'deviceApiVersion', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """CreateParticipantRequest - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - callback_url (str, none_type): Full callback url to use for notifications about this participant.. [optional] # noqa: E501 - publish_permissions ([PublishPermissionsEnum]): Defines if this participant can publish audio or video.. [optional] # noqa: E501 - tag (str): User defined tag to associate with the participant.. [optional] # noqa: E501 - device_api_version (DeviceApiVersionEnum): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', True) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """CreateParticipantRequest - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - callback_url (str, none_type): Full callback url to use for notifications about this participant.. [optional] # noqa: E501 - publish_permissions ([PublishPermissionsEnum]): Defines if this participant can publish audio or video.. [optional] # noqa: E501 - tag (str): User defined tag to associate with the participant.. [optional] # noqa: E501 - device_api_version (DeviceApiVersionEnum): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/bandwidth/model/create_participant_response.py b/bandwidth/model/create_participant_response.py deleted file mode 100644 index 1b173fab..00000000 --- a/bandwidth/model/create_participant_response.py +++ /dev/null @@ -1,274 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from bandwidth.exceptions import ApiAttributeError - - -def lazy_import(): - from bandwidth.model.participant import Participant - globals()['Participant'] = Participant - - -class CreateParticipantResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - lazy_import() - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - lazy_import() - return { - 'participant': (Participant,), # noqa: E501 - 'token': (str,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'participant': 'participant', # noqa: E501 - 'token': 'token', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """CreateParticipantResponse - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - participant (Participant): [optional] # noqa: E501 - token (str): Auth token for the returned participant. This should be passed to the participant so that they can connect to the platform.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', True) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """CreateParticipantResponse - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - participant (Participant): [optional] # noqa: E501 - token (str): Auth token for the returned participant. This should be passed to the participant so that they can connect to the platform.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/bandwidth/model/device_api_version_enum.py b/bandwidth/model/device_api_version_enum.py deleted file mode 100644 index 1967c940..00000000 --- a/bandwidth/model/device_api_version_enum.py +++ /dev/null @@ -1,282 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from bandwidth.exceptions import ApiAttributeError - - - -class DeviceApiVersionEnum(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('value',): { - 'V3': "V3", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': (str,), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """DeviceApiVersionEnum - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Optional field to define the device api version of this participant.. if omitted defaults to "V3", must be one of ["V3", ] # noqa: E501 - - Keyword Args: - value (str): Optional field to define the device api version of this participant.. if omitted defaults to "V3", must be one of ["V3", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - value = "V3" - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """DeviceApiVersionEnum - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Optional field to define the device api version of this participant.. if omitted defaults to "V3", must be one of ["V3", ] # noqa: E501 - - Keyword Args: - value (str): Optional field to define the device api version of this participant.. if omitted defaults to "V3", must be one of ["V3", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - value = "V3" - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/bandwidth/model/forbidden_request.py b/bandwidth/model/forbidden_request.py deleted file mode 100644 index 18931463..00000000 --- a/bandwidth/model/forbidden_request.py +++ /dev/null @@ -1,264 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from bandwidth.exceptions import ApiAttributeError - - - -class ForbiddenRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message': 'message', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ForbiddenRequest - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (str): The message containing the reason behind the request being forbidden.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', True) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ForbiddenRequest - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (str): The message containing the reason behind the request being forbidden.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/bandwidth/model/participant.py b/bandwidth/model/participant.py deleted file mode 100644 index deaab0ec..00000000 --- a/bandwidth/model/participant.py +++ /dev/null @@ -1,302 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from bandwidth.exceptions import ApiAttributeError - - -def lazy_import(): - from bandwidth.model.device_api_version_enum import DeviceApiVersionEnum - from bandwidth.model.publish_permissions_enum import PublishPermissionsEnum - from bandwidth.model.subscriptions import Subscriptions - globals()['DeviceApiVersionEnum'] = DeviceApiVersionEnum - globals()['PublishPermissionsEnum'] = PublishPermissionsEnum - globals()['Subscriptions'] = Subscriptions - - -class Participant(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - ('publish_permissions',): { - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - lazy_import() - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - lazy_import() - return { - 'id': (str,), # noqa: E501 - 'callback_url': (str, none_type,), # noqa: E501 - 'publish_permissions': ([PublishPermissionsEnum],), # noqa: E501 - 'sessions': ([str],), # noqa: E501 - 'subscriptions': (Subscriptions,), # noqa: E501 - 'tag': (str,), # noqa: E501 - 'device_api_version': (DeviceApiVersionEnum,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'callback_url': 'callbackUrl', # noqa: E501 - 'publish_permissions': 'publishPermissions', # noqa: E501 - 'sessions': 'sessions', # noqa: E501 - 'subscriptions': 'subscriptions', # noqa: E501 - 'tag': 'tag', # noqa: E501 - 'device_api_version': 'deviceApiVersion', # noqa: E501 - } - - read_only_vars = { - 'id', # noqa: E501 - 'sessions', # noqa: E501 - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Participant - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Unique id of the participant.. [optional] # noqa: E501 - callback_url (str, none_type): Full callback url to use for notifications about this participant.. [optional] # noqa: E501 - publish_permissions ([PublishPermissionsEnum]): Defines if this participant can publish audio or video.. [optional] # noqa: E501 - sessions ([str]): List of session ids this participant is associated with Capped to one Upon creation of a Participant, returns as an empty array.. [optional] # noqa: E501 - subscriptions (Subscriptions): [optional] # noqa: E501 - tag (str): User defined tag to associate with the participant.. [optional] # noqa: E501 - device_api_version (DeviceApiVersionEnum): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', True) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Participant - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Unique id of the participant.. [optional] # noqa: E501 - callback_url (str, none_type): Full callback url to use for notifications about this participant.. [optional] # noqa: E501 - publish_permissions ([PublishPermissionsEnum]): Defines if this participant can publish audio or video.. [optional] # noqa: E501 - sessions ([str]): List of session ids this participant is associated with Capped to one Upon creation of a Participant, returns as an empty array.. [optional] # noqa: E501 - subscriptions (Subscriptions): [optional] # noqa: E501 - tag (str): User defined tag to associate with the participant.. [optional] # noqa: E501 - device_api_version (DeviceApiVersionEnum): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/bandwidth/model/participant_subscription.py b/bandwidth/model/participant_subscription.py deleted file mode 100644 index 3de068ed..00000000 --- a/bandwidth/model/participant_subscription.py +++ /dev/null @@ -1,276 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from bandwidth.exceptions import ApiAttributeError - - - -class ParticipantSubscription(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - ('stream_aliases',): { - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'participant_id': (str,), # noqa: E501 - 'stream_aliases': ([str],), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'participant_id': 'participantId', # noqa: E501 - 'stream_aliases': 'streamAliases', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, participant_id, *args, **kwargs): # noqa: E501 - """ParticipantSubscription - a model defined in OpenAPI - - Args: - participant_id (str): The Participant the subscriber will be subscribed to - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream_aliases ([str]): (optional) An array of specific streamAliases owned by the Participant that the subscriber will be subscribed to. Background: A streamAlias is created by a WebRTC client when it connects and declares a name for the related stream. The client is responsible for informing the application of any created streamAliases to enable the application to subscribe to specific streamAliases. Subscribing to a `streamAlias` that does not exist is undefined. If the array is empty all aliases are assumed.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', True) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.participant_id = participant_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, participant_id, *args, **kwargs): # noqa: E501 - """ParticipantSubscription - a model defined in OpenAPI - - Args: - participant_id (str): The Participant the subscriber will be subscribed to - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream_aliases ([str]): (optional) An array of specific streamAliases owned by the Participant that the subscriber will be subscribed to. Background: A streamAlias is created by a WebRTC client when it connects and declares a name for the related stream. The client is responsible for informing the application of any created streamAliases to enable the application to subscribe to specific streamAliases. Subscribing to a `streamAlias` that does not exist is undefined. If the array is empty all aliases are assumed.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.participant_id = participant_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/bandwidth/model/publish_permissions_enum.py b/bandwidth/model/publish_permissions_enum.py deleted file mode 100644 index 45b9b6f2..00000000 --- a/bandwidth/model/publish_permissions_enum.py +++ /dev/null @@ -1,291 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from bandwidth.exceptions import ApiAttributeError - - - -class PublishPermissionsEnum(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('value',): { - 'AUDIO': "AUDIO", - 'VIDEO': "VIDEO", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': (str,), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """PublishPermissionsEnum - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str):, must be one of ["AUDIO", "VIDEO", ] # noqa: E501 - - Keyword Args: - value (str):, must be one of ["AUDIO", "VIDEO", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """PublishPermissionsEnum - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str):, must be one of ["AUDIO", "VIDEO", ] # noqa: E501 - - Keyword Args: - value (str):, must be one of ["AUDIO", "VIDEO", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/bandwidth/model/request_error.py b/bandwidth/model/request_error.py deleted file mode 100644 index 0ead83dd..00000000 --- a/bandwidth/model/request_error.py +++ /dev/null @@ -1,268 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from bandwidth.exceptions import ApiAttributeError - - - -class RequestError(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'error': (str,), # noqa: E501 - 'request_id': (str,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'error': 'error', # noqa: E501 - 'request_id': 'requestId', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RequestError - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - error (str): A message describing the error with your request.. [optional] # noqa: E501 - request_id (str): The associated requestId from AWS.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', True) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RequestError - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - error (str): A message describing the error with your request.. [optional] # noqa: E501 - request_id (str): The associated requestId from AWS.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/bandwidth/model/session.py b/bandwidth/model/session.py deleted file mode 100644 index ffbf844c..00000000 --- a/bandwidth/model/session.py +++ /dev/null @@ -1,268 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from bandwidth.exceptions import ApiAttributeError - - - -class Session(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str,), # noqa: E501 - 'tag': (str,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'tag': 'tag', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Session - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Unique id of the session.. [optional] # noqa: E501 - tag (str): User defined tag to associate with the session.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', True) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Session - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Unique id of the session.. [optional] # noqa: E501 - tag (str): User defined tag to associate with the session.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/bandwidth/model/subscriptions.py b/bandwidth/model/subscriptions.py deleted file mode 100644 index 5939a0a8..00000000 --- a/bandwidth/model/subscriptions.py +++ /dev/null @@ -1,274 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from bandwidth.exceptions import ApiAttributeError - - -def lazy_import(): - from bandwidth.model.participant_subscription import ParticipantSubscription - globals()['ParticipantSubscription'] = ParticipantSubscription - - -class Subscriptions(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - lazy_import() - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - lazy_import() - return { - 'session_id': (str,), # noqa: E501 - 'participants': ([ParticipantSubscription],), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'session_id': 'sessionId', # noqa: E501 - 'participants': 'participants', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Subscriptions - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - session_id (str): If present, and not overridden by the array of participants, it represents the session the subscriptions are associated with. If this is the only field, the subscriber will be subscribed to all participants in the session (including any participants that are later added to the session). Upon creation of a Participant, returns as an empty object.. [optional] # noqa: E501 - participants ([ParticipantSubscription]): (optional) A list of participants in the session that will be subscribed to. If present and not empty or null, this will override any sessionId specified in the body. Returns empty if used during the creation of a Participant. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', True) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Subscriptions - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - session_id (str): If present, and not overridden by the array of participants, it represents the session the subscriptions are associated with. If this is the only field, the subscriber will be subscribed to all participants in the session (including any participants that are later added to the session). Upon creation of a Participant, returns as an empty object.. [optional] # noqa: E501 - participants ([ParticipantSubscription]): (optional) A list of participants in the session that will be subscribed to. If present and not empty or null, this will override any sessionId specified in the body. Returns empty if used during the creation of a Participant. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/bandwidth/model/unauthorized_request.py b/bandwidth/model/unauthorized_request.py deleted file mode 100644 index 27a91f25..00000000 --- a/bandwidth/model/unauthorized_request.py +++ /dev/null @@ -1,264 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from bandwidth.exceptions import ApiAttributeError - - - -class UnauthorizedRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message': 'message', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UnauthorizedRequest - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (str): Unauthorized. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', True) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UnauthorizedRequest - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (str): Unauthorized. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - for arg in args: - if isinstance(arg, dict): - kwargs.update(arg) - else: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/bandwidth/models/__init__.py b/bandwidth/models/__init__.py index 14bed288..c2d49faf 100644 --- a/bandwidth/models/__init__.py +++ b/bandwidth/models/__init__.py @@ -33,16 +33,12 @@ from bandwidth.model.create_call_response import CreateCallResponse from bandwidth.model.create_lookup_response import CreateLookupResponse from bandwidth.model.create_message_request_error import CreateMessageRequestError -from bandwidth.model.create_participant_request import CreateParticipantRequest -from bandwidth.model.create_participant_response import CreateParticipantResponse from bandwidth.model.deferred_result import DeferredResult -from bandwidth.model.device_api_version_enum import DeviceApiVersionEnum from bandwidth.model.disconenct_callback import DisconenctCallback from bandwidth.model.diversion import Diversion from bandwidth.model.dtmf_callback import DtmfCallback from bandwidth.model.field_error import FieldError from bandwidth.model.file_format_enum import FileFormatEnum -from bandwidth.model.forbidden_request import ForbiddenRequest from bandwidth.model.gather_callback import GatherCallback from bandwidth.model.initiate_callback import InitiateCallback from bandwidth.model.list_message_direction_enum import ListMessageDirectionEnum @@ -67,19 +63,13 @@ from bandwidth.model.mfa_request_error import MfaRequestError from bandwidth.model.mfa_unauthorized_request_error import MfaUnauthorizedRequestError from bandwidth.model.page_info import PageInfo -from bandwidth.model.participant import Participant -from bandwidth.model.participant_subscription import ParticipantSubscription from bandwidth.model.priority_enum import PriorityEnum -from bandwidth.model.publish_permissions_enum import PublishPermissionsEnum from bandwidth.model.recording_available_callback import RecordingAvailableCallback from bandwidth.model.recording_complete_callback import RecordingCompleteCallback from bandwidth.model.recording_state_enum import RecordingStateEnum from bandwidth.model.redirect_callback import RedirectCallback from bandwidth.model.redirect_method_enum import RedirectMethodEnum -from bandwidth.model.request_error import RequestError -from bandwidth.model.session import Session from bandwidth.model.stir_shaken import StirShaken -from bandwidth.model.subscriptions import Subscriptions from bandwidth.model.tag import Tag from bandwidth.model.tn_lookup_request_error import TnLookupRequestError from bandwidth.model.transcribe_recording import TranscribeRecording @@ -90,7 +80,6 @@ from bandwidth.model.transfer_answer_callback import TransferAnswerCallback from bandwidth.model.transfer_complete_callback import TransferCompleteCallback from bandwidth.model.transfer_disconnect_callback import TransferDisconnectCallback -from bandwidth.model.unauthorized_request import UnauthorizedRequest from bandwidth.model.update_call import UpdateCall from bandwidth.model.update_call_recording import UpdateCallRecording from bandwidth.model.update_conference import UpdateConference diff --git a/docs/CreateParticipantRequest.md b/docs/CreateParticipantRequest.md deleted file mode 100644 index 98c1c01d..00000000 --- a/docs/CreateParticipantRequest.md +++ /dev/null @@ -1,16 +0,0 @@ -# CreateParticipantRequest - -Create a participant request. - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**callback_url** | **str, none_type** | Full callback url to use for notifications about this participant. | [optional] -**publish_permissions** | [**[PublishPermissionsEnum]**](PublishPermissionsEnum.md) | Defines if this participant can publish audio or video. | [optional] -**tag** | **str** | User defined tag to associate with the participant. | [optional] -**device_api_version** | [**DeviceApiVersionEnum**](DeviceApiVersionEnum.md) | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/CreateParticipantResponse.md b/docs/CreateParticipantResponse.md deleted file mode 100644 index db29d849..00000000 --- a/docs/CreateParticipantResponse.md +++ /dev/null @@ -1,14 +0,0 @@ -# CreateParticipantResponse - -Response generated when a Participant is created. - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**participant** | [**Participant**](Participant.md) | | [optional] -**token** | **str** | Auth token for the returned participant. This should be passed to the participant so that they can connect to the platform. | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/DeviceApiVersionEnum.md b/docs/DeviceApiVersionEnum.md deleted file mode 100644 index 81c4367d..00000000 --- a/docs/DeviceApiVersionEnum.md +++ /dev/null @@ -1,12 +0,0 @@ -# DeviceApiVersionEnum - -Optional field to define the device api version of this participant. - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**value** | **str** | Optional field to define the device api version of this participant. | defaults to "V3", must be one of ["V3", ] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/ForbiddenRequest.md b/docs/ForbiddenRequest.md deleted file mode 100644 index f8b3eecd..00000000 --- a/docs/ForbiddenRequest.md +++ /dev/null @@ -1,12 +0,0 @@ -# ForbiddenRequest - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**message** | **str** | The message containing the reason behind the request being forbidden. | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/Participant.md b/docs/Participant.md deleted file mode 100644 index e032b83c..00000000 --- a/docs/Participant.md +++ /dev/null @@ -1,19 +0,0 @@ -# Participant - -Participant object. - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | Unique id of the participant. | [optional] [readonly] -**callback_url** | **str, none_type** | Full callback url to use for notifications about this participant. | [optional] -**publish_permissions** | [**[PublishPermissionsEnum]**](PublishPermissionsEnum.md) | Defines if this participant can publish audio or video. | [optional] -**sessions** | **[str]** | List of session ids this participant is associated with Capped to one Upon creation of a Participant, returns as an empty array. | [optional] [readonly] -**subscriptions** | [**Subscriptions**](Subscriptions.md) | | [optional] -**tag** | **str** | User defined tag to associate with the participant. | [optional] -**device_api_version** | [**DeviceApiVersionEnum**](DeviceApiVersionEnum.md) | | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/ParticipantSubscription.md b/docs/ParticipantSubscription.md deleted file mode 100644 index 5dcb64c1..00000000 --- a/docs/ParticipantSubscription.md +++ /dev/null @@ -1,13 +0,0 @@ -# ParticipantSubscription - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**participant_id** | **str** | The Participant the subscriber will be subscribed to | -**stream_aliases** | **[str]** | (optional) An array of specific streamAliases owned by the Participant that the subscriber will be subscribed to. Background: A streamAlias is created by a WebRTC client when it connects and declares a name for the related stream. The client is responsible for informing the application of any created streamAliases to enable the application to subscribe to specific streamAliases. Subscribing to a `streamAlias` that does not exist is undefined. If the array is empty all aliases are assumed. | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/ParticipantsApi.md b/docs/ParticipantsApi.md deleted file mode 100644 index 437bd9c8..00000000 --- a/docs/ParticipantsApi.md +++ /dev/null @@ -1,289 +0,0 @@ -# bandwidth.ParticipantsApi - -All URIs are relative to *http://localhost* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**create_participant**](ParticipantsApi.md#create_participant) | **POST** /accounts/{accountId}/participants | Create Participant -[**delete_participant**](ParticipantsApi.md#delete_participant) | **DELETE** /accounts/{accountId}/participants/{participantId} | Delete Participant -[**get_participant**](ParticipantsApi.md#get_participant) | **GET** /accounts/{accountId}/participants/{participantId} | Get Participant - - -# **create_participant** -> CreateParticipantResponse create_participant(account_id) - -Create Participant - -Create a new participant under this account. Participants are idempotent, so relevant parameters must be set in this function if desired. - -### Example - -* Basic Authentication (Basic): - -```python -import time -import bandwidth -from bandwidth.api import participants_api -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest -from bandwidth.model.create_participant_request import CreateParticipantRequest -from bandwidth.model.forbidden_request import ForbiddenRequest -from bandwidth.model.create_participant_response import CreateParticipantResponse -from pprint import pprint -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = bandwidth.Configuration( - host = "http://localhost" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: Basic -configuration = bandwidth.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Enter a context with an instance of the API client -with bandwidth.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = participants_api.ParticipantsApi(api_client) - account_id = "9900000" # str | Account ID - create_participant_request = CreateParticipantRequest( - callback_url="https://example.com/callback", - publish_permissions=[ - PublishPermissionsEnum("["VIDEO","AUDIO"]"), - ], - tag="participant1", - device_api_version=DeviceApiVersionEnum("V3"), - ) # CreateParticipantRequest | Create participant request body. (optional) - - # example passing only required values which don't have defaults set - try: - # Create Participant - api_response = api_instance.create_participant(account_id) - pprint(api_response) - except bandwidth.ApiException as e: - print("Exception when calling ParticipantsApi->create_participant: %s\n" % e) - - # example passing only required values which don't have defaults set - # and optional values - try: - # Create Participant - api_response = api_instance.create_participant(account_id, create_participant_request=create_participant_request) - pprint(api_response) - except bandwidth.ApiException as e: - print("Exception when calling ParticipantsApi->create_participant: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Account ID | - **create_participant_request** | [**CreateParticipantRequest**](CreateParticipantRequest.md)| Create participant request body. | [optional] - -### Return type - -[**CreateParticipantResponse**](CreateParticipantResponse.md) - -### Authorization - -[Basic](../README.md#Basic) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**500** | Internal Server Error | - | - -[[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) - -# **delete_participant** -> delete_participant(account_id, participant_id) - -Delete Participant - -Delete participant by ID. - -### Example - -* Basic Authentication (Basic): - -```python -import time -import bandwidth -from bandwidth.api import participants_api -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest -from bandwidth.model.forbidden_request import ForbiddenRequest -from pprint import pprint -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = bandwidth.Configuration( - host = "http://localhost" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: Basic -configuration = bandwidth.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Enter a context with an instance of the API client -with bandwidth.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = participants_api.ParticipantsApi(api_client) - account_id = "9900000" # str | Account ID - participant_id = "62e0ecb9-0b1b-5115-aae4-4f36123d6bb1" # str | Participant ID - - # example passing only required values which don't have defaults set - try: - # Delete Participant - api_instance.delete_participant(account_id, participant_id) - except bandwidth.ApiException as e: - print("Exception when calling ParticipantsApi->delete_participant: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Account ID | - **participant_id** | **str**| Participant ID | - -### Return type - -void (empty response body) - -### Authorization - -[Basic](../README.md#Basic) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**204** | No Content | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**500** | Internal Server Error | - | - -[[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) - -# **get_participant** -> Participant get_participant(account_id, participant_id) - -Get Participant - -Get participant by ID. - -### Example - -* Basic Authentication (Basic): - -```python -import time -import bandwidth -from bandwidth.api import participants_api -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest -from bandwidth.model.participant import Participant -from bandwidth.model.forbidden_request import ForbiddenRequest -from pprint import pprint -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = bandwidth.Configuration( - host = "http://localhost" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: Basic -configuration = bandwidth.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Enter a context with an instance of the API client -with bandwidth.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = participants_api.ParticipantsApi(api_client) - account_id = "9900000" # str | Account ID - participant_id = "62e0ecb9-0b1b-5115-aae4-4f36123d6bb1" # str | Participant ID - - # example passing only required values which don't have defaults set - try: - # Get Participant - api_response = api_instance.get_participant(account_id, participant_id) - pprint(api_response) - except bandwidth.ApiException as e: - print("Exception when calling ParticipantsApi->get_participant: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Account ID | - **participant_id** | **str**| Participant ID | - -### Return type - -[**Participant**](Participant.md) - -### Authorization - -[Basic](../README.md#Basic) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**500** | Internal Server Error | - | - -[[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/Session.md b/docs/Session.md deleted file mode 100644 index 0c55512b..00000000 --- a/docs/Session.md +++ /dev/null @@ -1,14 +0,0 @@ -# Session - -Session object. - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **str** | Unique id of the session. | [optional] -**tag** | **str** | User defined tag to associate with the session. | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/SessionsApi.md b/docs/SessionsApi.md deleted file mode 100644 index 9a685ed4..00000000 --- a/docs/SessionsApi.md +++ /dev/null @@ -1,772 +0,0 @@ -# bandwidth.SessionsApi - -All URIs are relative to *http://localhost* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**add_participant_to_session**](SessionsApi.md#add_participant_to_session) | **PUT** /accounts/{accountId}/sessions/{sessionId}/participants/{participantId} | Add Participant to Session -[**create_session**](SessionsApi.md#create_session) | **POST** /accounts/{accountId}/sessions | Create Session -[**delete_session**](SessionsApi.md#delete_session) | **DELETE** /accounts/{accountId}/sessions/{sessionId} | Delete Session -[**get_participant_subscriptions**](SessionsApi.md#get_participant_subscriptions) | **GET** /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions | Get Participant Subscriptions -[**get_session**](SessionsApi.md#get_session) | **GET** /accounts/{accountId}/sessions/{sessionId} | Get Session -[**list_session_participants**](SessionsApi.md#list_session_participants) | **GET** /accounts/{accountId}/sessions/{sessionId}/participants | List Participants in Session -[**remove_participant_from_session**](SessionsApi.md#remove_participant_from_session) | **DELETE** /accounts/{accountId}/sessions/{sessionId}/participants/{participantId} | Remove Participant from Session -[**update_participant_subscriptions**](SessionsApi.md#update_participant_subscriptions) | **PUT** /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions | Update Participant Subscriptions - - -# **add_participant_to_session** -> add_participant_to_session(account_id, session_id, participant_id) - -Add Participant to Session - -Add a participant to a session. Subscriptions can optionally be provided as part of this call. - -### Example - -* Basic Authentication (Basic): - -```python -import time -import bandwidth -from bandwidth.api import sessions_api -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest -from bandwidth.model.forbidden_request import ForbiddenRequest -from bandwidth.model.subscriptions import Subscriptions -from pprint import pprint -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = bandwidth.Configuration( - host = "http://localhost" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: Basic -configuration = bandwidth.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Enter a context with an instance of the API client -with bandwidth.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = sessions_api.SessionsApi(api_client) - account_id = "9900000" # str | Account ID - session_id = "cb5054ee-a69b-41ac-9ab2-04d6370826b4" # str | Session ID - participant_id = "62e0ecb9-0b1b-5115-aae4-4f36123d6bb1" # str | Participant ID - subscriptions = Subscriptions( - session_id="d8886aad-b956-4e1b-b2f4-d7c9f8162772", - participants=[ - ParticipantSubscription( - participant_id="568749d5-04d5-483d-adf5-deac7dd3d521", - stream_aliases=["alias_1","alias_2"], - ), - ], - ) # Subscriptions | The Body describes an optional set of subscriptions to apply to the participant. Calling this endpoint with no/empty body will only add the participant to the session, and will not subscribe the Participant to any media. The request body for this endpoint is OPTIONAL and provided as a convenience to avoid additional calls to the Update Participant Subscriptions endpoint. --- If a body is provided it will result in direct control over what Participants are subscribed to. - if the participants Array is provided and not empty, that list of Participants will be subscribed To - if the participants Array is missing or empty, and the sessionId is provided, the participant will be subscribed to the session, including all subsequent changes to the membership of the session - if the sessionId and the participant Array are both missing or empty, no subscriptions will be created (optional) - - # example passing only required values which don't have defaults set - try: - # Add Participant to Session - api_instance.add_participant_to_session(account_id, session_id, participant_id) - except bandwidth.ApiException as e: - print("Exception when calling SessionsApi->add_participant_to_session: %s\n" % e) - - # example passing only required values which don't have defaults set - # and optional values - try: - # Add Participant to Session - api_instance.add_participant_to_session(account_id, session_id, participant_id, subscriptions=subscriptions) - except bandwidth.ApiException as e: - print("Exception when calling SessionsApi->add_participant_to_session: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Account ID | - **session_id** | **str**| Session ID | - **participant_id** | **str**| Participant ID | - **subscriptions** | [**Subscriptions**](Subscriptions.md)| The Body describes an optional set of subscriptions to apply to the participant. Calling this endpoint with no/empty body will only add the participant to the session, and will not subscribe the Participant to any media. The request body for this endpoint is OPTIONAL and provided as a convenience to avoid additional calls to the Update Participant Subscriptions endpoint. --- If a body is provided it will result in direct control over what Participants are subscribed to. - if the participants Array is provided and not empty, that list of Participants will be subscribed To - if the participants Array is missing or empty, and the sessionId is provided, the participant will be subscribed to the session, including all subsequent changes to the membership of the session - if the sessionId and the participant Array are both missing or empty, no subscriptions will be created | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[Basic](../README.md#Basic) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**204** | No Content | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**409** | Conflict | - | -**500** | Internal Server Error | - | - -[[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) - -# **create_session** -> Session create_session(account_id) - -Create Session - -Create a new session. Sessions are idempotent, so relevant parameters must be set in this function if desired. - -### Example - -* Basic Authentication (Basic): - -```python -import time -import bandwidth -from bandwidth.api import sessions_api -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest -from bandwidth.model.forbidden_request import ForbiddenRequest -from bandwidth.model.session import Session -from pprint import pprint -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = bandwidth.Configuration( - host = "http://localhost" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: Basic -configuration = bandwidth.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Enter a context with an instance of the API client -with bandwidth.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = sessions_api.SessionsApi(api_client) - account_id = "9900000" # str | Account ID - session = Session( - id="75c21163-e110-41bc-bd76-1bb428ec85d5", - tag="session1", - ) # Session | Create session request body. (optional) - - # example passing only required values which don't have defaults set - try: - # Create Session - api_response = api_instance.create_session(account_id) - pprint(api_response) - except bandwidth.ApiException as e: - print("Exception when calling SessionsApi->create_session: %s\n" % e) - - # example passing only required values which don't have defaults set - # and optional values - try: - # Create Session - api_response = api_instance.create_session(account_id, session=session) - pprint(api_response) - except bandwidth.ApiException as e: - print("Exception when calling SessionsApi->create_session: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Account ID | - **session** | [**Session**](Session.md)| Create session request body. | [optional] - -### Return type - -[**Session**](Session.md) - -### Authorization - -[Basic](../README.md#Basic) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**500** | Internal Server Error | - | - -[[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) - -# **delete_session** -> delete_session(account_id, session_id) - -Delete Session - -Delete session by ID. - -### Example - -* Basic Authentication (Basic): - -```python -import time -import bandwidth -from bandwidth.api import sessions_api -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest -from bandwidth.model.forbidden_request import ForbiddenRequest -from pprint import pprint -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = bandwidth.Configuration( - host = "http://localhost" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: Basic -configuration = bandwidth.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Enter a context with an instance of the API client -with bandwidth.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = sessions_api.SessionsApi(api_client) - account_id = "9900000" # str | Account ID - session_id = "cb5054ee-a69b-41ac-9ab2-04d6370826b4" # str | Session ID - - # example passing only required values which don't have defaults set - try: - # Delete Session - api_instance.delete_session(account_id, session_id) - except bandwidth.ApiException as e: - print("Exception when calling SessionsApi->delete_session: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Account ID | - **session_id** | **str**| Session ID | - -### Return type - -void (empty response body) - -### Authorization - -[Basic](../README.md#Basic) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**204** | No Content | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**500** | Internal Server Error | - | - -[[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) - -# **get_participant_subscriptions** -> Subscriptions get_participant_subscriptions(account_id, session_id, participant_id) - -Get Participant Subscriptions - -Get a participant's subscriptions. - -### Example - -* Basic Authentication (Basic): - -```python -import time -import bandwidth -from bandwidth.api import sessions_api -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest -from bandwidth.model.forbidden_request import ForbiddenRequest -from bandwidth.model.subscriptions import Subscriptions -from pprint import pprint -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = bandwidth.Configuration( - host = "http://localhost" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: Basic -configuration = bandwidth.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Enter a context with an instance of the API client -with bandwidth.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = sessions_api.SessionsApi(api_client) - account_id = "9900000" # str | Account ID - session_id = "cb5054ee-a69b-41ac-9ab2-04d6370826b4" # str | Session ID - participant_id = "62e0ecb9-0b1b-5115-aae4-4f36123d6bb1" # str | Participant ID - - # example passing only required values which don't have defaults set - try: - # Get Participant Subscriptions - api_response = api_instance.get_participant_subscriptions(account_id, session_id, participant_id) - pprint(api_response) - except bandwidth.ApiException as e: - print("Exception when calling SessionsApi->get_participant_subscriptions: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Account ID | - **session_id** | **str**| Session ID | - **participant_id** | **str**| Participant ID | - -### Return type - -[**Subscriptions**](Subscriptions.md) - -### Authorization - -[Basic](../README.md#Basic) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**204** | No Content | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**500** | Internal Server Error | - | - -[[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) - -# **get_session** -> Session get_session(account_id, session_id) - -Get Session - -Get session by ID. - -### Example - -* Basic Authentication (Basic): - -```python -import time -import bandwidth -from bandwidth.api import sessions_api -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest -from bandwidth.model.forbidden_request import ForbiddenRequest -from bandwidth.model.session import Session -from pprint import pprint -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = bandwidth.Configuration( - host = "http://localhost" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: Basic -configuration = bandwidth.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Enter a context with an instance of the API client -with bandwidth.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = sessions_api.SessionsApi(api_client) - account_id = "9900000" # str | Account ID - session_id = "cb5054ee-a69b-41ac-9ab2-04d6370826b4" # str | Session ID - - # example passing only required values which don't have defaults set - try: - # Get Session - api_response = api_instance.get_session(account_id, session_id) - pprint(api_response) - except bandwidth.ApiException as e: - print("Exception when calling SessionsApi->get_session: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Account ID | - **session_id** | **str**| Session ID | - -### Return type - -[**Session**](Session.md) - -### Authorization - -[Basic](../README.md#Basic) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**500** | Internal Server Error | - | - -[[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) - -# **list_session_participants** -> [Participant] list_session_participants(account_id, session_id) - -List Participants in Session - -List participants in a session. - -### Example - -* Basic Authentication (Basic): - -```python -import time -import bandwidth -from bandwidth.api import sessions_api -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest -from bandwidth.model.participant import Participant -from bandwidth.model.forbidden_request import ForbiddenRequest -from pprint import pprint -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = bandwidth.Configuration( - host = "http://localhost" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: Basic -configuration = bandwidth.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Enter a context with an instance of the API client -with bandwidth.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = sessions_api.SessionsApi(api_client) - account_id = "9900000" # str | Account ID - session_id = "cb5054ee-a69b-41ac-9ab2-04d6370826b4" # str | Session ID - - # example passing only required values which don't have defaults set - try: - # List Participants in Session - api_response = api_instance.list_session_participants(account_id, session_id) - pprint(api_response) - except bandwidth.ApiException as e: - print("Exception when calling SessionsApi->list_session_participants: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Account ID | - **session_id** | **str**| Session ID | - -### Return type - -[**[Participant]**](Participant.md) - -### Authorization - -[Basic](../README.md#Basic) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**204** | No Content | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**500** | Internal Server Error | - | - -[[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) - -# **remove_participant_from_session** -> remove_participant_from_session(account_id, session_id, participant_id) - -Remove Participant from Session - -Remove a participant from a session. This will automatically remove any subscriptions the participant has associated with this session. - -### Example - -* Basic Authentication (Basic): - -```python -import time -import bandwidth -from bandwidth.api import sessions_api -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest -from bandwidth.model.forbidden_request import ForbiddenRequest -from pprint import pprint -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = bandwidth.Configuration( - host = "http://localhost" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: Basic -configuration = bandwidth.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Enter a context with an instance of the API client -with bandwidth.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = sessions_api.SessionsApi(api_client) - account_id = "9900000" # str | Account ID - session_id = "cb5054ee-a69b-41ac-9ab2-04d6370826b4" # str | Session ID - participant_id = "62e0ecb9-0b1b-5115-aae4-4f36123d6bb1" # str | Participant ID - - # example passing only required values which don't have defaults set - try: - # Remove Participant from Session - api_instance.remove_participant_from_session(account_id, session_id, participant_id) - except bandwidth.ApiException as e: - print("Exception when calling SessionsApi->remove_participant_from_session: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Account ID | - **session_id** | **str**| Session ID | - **participant_id** | **str**| Participant ID | - -### Return type - -void (empty response body) - -### Authorization - -[Basic](../README.md#Basic) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**204** | No Content | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**500** | Internal Server Error | - | - -[[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) - -# **update_participant_subscriptions** -> update_participant_subscriptions(account_id, session_id, participant_id) - -Update Participant Subscriptions - -Update a participant's subscriptions. This is a full update that will replace the participant's subscriptions. It allows subscription to the entire Session, a subset list of Participants in that Session, or specific media streams on any of the listed Participants. First call `getParticipantSubscriptions` if you need the current subscriptions. Calling this API with no `Subscriptions` object to remove all subscriptions. - -### Example - -* Basic Authentication (Basic): - -```python -import time -import bandwidth -from bandwidth.api import sessions_api -from bandwidth.model.request_error import RequestError -from bandwidth.model.unauthorized_request import UnauthorizedRequest -from bandwidth.model.forbidden_request import ForbiddenRequest -from bandwidth.model.subscriptions import Subscriptions -from pprint import pprint -# Defining the host is optional and defaults to http://localhost -# See configuration.py for a list of all supported configuration parameters. -configuration = bandwidth.Configuration( - host = "http://localhost" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: Basic -configuration = bandwidth.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Enter a context with an instance of the API client -with bandwidth.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = sessions_api.SessionsApi(api_client) - account_id = "9900000" # str | Account ID - session_id = "cb5054ee-a69b-41ac-9ab2-04d6370826b4" # str | Session ID - participant_id = "62e0ecb9-0b1b-5115-aae4-4f36123d6bb1" # str | Participant ID - subscriptions = Subscriptions( - session_id="d8886aad-b956-4e1b-b2f4-d7c9f8162772", - participants=[ - ParticipantSubscription( - participant_id="568749d5-04d5-483d-adf5-deac7dd3d521", - stream_aliases=["alias_1","alias_2"], - ), - ], - ) # Subscriptions | The body describes the desired subscriptions for the Participant. --- If a body is provided it will result in direct control over what Participants are subscribed to. - if the participants Array is provided and not empty, that list of Participants will be subscribed To - if the participants Array is missing or empty, and the sessionId is provided, the participant will be subscribed to the session, including all subsequent changes to the membership of the session - if the sessionId and the participant Array are both missing or empty, no subscriptions will be created (optional) - - # example passing only required values which don't have defaults set - try: - # Update Participant Subscriptions - api_instance.update_participant_subscriptions(account_id, session_id, participant_id) - except bandwidth.ApiException as e: - print("Exception when calling SessionsApi->update_participant_subscriptions: %s\n" % e) - - # example passing only required values which don't have defaults set - # and optional values - try: - # Update Participant Subscriptions - api_instance.update_participant_subscriptions(account_id, session_id, participant_id, subscriptions=subscriptions) - except bandwidth.ApiException as e: - print("Exception when calling SessionsApi->update_participant_subscriptions: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Account ID | - **session_id** | **str**| Session ID | - **participant_id** | **str**| Participant ID | - **subscriptions** | [**Subscriptions**](Subscriptions.md)| The body describes the desired subscriptions for the Participant. --- If a body is provided it will result in direct control over what Participants are subscribed to. - if the participants Array is provided and not empty, that list of Participants will be subscribed To - if the participants Array is missing or empty, and the sessionId is provided, the participant will be subscribed to the session, including all subsequent changes to the membership of the session - if the sessionId and the participant Array are both missing or empty, no subscriptions will be created | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[Basic](../README.md#Basic) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**204** | No Content | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**500** | Internal Server Error | - | - -[[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/Subscriptions.md b/docs/Subscriptions.md deleted file mode 100644 index 95887631..00000000 --- a/docs/Subscriptions.md +++ /dev/null @@ -1,13 +0,0 @@ -# Subscriptions - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**session_id** | **str** | If present, and not overridden by the array of participants, it represents the session the subscriptions are associated with. If this is the only field, the subscriber will be subscribed to all participants in the session (including any participants that are later added to the session). Upon creation of a Participant, returns as an empty object. | [optional] -**participants** | [**[ParticipantSubscription]**](ParticipantSubscription.md) | (optional) A list of participants in the session that will be subscribed to. If present and not empty or null, this will override any sessionId specified in the body. Returns empty if used during the creation of a Participant. | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/UnauthorizedRequest.md b/docs/UnauthorizedRequest.md deleted file mode 100644 index 1c2bfe46..00000000 --- a/docs/UnauthorizedRequest.md +++ /dev/null @@ -1,12 +0,0 @@ -# UnauthorizedRequest - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**message** | **str** | Unauthorized | [optional] -**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/test/integration/test_webrtc_api.py b/test/integration/test_webrtc_api.py deleted file mode 100644 index 61367389..00000000 --- a/test/integration/test_webrtc_api.py +++ /dev/null @@ -1,258 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -from array import array -import unittest - -import bandwidth -from hamcrest import * -from bandwidth.api import participants_api, sessions_api -from bandwidth.exceptions import NotFoundException, UnauthorizedException -from bandwidth.model.create_participant_request import CreateParticipantRequest -from bandwidth.model.create_participant_response import CreateParticipantResponse -from bandwidth.model.publish_permissions_enum import PublishPermissionsEnum -from bandwidth.model.device_api_version_enum import DeviceApiVersionEnum -from bandwidth.model.participant import Participant -from bandwidth.model.session import Session -from bandwidth.model.subscriptions import Subscriptions -from bandwidth.model.participant_subscription import ParticipantSubscription -from test.utils.env_variables import * - - -class TestSessionsApi(unittest.TestCase): - """SessionsApi unit test stubs""" - - def setUp(self): - # API Client - configuration = bandwidth.Configuration( - username = BW_USERNAME, - password = BW_PASSWORD - ) - api_client = bandwidth.ApiClient(configuration) - self.sessions_api_instance = sessions_api.SessionsApi(api_client) - self.participants_api_instance = participants_api.ParticipantsApi(api_client) - self.account_id = BW_ACCOUNT_ID - - # Participant Properties - self.callback_url = 'https://example.com/callback' - self.publish_permissions = [ - PublishPermissionsEnum('AUDIO'), - PublishPermissionsEnum('VIDEO') - ] - self.participant_tag = 'python integration participant tag' - self.device_api_version = DeviceApiVersionEnum('V3') - self.participant_id = '' - - # Participant Request - self.create_participant_request = CreateParticipantRequest( - callback_url=self.callback_url, - publish_permissions=self.publish_permissions, - tag=self.participant_tag, - device_api_version=self.device_api_version - ) - - # Session Properties - self.session_tag = 'python integration session tag' - self.session_id = '' - - # Session Request - self.session = Session( - tag=self.session_tag - ) - - self.stream_aliases = ['python integration alias'] - - def create_participant(self): - """Test creating participant - """ - response = self.participants_api_instance.create_participant(self.account_id, create_participant_request=self.create_participant_request, _return_http_data_only=False) - - assert_that(response[1], equal_to(200)) - - assert_that(response[0], instance_of(CreateParticipantResponse)) - assert_that(response[0], has_properties( - 'participant', instance_of(Participant), - 'participant', has_properties( - 'device_api_version', self.device_api_version, - 'id', instance_of(str), - 'publish_permissions', contains_inanyorder( - PublishPermissionsEnum('AUDIO'), - PublishPermissionsEnum('VIDEO')), - 'tag', self.participant_tag - ), - 'token', instance_of(str) - )) - - self.participant_id = response[0].participant.id - - def delete_participant(self): - """Test deleting participant - """ - response = self.participants_api_instance.delete_participant(self.account_id, self.participant_id, _return_http_data_only=False) - - assert_that(response[1], equal_to(204)) - - def get_participant(self): - """Test getting participant - """ - response = self.participants_api_instance.get_participant(self.account_id, self.participant_id, _return_http_data_only=False) - - assert_that(response[1], equal_to(200)) - assert_that(response[0], instance_of(Participant)) - assert_that(response[0], has_properties( - 'device_api_version', self.device_api_version, - 'id', self.participant_id, - 'publish_permissions', contains_inanyorder( - PublishPermissionsEnum('AUDIO'), - PublishPermissionsEnum('VIDEO')), - 'sessions', [self.session_id], - 'subscriptions', has_properties( - 'participants', instance_of(list) - ), - 'tag', self.participant_tag - )) - - def add_participant_to_session(self): - """Test adding participant to session - """ - response = self.sessions_api_instance.add_participant_to_session(self.account_id, self.session_id, self.participant_id, _return_http_data_only=False) - - assert_that(response[1], equal_to(204)) - - - def create_session(self): - """Test creating session - """ - response = self.sessions_api_instance.create_session(self.account_id, session=self.session, _return_http_data_only=False) - - assert_that(response[1], equal_to(200)) - - assert_that(response[0], instance_of(Session)) - assert_that(response[0], has_properties( - 'id', instance_of(str), - 'tag', self.session_tag, - 'participant_ids', instance_of(array), - 'participant_ids', empty() - )) - - self.session_id = response[0].id - - def delete_session(self): - """Test deleting session - """ - response = self.sessions_api_instance.delete_session(self.account_id, self.session_id, _return_http_data_only=False) - - assert_that(response[1], equal_to(204)) - - def get_participant_subscriptions(self): - """Test getting participant subscriptions - """ - response = self.sessions_api_instance.get_participant_subscriptions(self.account_id, self.session_id, self.participant_id, _return_http_data_only=False) - - assert_that(response[1], equal_to(200)) - - assert_that(response[0], has_properties( - 'participants', instance_of(list), - 'session_id', self.session_id - )) - assert_that(response[0].participants[0], instance_of(ParticipantSubscription)) - assert_that(response[0].participants[0], has_properties( - 'participant_id', self.participant_id, - 'stream_aliases', self.stream_aliases - )) - - def get_session(self): - """Test getting session - """ - response = self.sessions_api_instance.get_session(self.account_id, self.session_id, _return_http_data_only=False) - - assert_that(response[1], equal_to(200)) - - assert_that(response[0], has_properties( - 'id', self.session_id, - 'tag', self.session_tag, - 'participant_ids', contains_exactly(self.participant_id) - )) - - def list_session_participants(self): - """Test listing session participants - """ - response = self.sessions_api_instance.list_session_participants(self.account_id, self.session_id, _return_http_data_only=False) - - assert_that(response[1], equal_to(200)) - - assert_that(response[0], instance_of(list)) - assert_that(response[0][0], instance_of(Participant)) - assert_that(response[0][0], has_properties( - 'device_api_version', self.device_api_version, - 'id', self.participant_id, - 'publish_permissions', contains_inanyorder( - PublishPermissionsEnum('AUDIO'), - PublishPermissionsEnum('VIDEO')), - 'sessions', [self.session_id], - 'tag', self.participant_tag - )) - - def remove_participant_from_session(self): - """Test removing participant from session - """ - response = self.sessions_api_instance.remove_participant_from_session(self.account_id, self.session_id, self.participant_id, _return_http_data_only=False) - - assert_that(response[1], equal_to(204)) - - def update_participant_subscriptions(self): - """Test updating participant subscriptions - """ - subscriptions = Subscriptions( - session_id=self.session_id, - participants=[ - ParticipantSubscription( - participant_id=self.participant_id, - stream_aliases=self.stream_aliases, - ) - ], - ) - - response = self.sessions_api_instance.update_participant_subscriptions(self.account_id, self.session_id, self.participant_id, subscriptions=subscriptions, _return_http_data_only=False) - - assert_that(response[1], equal_to(204)) - - def get_participant_unauthorized(self): - """Test getting participant with unauthorized API client - """ - unauthorized_api_client = bandwidth.ApiClient() - unauthorized_participants_api_instance = participants_api.ParticipantsApi(unauthorized_api_client) - - assert_that(calling(unauthorized_participants_api_instance.get_participant).with_args( - self.account_id, self.participant_id, _return_http_data_only=False)), raises(UnauthorizedException) - - def get_participant_not_found(self): - """Test getting nonexistent participant - """ - assert_that(calling(self.participants_api_instance.get_participant).with_args( - self.account_id, self.participant_id)), raises(NotFoundException) - - def _steps(self) -> None: - call_order = ['create_participant', 'create_session', 'add_participant_to_session', - 'get_session', 'list_session_participants', 'update_participant_subscriptions', - 'get_participant_subscriptions', 'get_participant', 'remove_participant_from_session', - 'delete_session', 'delete_participant', 'get_participant_unauthorized', 'get_participant_not_found'] - for name in call_order: - yield name, getattr(self, name) - - def test_steps(self) -> None: - """Test each function from _steps.call_order in specified order - """ - for name, step in self._steps(): - step() - -if __name__ == '__main__': - unittest.main() From f1da6d7fd6fca60c422d486d0cba82bde7f4efc7 Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Fri, 14 Oct 2022 11:14:02 -0400 Subject: [PATCH 02/10] Remove WebRTC Unit Tests & Utilities --- bandwidth/utilities/init.py | 0 bandwidth/utilities/web_rtc.py | 54 ------------ test/unit/test_create_participant_request.py | 40 --------- test/unit/test_create_participant_response.py | 38 --------- test/unit/test_device_api_version_enum.py | 36 -------- test/unit/test_forbidden_request.py | 36 -------- test/unit/test_participant.py | 42 --------- test/unit/test_participant_subscription.py | 36 -------- test/unit/test_participants_api.py | 50 ----------- test/unit/test_publish_permissions_enum.py | 36 -------- test/unit/test_session.py | 36 -------- test/unit/test_sessions_api.py | 85 ------------------- test/unit/test_unauthorized_request.py | 36 -------- test/unit/test_webrtc_utilities.py | 19 ----- 14 files changed, 544 deletions(-) delete mode 100644 bandwidth/utilities/init.py delete mode 100644 bandwidth/utilities/web_rtc.py delete mode 100644 test/unit/test_create_participant_request.py delete mode 100644 test/unit/test_create_participant_response.py delete mode 100644 test/unit/test_device_api_version_enum.py delete mode 100644 test/unit/test_forbidden_request.py delete mode 100644 test/unit/test_participant.py delete mode 100644 test/unit/test_participant_subscription.py delete mode 100644 test/unit/test_participants_api.py delete mode 100644 test/unit/test_publish_permissions_enum.py delete mode 100644 test/unit/test_session.py delete mode 100644 test/unit/test_sessions_api.py delete mode 100644 test/unit/test_unauthorized_request.py delete mode 100644 test/unit/test_webrtc_utilities.py diff --git a/bandwidth/utilities/init.py b/bandwidth/utilities/init.py deleted file mode 100644 index e69de29b..00000000 diff --git a/bandwidth/utilities/web_rtc.py b/bandwidth/utilities/web_rtc.py deleted file mode 100644 index 9943f3e0..00000000 --- a/bandwidth/utilities/web_rtc.py +++ /dev/null @@ -1,54 +0,0 @@ -from bandwidth.model.bxml.response import Response -from bandwidth.model.bxml.verbs import * - - -def _generate_transfer_model(device_token: str, voice_call_id: str, sip_uri: str = 'sip:sipx.webrtc.bandwidth.com:5060') -> Transfer: - """Generate a Transfer object for a WebRTC Session - - Args: - device_token (str): The device token. - voice_call_id (str): The Bandwidth voice Call ID. - sip_uri (str, optional): The SIP URI to transfer the call to. Defaults to 'sip:sipx.webrtc.bandwidth.com:5060'. - - Returns: - Transfer: Returns a Transfer BXML Verb Object - """ - uui = "".join(voice_call_id.split("-")[1::]) - sip_uri = SipUri( - uri=sip_uri, - uui=f"{uui};encoding=base64,{device_token};encoding=jwt" - ) - transfer = Transfer( - transfer_to=[sip_uri] - ) - return transfer - - -def generate_transfer_bxml_verb(device_token: str, voice_call_id: str, sip_uri: str = 'sip:sipx.webrtc.bandwidth.com:5060') -> str: - """Returns the Transfer verb to perform the SIP transfer without the Response wrapper - - Args: - device_token (str): The device token. - voice_call_id (str): The Bandwidth voice Call ID. - sip_uri (str, optional): The SIP URI to transfer the call to. Defaults to 'sip:sipx.webrtc.bandwidth.com:5060'. - - Returns: - str: BXML Verb - """ - return _generate_transfer_model(device_token, voice_call_id, sip_uri).to_bxml() - - -def generate_transfer_bxml(device_token: str, voice_call_id: str, sip_uri: str = 'sip:sipx.webrtc.bandwidth.com:5060') -> str: - """Generate BXML document with WebRTC a device token to perform a SIP transfer - - Args: - device_token (str): The device token. - voice_call_id (str): The Bandwidth voice Call ID. - sip_uri (str, optional): The SIP URI to transfer the call to. Defaults to 'sip:sipx.webrtc.bandwidth.com:5060'. - - Returns: - str: BXML document with transfer BXML - """ - response = Response() - response.add_verb(_generate_transfer_model(device_token, voice_call_id, sip_uri)) - return response.to_bxml() diff --git a/test/unit/test_create_participant_request.py b/test/unit/test_create_participant_request.py deleted file mode 100644 index 59495afb..00000000 --- a/test/unit/test_create_participant_request.py +++ /dev/null @@ -1,40 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import sys -import unittest - -import bandwidth -from bandwidth.model.device_api_version_enum import DeviceApiVersionEnum -from bandwidth.model.publish_permissions_enum import PublishPermissionsEnum -globals()['DeviceApiVersionEnum'] = DeviceApiVersionEnum -globals()['PublishPermissionsEnum'] = PublishPermissionsEnum -from bandwidth.model.create_participant_request import CreateParticipantRequest - - -class TestCreateParticipantRequest(unittest.TestCase): - """CreateParticipantRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testCreateParticipantRequest(self): - """Test CreateParticipantRequest""" - # FIXME: construct object with mandatory attributes with example values - # model = CreateParticipantRequest() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_create_participant_response.py b/test/unit/test_create_participant_response.py deleted file mode 100644 index 7b97e48c..00000000 --- a/test/unit/test_create_participant_response.py +++ /dev/null @@ -1,38 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import sys -import unittest - -import bandwidth -from bandwidth.model.participant import Participant -globals()['Participant'] = Participant -from bandwidth.model.create_participant_response import CreateParticipantResponse - - -class TestCreateParticipantResponse(unittest.TestCase): - """CreateParticipantResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testCreateParticipantResponse(self): - """Test CreateParticipantResponse""" - # FIXME: construct object with mandatory attributes with example values - # model = CreateParticipantResponse() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_device_api_version_enum.py b/test/unit/test_device_api_version_enum.py deleted file mode 100644 index f5183e93..00000000 --- a/test/unit/test_device_api_version_enum.py +++ /dev/null @@ -1,36 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import sys -import unittest - -import bandwidth -from bandwidth.model.device_api_version_enum import DeviceApiVersionEnum - - -class TestDeviceApiVersionEnum(unittest.TestCase): - """DeviceApiVersionEnum unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testDeviceApiVersionEnum(self): - """Test DeviceApiVersionEnum""" - # FIXME: construct object with mandatory attributes with example values - # model = DeviceApiVersionEnum() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_forbidden_request.py b/test/unit/test_forbidden_request.py deleted file mode 100644 index 976e7213..00000000 --- a/test/unit/test_forbidden_request.py +++ /dev/null @@ -1,36 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import sys -import unittest - -import bandwidth -from bandwidth.model.forbidden_request import ForbiddenRequest - - -class TestForbiddenRequest(unittest.TestCase): - """ForbiddenRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testForbiddenRequest(self): - """Test ForbiddenRequest""" - # FIXME: construct object with mandatory attributes with example values - # model = ForbiddenRequest() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_participant.py b/test/unit/test_participant.py deleted file mode 100644 index d93243a8..00000000 --- a/test/unit/test_participant.py +++ /dev/null @@ -1,42 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import sys -import unittest - -import bandwidth -from bandwidth.model.device_api_version_enum import DeviceApiVersionEnum -from bandwidth.model.publish_permissions_enum import PublishPermissionsEnum -from bandwidth.model.subscriptions import Subscriptions -globals()['DeviceApiVersionEnum'] = DeviceApiVersionEnum -globals()['PublishPermissionsEnum'] = PublishPermissionsEnum -globals()['Subscriptions'] = Subscriptions -from bandwidth.model.participant import Participant - - -class TestParticipant(unittest.TestCase): - """Participant unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testParticipant(self): - """Test Participant""" - # FIXME: construct object with mandatory attributes with example values - # model = Participant() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_participant_subscription.py b/test/unit/test_participant_subscription.py deleted file mode 100644 index 4169d5ef..00000000 --- a/test/unit/test_participant_subscription.py +++ /dev/null @@ -1,36 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import sys -import unittest - -import bandwidth -from bandwidth.model.participant_subscription import ParticipantSubscription - - -class TestParticipantSubscription(unittest.TestCase): - """ParticipantSubscription unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testParticipantSubscription(self): - """Test ParticipantSubscription""" - # FIXME: construct object with mandatory attributes with example values - # model = ParticipantSubscription() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_participants_api.py b/test/unit/test_participants_api.py deleted file mode 100644 index 0e6febb6..00000000 --- a/test/unit/test_participants_api.py +++ /dev/null @@ -1,50 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import unittest - -import bandwidth -from bandwidth.api.participants_api import ParticipantsApi # noqa: E501 - - -class TestParticipantsApi(unittest.TestCase): - """ParticipantsApi unit test stubs""" - - def setUp(self): - self.api = ParticipantsApi() # noqa: E501 - - def tearDown(self): - pass - - def test_create_participant(self): - """Test case for create_participant - - Create Participant # noqa: E501 - """ - pass - - def test_delete_participant(self): - """Test case for delete_participant - - Delete Participant # noqa: E501 - """ - pass - - def test_get_participant(self): - """Test case for get_participant - - Get Participant # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_publish_permissions_enum.py b/test/unit/test_publish_permissions_enum.py deleted file mode 100644 index 030dfd8d..00000000 --- a/test/unit/test_publish_permissions_enum.py +++ /dev/null @@ -1,36 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import sys -import unittest - -import bandwidth -from bandwidth.model.publish_permissions_enum import PublishPermissionsEnum - - -class TestPublishPermissionsEnum(unittest.TestCase): - """PublishPermissionsEnum unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testPublishPermissionsEnum(self): - """Test PublishPermissionsEnum""" - # FIXME: construct object with mandatory attributes with example values - # model = PublishPermissionsEnum() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_session.py b/test/unit/test_session.py deleted file mode 100644 index 78b74b99..00000000 --- a/test/unit/test_session.py +++ /dev/null @@ -1,36 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import sys -import unittest - -import bandwidth -from bandwidth.model.session import Session - - -class TestSession(unittest.TestCase): - """Session unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testSession(self): - """Test Session""" - # FIXME: construct object with mandatory attributes with example values - # model = Session() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_sessions_api.py b/test/unit/test_sessions_api.py deleted file mode 100644 index df26e4a2..00000000 --- a/test/unit/test_sessions_api.py +++ /dev/null @@ -1,85 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import unittest - -import bandwidth -from bandwidth.api.sessions_api import SessionsApi # noqa: E501 - - -class TestSessionsApi(unittest.TestCase): - """SessionsApi unit test stubs""" - - def setUp(self): - self.api = SessionsApi() # noqa: E501 - - def tearDown(self): - pass - - def test_add_participant_to_session(self): - """Test case for add_participant_to_session - - Add Participant to Session # noqa: E501 - """ - pass - - def test_create_session(self): - """Test case for create_session - - Create Session # noqa: E501 - """ - pass - - def test_delete_session(self): - """Test case for delete_session - - Delete Session # noqa: E501 - """ - pass - - def test_get_participant_subscriptions(self): - """Test case for get_participant_subscriptions - - Get Participant Subscriptions # noqa: E501 - """ - pass - - def test_get_session(self): - """Test case for get_session - - Get Session # noqa: E501 - """ - pass - - def test_list_session_participants(self): - """Test case for list_session_participants - - List Participants in Session # noqa: E501 - """ - pass - - def test_remove_participant_from_session(self): - """Test case for remove_participant_from_session - - Remove Participant from Session # noqa: E501 - """ - pass - - def test_update_participant_subscriptions(self): - """Test case for update_participant_subscriptions - - Update Participant Subscriptions # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_unauthorized_request.py b/test/unit/test_unauthorized_request.py deleted file mode 100644 index 470e782f..00000000 --- a/test/unit/test_unauthorized_request.py +++ /dev/null @@ -1,36 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import sys -import unittest - -import bandwidth -from bandwidth.model.unauthorized_request import UnauthorizedRequest - - -class TestUnauthorizedRequest(unittest.TestCase): - """UnauthorizedRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testUnauthorizedRequest(self): - """Test UnauthorizedRequest""" - # FIXME: construct object with mandatory attributes with example values - # model = UnauthorizedRequest() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_webrtc_utilities.py b/test/unit/test_webrtc_utilities.py deleted file mode 100644 index 9bc536d7..00000000 --- a/test/unit/test_webrtc_utilities.py +++ /dev/null @@ -1,19 +0,0 @@ -from bandwidth.utilities.web_rtc import * - - -class TestWebRtcUtilities: - """ - Class for the WebRTC Utilities Tests - """ - - def test_generate_transfer_bxml(self): - expected = 'sip:sipx.webrtc.bandwidth.com:5060' - actual = generate_transfer_bxml_verb( - 'asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4') - assert actual == expected - - def test_generate_transfer_bxml_document(self): - expected = "\nsip:sipx.webrtc.bandwidth.com:5060" - actual = generate_transfer_bxml( - 'asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4') - assert actual == expected From 19baab83bff533641bf1dead2c281792b34f7936 Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Fri, 14 Oct 2022 11:19:01 -0400 Subject: [PATCH 03/10] Revert statistics api deletion remove sessions api remove tests --- bandwidth/api/sessions_api.py | 1287 ------------------------------- bandwidth/api/statistics_api.py | 170 ++++ test/unit/test_request_error.py | 36 - test/unit/test_subscriptions.py | 38 - 4 files changed, 170 insertions(+), 1361 deletions(-) delete mode 100644 bandwidth/api/sessions_api.py create mode 100644 bandwidth/api/statistics_api.py delete mode 100644 test/unit/test_request_error.py delete mode 100644 test/unit/test_subscriptions.py diff --git a/bandwidth/api/sessions_api.py b/bandwidth/api/sessions_api.py deleted file mode 100644 index 8d76e66e..00000000 --- a/bandwidth/api/sessions_api.py +++ /dev/null @@ -1,1287 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from bandwidth.api_client import ApiClient, Endpoint as _Endpoint -from bandwidth.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from bandwidth.model.forbidden_request import ForbiddenRequest -from bandwidth.model.participant import Participant -from bandwidth.model.request_error import RequestError -from bandwidth.model.session import Session -from bandwidth.model.subscriptions import Subscriptions -from bandwidth.model.unauthorized_request import UnauthorizedRequest - - -class SessionsApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - self.add_participant_to_session_endpoint = _Endpoint( - settings={ - 'response_type': None, - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}', - 'operation_id': 'add_participant_to_session', - 'http_method': 'PUT', - 'servers': [ - { - 'url': "https://api.webrtc.bandwidth.com/v1", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - 'session_id', - 'participant_id', - 'subscriptions', - ], - 'required': [ - 'account_id', - 'session_id', - 'participant_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - 'session_id': - (str,), - 'participant_id': - (str,), - 'subscriptions': - (Subscriptions,), - }, - 'attribute_map': { - 'account_id': 'accountId', - 'session_id': 'sessionId', - 'participant_id': 'participantId', - }, - 'location_map': { - 'account_id': 'path', - 'session_id': 'path', - 'participant_id': 'path', - 'subscriptions': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.create_session_endpoint = _Endpoint( - settings={ - 'response_type': (Session,), - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/sessions', - 'operation_id': 'create_session', - 'http_method': 'POST', - 'servers': [ - { - 'url': "https://api.webrtc.bandwidth.com/v1", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - 'session', - ], - 'required': [ - 'account_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - 'session': - (Session,), - }, - 'attribute_map': { - 'account_id': 'accountId', - }, - 'location_map': { - 'account_id': 'path', - 'session': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.delete_session_endpoint = _Endpoint( - settings={ - 'response_type': None, - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/sessions/{sessionId}', - 'operation_id': 'delete_session', - 'http_method': 'DELETE', - 'servers': [ - { - 'url': "https://api.webrtc.bandwidth.com/v1", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - 'session_id', - ], - 'required': [ - 'account_id', - 'session_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - 'session_id': - (str,), - }, - 'attribute_map': { - 'account_id': 'accountId', - 'session_id': 'sessionId', - }, - 'location_map': { - 'account_id': 'path', - 'session_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.get_participant_subscriptions_endpoint = _Endpoint( - settings={ - 'response_type': (Subscriptions,), - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions', - 'operation_id': 'get_participant_subscriptions', - 'http_method': 'GET', - 'servers': [ - { - 'url': "https://api.webrtc.bandwidth.com/v1", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - 'session_id', - 'participant_id', - ], - 'required': [ - 'account_id', - 'session_id', - 'participant_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - 'session_id': - (str,), - 'participant_id': - (str,), - }, - 'attribute_map': { - 'account_id': 'accountId', - 'session_id': 'sessionId', - 'participant_id': 'participantId', - }, - 'location_map': { - 'account_id': 'path', - 'session_id': 'path', - 'participant_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.get_session_endpoint = _Endpoint( - settings={ - 'response_type': (Session,), - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/sessions/{sessionId}', - 'operation_id': 'get_session', - 'http_method': 'GET', - 'servers': [ - { - 'url': "https://api.webrtc.bandwidth.com/v1", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - 'session_id', - ], - 'required': [ - 'account_id', - 'session_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - 'session_id': - (str,), - }, - 'attribute_map': { - 'account_id': 'accountId', - 'session_id': 'sessionId', - }, - 'location_map': { - 'account_id': 'path', - 'session_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.list_session_participants_endpoint = _Endpoint( - settings={ - 'response_type': ([Participant],), - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/sessions/{sessionId}/participants', - 'operation_id': 'list_session_participants', - 'http_method': 'GET', - 'servers': [ - { - 'url': "https://api.webrtc.bandwidth.com/v1", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - 'session_id', - ], - 'required': [ - 'account_id', - 'session_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - 'session_id': - (str,), - }, - 'attribute_map': { - 'account_id': 'accountId', - 'session_id': 'sessionId', - }, - 'location_map': { - 'account_id': 'path', - 'session_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.remove_participant_from_session_endpoint = _Endpoint( - settings={ - 'response_type': None, - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}', - 'operation_id': 'remove_participant_from_session', - 'http_method': 'DELETE', - 'servers': [ - { - 'url': "https://api.webrtc.bandwidth.com/v1", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - 'session_id', - 'participant_id', - ], - 'required': [ - 'account_id', - 'session_id', - 'participant_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - 'session_id': - (str,), - 'participant_id': - (str,), - }, - 'attribute_map': { - 'account_id': 'accountId', - 'session_id': 'sessionId', - 'participant_id': 'participantId', - }, - 'location_map': { - 'account_id': 'path', - 'session_id': 'path', - 'participant_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.update_participant_subscriptions_endpoint = _Endpoint( - settings={ - 'response_type': None, - 'auth': [ - 'Basic' - ], - 'endpoint_path': '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions', - 'operation_id': 'update_participant_subscriptions', - 'http_method': 'PUT', - 'servers': [ - { - 'url': "https://api.webrtc.bandwidth.com/v1", - 'description': "Production", - }, - ] - }, - params_map={ - 'all': [ - 'account_id', - 'session_id', - 'participant_id', - 'subscriptions', - ], - 'required': [ - 'account_id', - 'session_id', - 'participant_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'account_id': - (str,), - 'session_id': - (str,), - 'participant_id': - (str,), - 'subscriptions': - (Subscriptions,), - }, - 'attribute_map': { - 'account_id': 'accountId', - 'session_id': 'sessionId', - 'participant_id': 'participantId', - }, - 'location_map': { - 'account_id': 'path', - 'session_id': 'path', - 'participant_id': 'path', - 'subscriptions': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - - def add_participant_to_session( - self, - account_id, - session_id, - participant_id, - **kwargs - ): - """Add Participant to Session # noqa: E501 - - Add a participant to a session. Subscriptions can optionally be provided as part of this call. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.add_participant_to_session(account_id, session_id, participant_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Account ID - session_id (str): Session ID - participant_id (str): Participant ID - - Keyword Args: - subscriptions (Subscriptions): The Body describes an optional set of subscriptions to apply to the participant. Calling this endpoint with no/empty body will only add the participant to the session, and will not subscribe the Participant to any media. The request body for this endpoint is OPTIONAL and provided as a convenience to avoid additional calls to the Update Participant Subscriptions endpoint. --- If a body is provided it will result in direct control over what Participants are subscribed to. - if the participants Array is provided and not empty, that list of Participants will be subscribed To - if the participants Array is missing or empty, and the sessionId is provided, the participant will be subscribed to the session, including all subsequent changes to the membership of the session - if the sessionId and the participant Array are both missing or empty, no subscriptions will be created. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - kwargs['session_id'] = \ - session_id - kwargs['participant_id'] = \ - participant_id - return self.add_participant_to_session_endpoint.call_with_http_info(**kwargs) - - def create_session( - self, - account_id, - **kwargs - ): - """Create Session # noqa: E501 - - Create a new session. Sessions are idempotent, so relevant parameters must be set in this function if desired. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_session(account_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Account ID - - Keyword Args: - session (Session): Create session request body.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - Session - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - return self.create_session_endpoint.call_with_http_info(**kwargs) - - def delete_session( - self, - account_id, - session_id, - **kwargs - ): - """Delete Session # noqa: E501 - - Delete session by ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_session(account_id, session_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Account ID - session_id (str): Session ID - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - kwargs['session_id'] = \ - session_id - return self.delete_session_endpoint.call_with_http_info(**kwargs) - - def get_participant_subscriptions( - self, - account_id, - session_id, - participant_id, - **kwargs - ): - """Get Participant Subscriptions # noqa: E501 - - Get a participant's subscriptions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_participant_subscriptions(account_id, session_id, participant_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Account ID - session_id (str): Session ID - participant_id (str): Participant ID - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - Subscriptions - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - kwargs['session_id'] = \ - session_id - kwargs['participant_id'] = \ - participant_id - return self.get_participant_subscriptions_endpoint.call_with_http_info(**kwargs) - - def get_session( - self, - account_id, - session_id, - **kwargs - ): - """Get Session # noqa: E501 - - Get session by ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_session(account_id, session_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Account ID - session_id (str): Session ID - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - Session - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - kwargs['session_id'] = \ - session_id - return self.get_session_endpoint.call_with_http_info(**kwargs) - - def list_session_participants( - self, - account_id, - session_id, - **kwargs - ): - """List Participants in Session # noqa: E501 - - List participants in a session. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_session_participants(account_id, session_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Account ID - session_id (str): Session ID - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - [Participant] - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - kwargs['session_id'] = \ - session_id - return self.list_session_participants_endpoint.call_with_http_info(**kwargs) - - def remove_participant_from_session( - self, - account_id, - session_id, - participant_id, - **kwargs - ): - """Remove Participant from Session # noqa: E501 - - Remove a participant from a session. This will automatically remove any subscriptions the participant has associated with this session. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.remove_participant_from_session(account_id, session_id, participant_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Account ID - session_id (str): Session ID - participant_id (str): Participant ID - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - kwargs['session_id'] = \ - session_id - kwargs['participant_id'] = \ - participant_id - return self.remove_participant_from_session_endpoint.call_with_http_info(**kwargs) - - def update_participant_subscriptions( - self, - account_id, - session_id, - participant_id, - **kwargs - ): - """Update Participant Subscriptions # noqa: E501 - - Update a participant's subscriptions. This is a full update that will replace the participant's subscriptions. It allows subscription to the entire Session, a subset list of Participants in that Session, or specific media streams on any of the listed Participants. First call `getParticipantSubscriptions` if you need the current subscriptions. Calling this API with no `Subscriptions` object to remove all subscriptions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_participant_subscriptions(account_id, session_id, participant_id, async_req=True) - >>> result = thread.get() - - Args: - account_id (str): Account ID - session_id (str): Session ID - participant_id (str): Participant ID - - Keyword Args: - subscriptions (Subscriptions): The body describes the desired subscriptions for the Participant. --- If a body is provided it will result in direct control over what Participants are subscribed to. - if the participants Array is provided and not empty, that list of Participants will be subscribed To - if the participants Array is missing or empty, and the sessionId is provided, the participant will be subscribed to the session, including all subsequent changes to the membership of the session - if the sessionId and the participant Array are both missing or empty, no subscriptions will be created. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - _request_auths (list): set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - Default is None - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['_request_auths'] = kwargs.get('_request_auths', None) - kwargs['account_id'] = \ - account_id - kwargs['session_id'] = \ - session_id - kwargs['participant_id'] = \ - participant_id - return self.update_participant_subscriptions_endpoint.call_with_http_info(**kwargs) - diff --git a/bandwidth/api/statistics_api.py b/bandwidth/api/statistics_api.py new file mode 100644 index 00000000..e6bab392 --- /dev/null +++ b/bandwidth/api/statistics_api.py @@ -0,0 +1,170 @@ +""" + Bandwidth + Bandwidth's Communication APIs # noqa: E501 + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from bandwidth.api_client import ApiClient, Endpoint as _Endpoint +from bandwidth.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from bandwidth.model.account_statistics import AccountStatistics +from bandwidth.model.voice_api_error import VoiceApiError + + +class StatisticsApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + self.get_statistics_endpoint = _Endpoint( + settings={ + 'response_type': (AccountStatistics,), + 'auth': [ + 'Basic' + ], + 'endpoint_path': '/accounts/{accountId}/statistics', + 'operation_id': 'get_statistics', + 'http_method': 'GET', + 'servers': [ + { + 'url': "https://voice.bandwidth.com/api/v2", + 'description': "Production", + }, + ] + }, + params_map={ + 'all': [ + 'account_id', + ], + 'required': [ + 'account_id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'account_id': + (str,), + }, + 'attribute_map': { + 'account_id': 'accountId', + }, + 'location_map': { + 'account_id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client + ) + + def get_statistics( + self, + account_id, + **kwargs + ): + """Get Account Statistics # noqa: E501 + Returns details about the current state of the account. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_statistics(account_id, async_req=True) + >>> result = thread.get() + Args: + account_id (str): Your Bandwidth Account ID + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _content_type (str/None): force body content-type. + Default is None and content-type will be predicted by allowed + content-types and body. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None + async_req (bool): execute request asynchronously + Returns: + AccountStatistics + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_spec_property_naming'] = kwargs.get( + '_spec_property_naming', False + ) + kwargs['_content_type'] = kwargs.get( + '_content_type') + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) + kwargs['account_id'] = \ + account_id + return self.get_statistics_endpoint.call_with_http_info(**kwargs) diff --git a/test/unit/test_request_error.py b/test/unit/test_request_error.py deleted file mode 100644 index 6004a7da..00000000 --- a/test/unit/test_request_error.py +++ /dev/null @@ -1,36 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import sys -import unittest - -import bandwidth -from bandwidth.model.request_error import RequestError - - -class TestRequestError(unittest.TestCase): - """RequestError unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testRequestError(self): - """Test RequestError""" - # FIXME: construct object with mandatory attributes with example values - # model = RequestError() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/test_subscriptions.py b/test/unit/test_subscriptions.py deleted file mode 100644 index a5b27634..00000000 --- a/test/unit/test_subscriptions.py +++ /dev/null @@ -1,38 +0,0 @@ -""" - Bandwidth - - Bandwidth's Communication APIs # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by: https://openapi-generator.tech -""" - - -import sys -import unittest - -import bandwidth -from bandwidth.model.participant_subscription import ParticipantSubscription -globals()['ParticipantSubscription'] = ParticipantSubscription -from bandwidth.model.subscriptions import Subscriptions - - -class TestSubscriptions(unittest.TestCase): - """Subscriptions unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testSubscriptions(self): - """Test Subscriptions""" - # FIXME: construct object with mandatory attributes with example values - # model = Subscriptions() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() From 3ba082df363ccace9d9ba3a87b95d3f263261806 Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Fri, 14 Oct 2022 14:23:41 -0400 Subject: [PATCH 04/10] DRY Added one test to TerminalVerb base class and removed redundant ones to reduce repetition per @bpateldx's recommendation --- bandwidth/model/bxml/verbs/conference.py | 35 ++++++++++++------------ test/unit/bxml/test_base_classes.py | 18 ++++++++---- test/unit/bxml/test_bridge.py | 4 --- test/unit/bxml/test_conference.py | 10 +------ test/unit/bxml/test_forward.py | 9 ++---- test/unit/bxml/test_gather.py | 10 +++---- test/unit/bxml/test_hangup.py | 10 ++----- test/unit/bxml/test_pause.py | 11 +++----- test/unit/bxml/test_pause_recording.py | 6 ---- test/unit/bxml/test_phone_number.py | 11 ++------ test/unit/bxml/test_play_audio.py | 9 ++---- test/unit/bxml/test_record.py | 7 ----- test/unit/bxml/test_redirect.py | 7 ----- test/unit/bxml/test_resume_recording.py | 5 ---- test/unit/bxml/test_ring.py | 11 ++------ test/unit/bxml/test_send_dtmf.py | 7 ----- test/unit/bxml/test_sip_uri.py | 5 ---- test/unit/bxml/test_speak_sentence.py | 13 +++------ test/unit/bxml/test_start_gather.py | 5 ---- test/unit/bxml/test_start_recording.py | 6 ---- test/unit/bxml/test_start_stream.py | 8 +++--- test/unit/bxml/test_stop_gather.py | 6 ---- test/unit/bxml/test_stop_recording.py | 5 ---- test/unit/bxml/test_stop_stream.py | 6 ---- test/unit/bxml/test_stream_param.py | 11 ++------ test/unit/bxml/test_tag.py | 10 ++----- test/unit/bxml/test_transfer.py | 7 ++--- 27 files changed, 68 insertions(+), 184 deletions(-) diff --git a/bandwidth/model/bxml/verbs/conference.py b/bandwidth/model/bxml/verbs/conference.py index 2c1dc49e..68e12026 100644 --- a/bandwidth/model/bxml/verbs/conference.py +++ b/bandwidth/model/bxml/verbs/conference.py @@ -6,7 +6,8 @@ @copyright Bandwidth INC """ from typing import Union, List -from ..verb import Verb + +from ..terminal_verb import TerminalVerb from .play_audio import PlayAudio from .speak_sentence import SpeakSentence from .start_recording import StartRecording @@ -15,16 +16,16 @@ from .resume_recording import ResumeRecording -class Conference(Verb): +class Conference(TerminalVerb): def __init__( self, name: str, - audio_and_recording_verbs: List[Union[PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording]] = [], mute: str=None, - hold: str=None, call_ids_to_coach: str=None, - conference_event_url: str=None, conference_event_method: str=None, - conference_event_fallback_url: str=None, conference_event_fallback_method: str=None, + audio_and_recording_verbs: List[Union[PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording]] = [], mute: str=None, + hold: str=None, call_ids_to_coach: str=None, + conference_event_url: str=None, conference_event_method: str=None, + conference_event_fallback_url: str=None, conference_event_fallback_method: str=None, username: str=None, password: str=None, - fallback_username: str=None, fallback_password: str=None, + fallback_username: str=None, fallback_password: str=None, tag: str=None, callback_timeout: str=None, ): """Initialize a verb @@ -33,10 +34,10 @@ def __init__( name (str): The name of the conference. Can contain up to 100 characters of letters, numbers, and the symbols -, _, and . mute (str, optional): A boolean value to indicate whether the member should be on mute in the conference. When muted, a member can hear others speak, but others cannot hear them speak. Defaults to false. hold (str, optional): A boolean value to indicate whether the member should be on hold in the conference. When on hold, a member cannot hear others, and they cannot be heard. Defaults to false. - call_ids_to_coach (str, optional): A comma-separated list of call ids to coach. When a call joins a conference with this attribute set, it will coach the listed calls. + call_ids_to_coach (str, optional): A comma-separated list of call ids to coach. When a call joins a conference with this attribute set, it will coach the listed calls. Those calls will be able to hear and be heard by the coach, but other calls in the conference will not hear the coach. - conference_event_url (str, optional): URL to send Conference events to. The URL, method, username, and password are set by the BXML document that creates the conference, - and all events related to that conference will be delivered to that same endpoint. If more calls join afterwards and also have this property (or any other webhook related properties like username and password), + conference_event_url (str, optional): URL to send Conference events to. The URL, method, username, and password are set by the BXML document that creates the conference, + and all events related to that conference will be delivered to that same endpoint. If more calls join afterwards and also have this property (or any other webhook related properties like username and password), they will be ignored and the original webhook information will be used. This URL may be a relative endpoint. conference_event_method (str, optional): The HTTP method to use for the request to conferenceEventUrl. GET or POST. Default value is POST. conference_event_fallback_url (str, optional): A fallback url which, if provided, will be used to retry the conference webhook deliveries in case conferenceEventUrl fails to respond. @@ -45,17 +46,17 @@ def __init__( password (str, optional): The password to send in the HTTP request to conferenceEventUrl. fallback_username (str, optional): The username to send in the HTTP request to conferenceEventFallbackUrl. fallback_password (str, optional): The password to send in the HTTP request to conferenceEventFallbackUrl. - tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". + tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None. - callback_timeout (str, optional): This is the timeout (in seconds) to use when delivering webhooks for the conference. + callback_timeout (str, optional): This is the timeout (in seconds) to use when delivering webhooks for the conference. If not set, it will inherit the webhook timeout from the call that creates the conference. Can be any numeric value (including decimals) between 1 and 25. Nested Verbs: - PlayAudio: (optional) - SpeakSentence: (optional) - StartRecording: (optional) + PlayAudio: (optional) + SpeakSentence: (optional) + StartRecording: (optional) StopRecording: (optional) - PauseRecording: (optional) + PauseRecording: (optional) ResumeRecording: (optional) """ self.name = name @@ -74,7 +75,7 @@ def __init__( self.callback_timeout = callback_timeout self.audio_and_recording_verbs = audio_and_recording_verbs super().__init__( - tag="Conference", + tag="Conference", content=self.name, nested_verbs=self.audio_and_recording_verbs) diff --git a/test/unit/bxml/test_base_classes.py b/test/unit/bxml/test_base_classes.py index bf831a35..4457a5ad 100644 --- a/test/unit/bxml/test_base_classes.py +++ b/test/unit/bxml/test_base_classes.py @@ -6,29 +6,32 @@ @copyright Bandwidth Inc. """ +import pytest import unittest from bandwidth.model.bxml.root import Root from bandwidth.model.bxml.verb import Verb +from bandwidth.model.bxml.terminal_verb import TerminalVerb class TestBaseClasses(unittest.TestCase): - - def setUp(self): + + def setUp(self): self.root = Root(tag="TestRoot") self.verb1 = Verb(tag="TestVerb1", content="test") self.verb2 = Verb(tag="TestVerb2") self.verb3 = Verb(tag="TestVerb3") - + self.terminal_verb = TerminalVerb(tag="TestTerminalVerb") + def test_root(self): self.root.add_verb(self.verb1) self.root.add_verb(self.verb2) - + expected_bxml = "\ntest" assert(type(self.root[0]) == Verb) assert(len(self.root) == 2) assert(expected_bxml == self.root.to_bxml()) - + def test_verb(self): self.verb3.add_verb(self.verb1) @@ -36,9 +39,12 @@ def test_verb(self): assert(type(self.verb3[0]) == Verb) assert(len(self.verb3) == 1) assert(expected_bxml == self.verb3.to_bxml()) - + def test_adding_verbs_to_root_during_creation(self): self.root2 = Root(tag="TestRoot2", nested_verbs=[self.verb1, self.verb2]) assert(len(self.root2) == 2) + def test_adding_verbs_to_terminal_verb(self): + with pytest.raises(AttributeError): + self.terminal_verb.add_verb(self.verb1) diff --git a/test/unit/bxml/test_bridge.py b/test/unit/bxml/test_bridge.py index f9bcb352..649dd50a 100644 --- a/test/unit/bxml/test_bridge.py +++ b/test/unit/bxml/test_bridge.py @@ -29,7 +29,3 @@ def test_to_bxml(self): else: expected = '+19198675309' assert(expected == self.bridge.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.bridge.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_conference.py b/test/unit/bxml/test_conference.py index 49400dad..b382b141 100644 --- a/test/unit/bxml/test_conference.py +++ b/test/unit/bxml/test_conference.py @@ -6,12 +6,12 @@ @copyright Bandwidth Inc. """ import os -import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs import * + class TestConference(unittest.TestCase): def setUp(self): @@ -56,11 +56,3 @@ def test_to_bxml(self): else: expected = 'conf1https://audio.url/audio1.wav' assert(expected == self.conference.to_bxml()) - - def test_add_verb(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = 'conf1https://audio.url/audio1.wavHello there.' - else: - expected = 'conf1https://audio.url/audio1.wavHello there.' - self.conference.add_verb(self.speak_sentence) - assert(expected == self.conference.to_bxml()) diff --git a/test/unit/bxml/test_forward.py b/test/unit/bxml/test_forward.py index f24e9f4a..4d78dc7f 100644 --- a/test/unit/bxml/test_forward.py +++ b/test/unit/bxml/test_forward.py @@ -6,14 +6,13 @@ @copyright Bandwidth Inc. """ import os -import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs.forward import Forward class TestForward(unittest.TestCase): - + def setUp(self): self.forward = Forward( to="19195554321", @@ -25,14 +24,10 @@ def setUp(self): ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = '' else: expected = '' assert(expected == self.forward.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.forward.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_gather.py b/test/unit/bxml/test_gather.py index 27e3f3ba..58114abd 100644 --- a/test/unit/bxml/test_gather.py +++ b/test/unit/bxml/test_gather.py @@ -6,14 +6,14 @@ @copyright Bandwidth Inc. """ import os -import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs import PlayAudio,SpeakSentence,Gather + class TestGather(unittest.TestCase): - + def setUp(self): self.play_audio = PlayAudio( audio_uri="https://audio.url/audio1.wav", @@ -24,7 +24,7 @@ def setUp(self): self.speak_sentence = SpeakSentence( text='Hello. Your number is asdf, lets play a game. What is 10 + 3. Press the pound key when finished.' ) - + self.gather = Gather( gather_url="test.com", gather_method="POST", @@ -42,14 +42,14 @@ def setUp(self): repeat_count = "2", audio_verbs=[self.play_audio] ) - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = 'https://audio.url/audio1.wav' else: expected = 'https://audio.url/audio1.wav' assert(expected == self.gather.to_bxml()) - + def test_add_verb(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = 'https://audio.url/audio1.wavHello. Your number is <say-as interpret-as="telephone">asdf</say-as>, lets play a game. What is 10 + 3. Press the pound key when finished.' diff --git a/test/unit/bxml/test_hangup.py b/test/unit/bxml/test_hangup.py index 2d847260..8ca1d8b3 100644 --- a/test/unit/bxml/test_hangup.py +++ b/test/unit/bxml/test_hangup.py @@ -5,7 +5,6 @@ @copyright Bandwidth Inc. """ -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -13,16 +12,11 @@ class TestHangup(unittest.TestCase): - + def setUp(self): self.hangup = Hangup() self.test_verb = Verb(tag="test") - + def test_to_bxml(self): expected = '' assert(expected == self.hangup.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.hangup.add_verb(self.test_verb) - diff --git a/test/unit/bxml/test_pause.py b/test/unit/bxml/test_pause.py index 8376e2ff..ddada00b 100644 --- a/test/unit/bxml/test_pause.py +++ b/test/unit/bxml/test_pause.py @@ -5,21 +5,18 @@ @copyright Bandwidth Inc. """ -import pytest import unittest + from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs.pause import Pause + class TestPause(unittest.TestCase): - + def setUp(self): self.pause = Pause(duration="30") self.test_verb = Verb(tag="test") - + def test_to_bxml(self): expected = '' assert(expected == self.pause.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.pause.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_pause_recording.py b/test/unit/bxml/test_pause_recording.py index ea894819..97f1d94a 100644 --- a/test/unit/bxml/test_pause_recording.py +++ b/test/unit/bxml/test_pause_recording.py @@ -5,7 +5,6 @@ @copyright Bandwidth Inc. """ -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -21,8 +20,3 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.pause_recording.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.pause_recording.add_verb(self.test_verb) - diff --git a/test/unit/bxml/test_phone_number.py b/test/unit/bxml/test_phone_number.py index 35c6b65b..f5f47d54 100644 --- a/test/unit/bxml/test_phone_number.py +++ b/test/unit/bxml/test_phone_number.py @@ -6,7 +6,6 @@ @copyright Bandwidth Inc. """ import os -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -14,7 +13,7 @@ class TestPhoneNumber(unittest.TestCase): - + def setUp(self): self.phone_number = PhoneNumber( number="+19195551234", @@ -23,15 +22,11 @@ def setUp(self): tag="" ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = '+19195551234' else: expected = '+19195551234' - + assert(expected == self.phone_number.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.phone_number.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_play_audio.py b/test/unit/bxml/test_play_audio.py index 7077f44e..9571deb6 100644 --- a/test/unit/bxml/test_play_audio.py +++ b/test/unit/bxml/test_play_audio.py @@ -6,14 +6,13 @@ @copyright Bandwidth Inc. """ import os -import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs import PlayAudio class TestPlayAudio(unittest.TestCase): - + def setUp(self): self.play_audio = PlayAudio( audio_uri="https://audio.url/audio1.wav", @@ -22,14 +21,10 @@ def setUp(self): ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = 'https://audio.url/audio1.wav' else: expected = 'https://audio.url/audio1.wav' assert(expected == self.play_audio.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.play_audio.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_record.py b/test/unit/bxml/test_record.py index 2906652d..81458652 100644 --- a/test/unit/bxml/test_record.py +++ b/test/unit/bxml/test_record.py @@ -5,7 +5,6 @@ @copyright Bandwidth Inc. """ -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -22,9 +21,3 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.record.to_bxml()) - - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.record.add_verb(self.test_verb) - diff --git a/test/unit/bxml/test_redirect.py b/test/unit/bxml/test_redirect.py index 85be947d..9acb4bf0 100644 --- a/test/unit/bxml/test_redirect.py +++ b/test/unit/bxml/test_redirect.py @@ -5,7 +5,6 @@ @copyright Bandwidth Inc. """ -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -22,9 +21,3 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.redirect.to_bxml()) - - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.record.add_verb(self.test_verb) - diff --git a/test/unit/bxml/test_resume_recording.py b/test/unit/bxml/test_resume_recording.py index 878dea74..04afc904 100644 --- a/test/unit/bxml/test_resume_recording.py +++ b/test/unit/bxml/test_resume_recording.py @@ -5,7 +5,6 @@ @copyright Bandwidth Inc. """ -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -21,7 +20,3 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.resume_recording.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.resume_recording.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_ring.py b/test/unit/bxml/test_ring.py index 2ce75767..fa92bb0c 100644 --- a/test/unit/bxml/test_ring.py +++ b/test/unit/bxml/test_ring.py @@ -6,7 +6,6 @@ @copyright Bandwidth Inc. """ import os -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -14,22 +13,18 @@ class TestRing(unittest.TestCase): - + def setUp(self): self.ring = Ring( duration="30", answer_call="true", ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = '' else: expected = '' - + assert(expected == self.ring.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.ring.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_send_dtmf.py b/test/unit/bxml/test_send_dtmf.py index 5698d2c4..1f815b7a 100644 --- a/test/unit/bxml/test_send_dtmf.py +++ b/test/unit/bxml/test_send_dtmf.py @@ -5,7 +5,6 @@ @copyright Bandwidth Inc. """ -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -25,9 +24,3 @@ def setUp(self): def test_to_bxml(self): expected = '1234' assert(expected == self.send_dtmf.to_bxml()) - - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.send_dtmf.add_verb(self.test_verb) - diff --git a/test/unit/bxml/test_sip_uri.py b/test/unit/bxml/test_sip_uri.py index 4a668012..b6cf839a 100644 --- a/test/unit/bxml/test_sip_uri.py +++ b/test/unit/bxml/test_sip_uri.py @@ -6,7 +6,6 @@ @copyright Bandwidth Inc. """ import os -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -31,7 +30,3 @@ def test_to_bxml(self): else: expected = 'sip:1-999-123-4567@voip-provider.example.net' assert(expected == self.sip_uri.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.sip_uri.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_speak_sentence.py b/test/unit/bxml/test_speak_sentence.py index c152b667..bd98d31a 100644 --- a/test/unit/bxml/test_speak_sentence.py +++ b/test/unit/bxml/test_speak_sentence.py @@ -5,27 +5,22 @@ @copyright Bandwidth Inc. """ -import os -import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs import SpeakSentence + class TestSpeakSentence(unittest.TestCase): - + def setUp(self): self.speak_sentence = SpeakSentence( text='Hello. Your number is asdf, lets play a game. What is 10 + 3. Press the pound key when finished.', voice="julie" ) - + self.test_verb = Verb(tag="test") - + def test_to_bxml(self): expected = 'Hello. Your number is <say-as interpret-as="telephone">asdf</say-as>, lets play a game. What is 10 + 3. Press the pound key when finished.' assert(expected == self.speak_sentence.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.speak_sentence.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_start_gather.py b/test/unit/bxml/test_start_gather.py index ae9235ef..589bd31a 100644 --- a/test/unit/bxml/test_start_gather.py +++ b/test/unit/bxml/test_start_gather.py @@ -6,7 +6,6 @@ @copyright Bandwidth Inc. """ import os -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -32,7 +31,3 @@ def test_to_bxml(self): expected = '' assert(expected == self.start_gather.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.start_gather.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_start_recording.py b/test/unit/bxml/test_start_recording.py index b80f9a56..d36f088f 100644 --- a/test/unit/bxml/test_start_recording.py +++ b/test/unit/bxml/test_start_recording.py @@ -6,7 +6,6 @@ @copyright Bandwidth Inc. """ import os -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -38,8 +37,3 @@ def test_to_bxml(self): expected = '' assert(expected == self.start_recording.to_bxml()) - - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.start_recording.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_start_stream.py b/test/unit/bxml/test_start_stream.py index 912832d4..97e0518f 100644 --- a/test/unit/bxml/test_start_stream.py +++ b/test/unit/bxml/test_start_stream.py @@ -6,13 +6,13 @@ @copyright Bandwidth Inc. """ import os -import pytest import unittest from bandwidth.model.bxml.verbs import StartStream, StreamParam + class TestStartStream(unittest.TestCase): - + def setUp(self): self.stream_param1 = StreamParam( name="name1", @@ -34,14 +34,14 @@ def setUp(self): username = "user", password = "pass" ) - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = '' else: expected = '' assert(expected == self.start_stream.to_bxml()) - + def test_add_verb(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = '' diff --git a/test/unit/bxml/test_stop_gather.py b/test/unit/bxml/test_stop_gather.py index 0cd8c3a6..b42637c7 100644 --- a/test/unit/bxml/test_stop_gather.py +++ b/test/unit/bxml/test_stop_gather.py @@ -5,7 +5,6 @@ @copyright Bandwidth Inc. """ -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -21,8 +20,3 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.stop_gather.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.stop_gather.add_verb(self.test_verb) - diff --git a/test/unit/bxml/test_stop_recording.py b/test/unit/bxml/test_stop_recording.py index 8d5a8209..80af056a 100644 --- a/test/unit/bxml/test_stop_recording.py +++ b/test/unit/bxml/test_stop_recording.py @@ -5,7 +5,6 @@ @copyright Bandwidth Inc. """ -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -21,7 +20,3 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.stop_recording.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.stop_recording.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_stop_stream.py b/test/unit/bxml/test_stop_stream.py index a944b7a3..22916c66 100644 --- a/test/unit/bxml/test_stop_stream.py +++ b/test/unit/bxml/test_stop_stream.py @@ -5,7 +5,6 @@ @copyright Bandwidth Inc. """ -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -21,8 +20,3 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.stop_stream.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.stop_stream.add_verb(self.test_verb) - diff --git a/test/unit/bxml/test_stream_param.py b/test/unit/bxml/test_stream_param.py index de4a8dfd..277df0c6 100644 --- a/test/unit/bxml/test_stream_param.py +++ b/test/unit/bxml/test_stream_param.py @@ -5,16 +5,15 @@ @copyright Bandwidth Inc. """ -import os -import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs import StreamParam + class TestStreamParam(unittest.TestCase): - + def setUp(self): self.stream_param = StreamParam( name="name1", @@ -22,11 +21,7 @@ def setUp(self): ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): expected = '' assert(expected == self.stream_param.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.stream_param.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_tag.py b/test/unit/bxml/test_tag.py index 5170c3b5..d8fd55cf 100644 --- a/test/unit/bxml/test_tag.py +++ b/test/unit/bxml/test_tag.py @@ -5,7 +5,6 @@ @copyright Bandwidth Inc. """ -import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -13,16 +12,11 @@ class TestTag(unittest.TestCase): - + def setUp(self): self.tag = Tag(content="Test") self.test_verb = Verb(tag="test") - + def test_to_bxml(self): expected = 'Test' assert(expected == self.tag.to_bxml()) - - def test_add_verb(self): - with pytest.raises(AttributeError): - self.tag.add_verb(self.test_verb) - diff --git a/test/unit/bxml/test_transfer.py b/test/unit/bxml/test_transfer.py index 56be72e4..bbda0f96 100644 --- a/test/unit/bxml/test_transfer.py +++ b/test/unit/bxml/test_transfer.py @@ -6,7 +6,6 @@ @copyright Bandwidth Inc. """ import os -import pytest import unittest from bandwidth.model.bxml.verbs.transfer import Transfer @@ -15,7 +14,7 @@ class TestTransfer(unittest.TestCase): - + def setUp(self): self.sip_uri = SipUri( uri="sip@bw.com", @@ -31,14 +30,14 @@ def setUp(self): transfer_caller_id = "+19195554321", tag = "test" ) - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = 'sip@bw.com' else: expected = 'sip@bw.com' assert(expected == self.transfer.to_bxml()) - + def test_add_verb(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = 'sip@bw.com+19195551234' From 79ef9ee25cedf300ba179a18e790f524621d62be Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Fri, 14 Oct 2022 14:24:50 -0400 Subject: [PATCH 05/10] Revert "DRY" This reverts commit 3ba082df363ccace9d9ba3a87b95d3f263261806. --- bandwidth/model/bxml/verbs/conference.py | 35 ++++++++++++------------ test/unit/bxml/test_base_classes.py | 18 ++++-------- test/unit/bxml/test_bridge.py | 4 +++ test/unit/bxml/test_conference.py | 10 ++++++- test/unit/bxml/test_forward.py | 9 ++++-- test/unit/bxml/test_gather.py | 10 +++---- test/unit/bxml/test_hangup.py | 10 +++++-- test/unit/bxml/test_pause.py | 11 +++++--- test/unit/bxml/test_pause_recording.py | 6 ++++ test/unit/bxml/test_phone_number.py | 11 ++++++-- test/unit/bxml/test_play_audio.py | 9 ++++-- test/unit/bxml/test_record.py | 7 +++++ test/unit/bxml/test_redirect.py | 7 +++++ test/unit/bxml/test_resume_recording.py | 5 ++++ test/unit/bxml/test_ring.py | 11 ++++++-- test/unit/bxml/test_send_dtmf.py | 7 +++++ test/unit/bxml/test_sip_uri.py | 5 ++++ test/unit/bxml/test_speak_sentence.py | 13 ++++++--- test/unit/bxml/test_start_gather.py | 5 ++++ test/unit/bxml/test_start_recording.py | 6 ++++ test/unit/bxml/test_start_stream.py | 8 +++--- test/unit/bxml/test_stop_gather.py | 6 ++++ test/unit/bxml/test_stop_recording.py | 5 ++++ test/unit/bxml/test_stop_stream.py | 6 ++++ test/unit/bxml/test_stream_param.py | 11 ++++++-- test/unit/bxml/test_tag.py | 10 +++++-- test/unit/bxml/test_transfer.py | 7 +++-- 27 files changed, 184 insertions(+), 68 deletions(-) diff --git a/bandwidth/model/bxml/verbs/conference.py b/bandwidth/model/bxml/verbs/conference.py index 68e12026..2c1dc49e 100644 --- a/bandwidth/model/bxml/verbs/conference.py +++ b/bandwidth/model/bxml/verbs/conference.py @@ -6,8 +6,7 @@ @copyright Bandwidth INC """ from typing import Union, List - -from ..terminal_verb import TerminalVerb +from ..verb import Verb from .play_audio import PlayAudio from .speak_sentence import SpeakSentence from .start_recording import StartRecording @@ -16,16 +15,16 @@ from .resume_recording import ResumeRecording -class Conference(TerminalVerb): +class Conference(Verb): def __init__( self, name: str, - audio_and_recording_verbs: List[Union[PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording]] = [], mute: str=None, - hold: str=None, call_ids_to_coach: str=None, - conference_event_url: str=None, conference_event_method: str=None, - conference_event_fallback_url: str=None, conference_event_fallback_method: str=None, + audio_and_recording_verbs: List[Union[PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording]] = [], mute: str=None, + hold: str=None, call_ids_to_coach: str=None, + conference_event_url: str=None, conference_event_method: str=None, + conference_event_fallback_url: str=None, conference_event_fallback_method: str=None, username: str=None, password: str=None, - fallback_username: str=None, fallback_password: str=None, + fallback_username: str=None, fallback_password: str=None, tag: str=None, callback_timeout: str=None, ): """Initialize a verb @@ -34,10 +33,10 @@ def __init__( name (str): The name of the conference. Can contain up to 100 characters of letters, numbers, and the symbols -, _, and . mute (str, optional): A boolean value to indicate whether the member should be on mute in the conference. When muted, a member can hear others speak, but others cannot hear them speak. Defaults to false. hold (str, optional): A boolean value to indicate whether the member should be on hold in the conference. When on hold, a member cannot hear others, and they cannot be heard. Defaults to false. - call_ids_to_coach (str, optional): A comma-separated list of call ids to coach. When a call joins a conference with this attribute set, it will coach the listed calls. + call_ids_to_coach (str, optional): A comma-separated list of call ids to coach. When a call joins a conference with this attribute set, it will coach the listed calls. Those calls will be able to hear and be heard by the coach, but other calls in the conference will not hear the coach. - conference_event_url (str, optional): URL to send Conference events to. The URL, method, username, and password are set by the BXML document that creates the conference, - and all events related to that conference will be delivered to that same endpoint. If more calls join afterwards and also have this property (or any other webhook related properties like username and password), + conference_event_url (str, optional): URL to send Conference events to. The URL, method, username, and password are set by the BXML document that creates the conference, + and all events related to that conference will be delivered to that same endpoint. If more calls join afterwards and also have this property (or any other webhook related properties like username and password), they will be ignored and the original webhook information will be used. This URL may be a relative endpoint. conference_event_method (str, optional): The HTTP method to use for the request to conferenceEventUrl. GET or POST. Default value is POST. conference_event_fallback_url (str, optional): A fallback url which, if provided, will be used to retry the conference webhook deliveries in case conferenceEventUrl fails to respond. @@ -46,17 +45,17 @@ def __init__( password (str, optional): The password to send in the HTTP request to conferenceEventUrl. fallback_username (str, optional): The username to send in the HTTP request to conferenceEventFallbackUrl. fallback_password (str, optional): The password to send in the HTTP request to conferenceEventFallbackUrl. - tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". + tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None. - callback_timeout (str, optional): This is the timeout (in seconds) to use when delivering webhooks for the conference. + callback_timeout (str, optional): This is the timeout (in seconds) to use when delivering webhooks for the conference. If not set, it will inherit the webhook timeout from the call that creates the conference. Can be any numeric value (including decimals) between 1 and 25. Nested Verbs: - PlayAudio: (optional) - SpeakSentence: (optional) - StartRecording: (optional) + PlayAudio: (optional) + SpeakSentence: (optional) + StartRecording: (optional) StopRecording: (optional) - PauseRecording: (optional) + PauseRecording: (optional) ResumeRecording: (optional) """ self.name = name @@ -75,7 +74,7 @@ def __init__( self.callback_timeout = callback_timeout self.audio_and_recording_verbs = audio_and_recording_verbs super().__init__( - tag="Conference", + tag="Conference", content=self.name, nested_verbs=self.audio_and_recording_verbs) diff --git a/test/unit/bxml/test_base_classes.py b/test/unit/bxml/test_base_classes.py index 4457a5ad..bf831a35 100644 --- a/test/unit/bxml/test_base_classes.py +++ b/test/unit/bxml/test_base_classes.py @@ -6,32 +6,29 @@ @copyright Bandwidth Inc. """ -import pytest import unittest from bandwidth.model.bxml.root import Root from bandwidth.model.bxml.verb import Verb -from bandwidth.model.bxml.terminal_verb import TerminalVerb class TestBaseClasses(unittest.TestCase): - - def setUp(self): + + def setUp(self): self.root = Root(tag="TestRoot") self.verb1 = Verb(tag="TestVerb1", content="test") self.verb2 = Verb(tag="TestVerb2") self.verb3 = Verb(tag="TestVerb3") - self.terminal_verb = TerminalVerb(tag="TestTerminalVerb") - + def test_root(self): self.root.add_verb(self.verb1) self.root.add_verb(self.verb2) - + expected_bxml = "\ntest" assert(type(self.root[0]) == Verb) assert(len(self.root) == 2) assert(expected_bxml == self.root.to_bxml()) - + def test_verb(self): self.verb3.add_verb(self.verb1) @@ -39,12 +36,9 @@ def test_verb(self): assert(type(self.verb3[0]) == Verb) assert(len(self.verb3) == 1) assert(expected_bxml == self.verb3.to_bxml()) - + def test_adding_verbs_to_root_during_creation(self): self.root2 = Root(tag="TestRoot2", nested_verbs=[self.verb1, self.verb2]) assert(len(self.root2) == 2) - def test_adding_verbs_to_terminal_verb(self): - with pytest.raises(AttributeError): - self.terminal_verb.add_verb(self.verb1) diff --git a/test/unit/bxml/test_bridge.py b/test/unit/bxml/test_bridge.py index 649dd50a..f9bcb352 100644 --- a/test/unit/bxml/test_bridge.py +++ b/test/unit/bxml/test_bridge.py @@ -29,3 +29,7 @@ def test_to_bxml(self): else: expected = '+19198675309' assert(expected == self.bridge.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.bridge.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_conference.py b/test/unit/bxml/test_conference.py index b382b141..49400dad 100644 --- a/test/unit/bxml/test_conference.py +++ b/test/unit/bxml/test_conference.py @@ -6,12 +6,12 @@ @copyright Bandwidth Inc. """ import os +import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs import * - class TestConference(unittest.TestCase): def setUp(self): @@ -56,3 +56,11 @@ def test_to_bxml(self): else: expected = 'conf1https://audio.url/audio1.wav' assert(expected == self.conference.to_bxml()) + + def test_add_verb(self): + if os.environ['PYTHON_VERSION'] == '3.7': + expected = 'conf1https://audio.url/audio1.wavHello there.' + else: + expected = 'conf1https://audio.url/audio1.wavHello there.' + self.conference.add_verb(self.speak_sentence) + assert(expected == self.conference.to_bxml()) diff --git a/test/unit/bxml/test_forward.py b/test/unit/bxml/test_forward.py index 4d78dc7f..f24e9f4a 100644 --- a/test/unit/bxml/test_forward.py +++ b/test/unit/bxml/test_forward.py @@ -6,13 +6,14 @@ @copyright Bandwidth Inc. """ import os +import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs.forward import Forward class TestForward(unittest.TestCase): - + def setUp(self): self.forward = Forward( to="19195554321", @@ -24,10 +25,14 @@ def setUp(self): ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = '' else: expected = '' assert(expected == self.forward.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.forward.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_gather.py b/test/unit/bxml/test_gather.py index 58114abd..27e3f3ba 100644 --- a/test/unit/bxml/test_gather.py +++ b/test/unit/bxml/test_gather.py @@ -6,14 +6,14 @@ @copyright Bandwidth Inc. """ import os +import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs import PlayAudio,SpeakSentence,Gather - class TestGather(unittest.TestCase): - + def setUp(self): self.play_audio = PlayAudio( audio_uri="https://audio.url/audio1.wav", @@ -24,7 +24,7 @@ def setUp(self): self.speak_sentence = SpeakSentence( text='Hello. Your number is asdf, lets play a game. What is 10 + 3. Press the pound key when finished.' ) - + self.gather = Gather( gather_url="test.com", gather_method="POST", @@ -42,14 +42,14 @@ def setUp(self): repeat_count = "2", audio_verbs=[self.play_audio] ) - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = 'https://audio.url/audio1.wav' else: expected = 'https://audio.url/audio1.wav' assert(expected == self.gather.to_bxml()) - + def test_add_verb(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = 'https://audio.url/audio1.wavHello. Your number is <say-as interpret-as="telephone">asdf</say-as>, lets play a game. What is 10 + 3. Press the pound key when finished.' diff --git a/test/unit/bxml/test_hangup.py b/test/unit/bxml/test_hangup.py index 8ca1d8b3..2d847260 100644 --- a/test/unit/bxml/test_hangup.py +++ b/test/unit/bxml/test_hangup.py @@ -5,6 +5,7 @@ @copyright Bandwidth Inc. """ +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -12,11 +13,16 @@ class TestHangup(unittest.TestCase): - + def setUp(self): self.hangup = Hangup() self.test_verb = Verb(tag="test") - + def test_to_bxml(self): expected = '' assert(expected == self.hangup.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.hangup.add_verb(self.test_verb) + diff --git a/test/unit/bxml/test_pause.py b/test/unit/bxml/test_pause.py index ddada00b..8376e2ff 100644 --- a/test/unit/bxml/test_pause.py +++ b/test/unit/bxml/test_pause.py @@ -5,18 +5,21 @@ @copyright Bandwidth Inc. """ +import pytest import unittest - from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs.pause import Pause - class TestPause(unittest.TestCase): - + def setUp(self): self.pause = Pause(duration="30") self.test_verb = Verb(tag="test") - + def test_to_bxml(self): expected = '' assert(expected == self.pause.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.pause.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_pause_recording.py b/test/unit/bxml/test_pause_recording.py index 97f1d94a..ea894819 100644 --- a/test/unit/bxml/test_pause_recording.py +++ b/test/unit/bxml/test_pause_recording.py @@ -5,6 +5,7 @@ @copyright Bandwidth Inc. """ +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -20,3 +21,8 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.pause_recording.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.pause_recording.add_verb(self.test_verb) + diff --git a/test/unit/bxml/test_phone_number.py b/test/unit/bxml/test_phone_number.py index f5f47d54..35c6b65b 100644 --- a/test/unit/bxml/test_phone_number.py +++ b/test/unit/bxml/test_phone_number.py @@ -6,6 +6,7 @@ @copyright Bandwidth Inc. """ import os +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -13,7 +14,7 @@ class TestPhoneNumber(unittest.TestCase): - + def setUp(self): self.phone_number = PhoneNumber( number="+19195551234", @@ -22,11 +23,15 @@ def setUp(self): tag="" ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = '+19195551234' else: expected = '+19195551234' - + assert(expected == self.phone_number.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.phone_number.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_play_audio.py b/test/unit/bxml/test_play_audio.py index 9571deb6..7077f44e 100644 --- a/test/unit/bxml/test_play_audio.py +++ b/test/unit/bxml/test_play_audio.py @@ -6,13 +6,14 @@ @copyright Bandwidth Inc. """ import os +import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs import PlayAudio class TestPlayAudio(unittest.TestCase): - + def setUp(self): self.play_audio = PlayAudio( audio_uri="https://audio.url/audio1.wav", @@ -21,10 +22,14 @@ def setUp(self): ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = 'https://audio.url/audio1.wav' else: expected = 'https://audio.url/audio1.wav' assert(expected == self.play_audio.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.play_audio.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_record.py b/test/unit/bxml/test_record.py index 81458652..2906652d 100644 --- a/test/unit/bxml/test_record.py +++ b/test/unit/bxml/test_record.py @@ -5,6 +5,7 @@ @copyright Bandwidth Inc. """ +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -21,3 +22,9 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.record.to_bxml()) + + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.record.add_verb(self.test_verb) + diff --git a/test/unit/bxml/test_redirect.py b/test/unit/bxml/test_redirect.py index 9acb4bf0..85be947d 100644 --- a/test/unit/bxml/test_redirect.py +++ b/test/unit/bxml/test_redirect.py @@ -5,6 +5,7 @@ @copyright Bandwidth Inc. """ +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -21,3 +22,9 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.redirect.to_bxml()) + + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.record.add_verb(self.test_verb) + diff --git a/test/unit/bxml/test_resume_recording.py b/test/unit/bxml/test_resume_recording.py index 04afc904..878dea74 100644 --- a/test/unit/bxml/test_resume_recording.py +++ b/test/unit/bxml/test_resume_recording.py @@ -5,6 +5,7 @@ @copyright Bandwidth Inc. """ +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -20,3 +21,7 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.resume_recording.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.resume_recording.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_ring.py b/test/unit/bxml/test_ring.py index fa92bb0c..2ce75767 100644 --- a/test/unit/bxml/test_ring.py +++ b/test/unit/bxml/test_ring.py @@ -6,6 +6,7 @@ @copyright Bandwidth Inc. """ import os +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -13,18 +14,22 @@ class TestRing(unittest.TestCase): - + def setUp(self): self.ring = Ring( duration="30", answer_call="true", ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = '' else: expected = '' - + assert(expected == self.ring.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.ring.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_send_dtmf.py b/test/unit/bxml/test_send_dtmf.py index 1f815b7a..5698d2c4 100644 --- a/test/unit/bxml/test_send_dtmf.py +++ b/test/unit/bxml/test_send_dtmf.py @@ -5,6 +5,7 @@ @copyright Bandwidth Inc. """ +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -24,3 +25,9 @@ def setUp(self): def test_to_bxml(self): expected = '1234' assert(expected == self.send_dtmf.to_bxml()) + + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.send_dtmf.add_verb(self.test_verb) + diff --git a/test/unit/bxml/test_sip_uri.py b/test/unit/bxml/test_sip_uri.py index b6cf839a..4a668012 100644 --- a/test/unit/bxml/test_sip_uri.py +++ b/test/unit/bxml/test_sip_uri.py @@ -6,6 +6,7 @@ @copyright Bandwidth Inc. """ import os +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -30,3 +31,7 @@ def test_to_bxml(self): else: expected = 'sip:1-999-123-4567@voip-provider.example.net' assert(expected == self.sip_uri.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.sip_uri.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_speak_sentence.py b/test/unit/bxml/test_speak_sentence.py index bd98d31a..c152b667 100644 --- a/test/unit/bxml/test_speak_sentence.py +++ b/test/unit/bxml/test_speak_sentence.py @@ -5,22 +5,27 @@ @copyright Bandwidth Inc. """ +import os +import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs import SpeakSentence - class TestSpeakSentence(unittest.TestCase): - + def setUp(self): self.speak_sentence = SpeakSentence( text='Hello. Your number is asdf, lets play a game. What is 10 + 3. Press the pound key when finished.', voice="julie" ) - + self.test_verb = Verb(tag="test") - + def test_to_bxml(self): expected = 'Hello. Your number is <say-as interpret-as="telephone">asdf</say-as>, lets play a game. What is 10 + 3. Press the pound key when finished.' assert(expected == self.speak_sentence.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.speak_sentence.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_start_gather.py b/test/unit/bxml/test_start_gather.py index 589bd31a..ae9235ef 100644 --- a/test/unit/bxml/test_start_gather.py +++ b/test/unit/bxml/test_start_gather.py @@ -6,6 +6,7 @@ @copyright Bandwidth Inc. """ import os +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -31,3 +32,7 @@ def test_to_bxml(self): expected = '' assert(expected == self.start_gather.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.start_gather.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_start_recording.py b/test/unit/bxml/test_start_recording.py index d36f088f..b80f9a56 100644 --- a/test/unit/bxml/test_start_recording.py +++ b/test/unit/bxml/test_start_recording.py @@ -6,6 +6,7 @@ @copyright Bandwidth Inc. """ import os +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -37,3 +38,8 @@ def test_to_bxml(self): expected = '' assert(expected == self.start_recording.to_bxml()) + + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.start_recording.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_start_stream.py b/test/unit/bxml/test_start_stream.py index 97e0518f..912832d4 100644 --- a/test/unit/bxml/test_start_stream.py +++ b/test/unit/bxml/test_start_stream.py @@ -6,13 +6,13 @@ @copyright Bandwidth Inc. """ import os +import pytest import unittest from bandwidth.model.bxml.verbs import StartStream, StreamParam - class TestStartStream(unittest.TestCase): - + def setUp(self): self.stream_param1 = StreamParam( name="name1", @@ -34,14 +34,14 @@ def setUp(self): username = "user", password = "pass" ) - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = '' else: expected = '' assert(expected == self.start_stream.to_bxml()) - + def test_add_verb(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = '' diff --git a/test/unit/bxml/test_stop_gather.py b/test/unit/bxml/test_stop_gather.py index b42637c7..0cd8c3a6 100644 --- a/test/unit/bxml/test_stop_gather.py +++ b/test/unit/bxml/test_stop_gather.py @@ -5,6 +5,7 @@ @copyright Bandwidth Inc. """ +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -20,3 +21,8 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.stop_gather.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.stop_gather.add_verb(self.test_verb) + diff --git a/test/unit/bxml/test_stop_recording.py b/test/unit/bxml/test_stop_recording.py index 80af056a..8d5a8209 100644 --- a/test/unit/bxml/test_stop_recording.py +++ b/test/unit/bxml/test_stop_recording.py @@ -5,6 +5,7 @@ @copyright Bandwidth Inc. """ +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -20,3 +21,7 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.stop_recording.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.stop_recording.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_stop_stream.py b/test/unit/bxml/test_stop_stream.py index 22916c66..a944b7a3 100644 --- a/test/unit/bxml/test_stop_stream.py +++ b/test/unit/bxml/test_stop_stream.py @@ -5,6 +5,7 @@ @copyright Bandwidth Inc. """ +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -20,3 +21,8 @@ def setUp(self): def test_to_bxml(self): expected = '' assert(expected == self.stop_stream.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.stop_stream.add_verb(self.test_verb) + diff --git a/test/unit/bxml/test_stream_param.py b/test/unit/bxml/test_stream_param.py index 277df0c6..de4a8dfd 100644 --- a/test/unit/bxml/test_stream_param.py +++ b/test/unit/bxml/test_stream_param.py @@ -5,15 +5,16 @@ @copyright Bandwidth Inc. """ +import os +import pytest import unittest from bandwidth.model.bxml.verb import Verb from bandwidth.model.bxml.verbs import StreamParam - class TestStreamParam(unittest.TestCase): - + def setUp(self): self.stream_param = StreamParam( name="name1", @@ -21,7 +22,11 @@ def setUp(self): ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): expected = '' assert(expected == self.stream_param.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.stream_param.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_tag.py b/test/unit/bxml/test_tag.py index d8fd55cf..5170c3b5 100644 --- a/test/unit/bxml/test_tag.py +++ b/test/unit/bxml/test_tag.py @@ -5,6 +5,7 @@ @copyright Bandwidth Inc. """ +import pytest import unittest from bandwidth.model.bxml.verb import Verb @@ -12,11 +13,16 @@ class TestTag(unittest.TestCase): - + def setUp(self): self.tag = Tag(content="Test") self.test_verb = Verb(tag="test") - + def test_to_bxml(self): expected = 'Test' assert(expected == self.tag.to_bxml()) + + def test_add_verb(self): + with pytest.raises(AttributeError): + self.tag.add_verb(self.test_verb) + diff --git a/test/unit/bxml/test_transfer.py b/test/unit/bxml/test_transfer.py index bbda0f96..56be72e4 100644 --- a/test/unit/bxml/test_transfer.py +++ b/test/unit/bxml/test_transfer.py @@ -6,6 +6,7 @@ @copyright Bandwidth Inc. """ import os +import pytest import unittest from bandwidth.model.bxml.verbs.transfer import Transfer @@ -14,7 +15,7 @@ class TestTransfer(unittest.TestCase): - + def setUp(self): self.sip_uri = SipUri( uri="sip@bw.com", @@ -30,14 +31,14 @@ def setUp(self): transfer_caller_id = "+19195554321", tag = "test" ) - + def test_to_bxml(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = 'sip@bw.com' else: expected = 'sip@bw.com' assert(expected == self.transfer.to_bxml()) - + def test_add_verb(self): if os.environ['PYTHON_VERSION'] == '3.7': expected = 'sip@bw.com+19195551234' From 77b87e9c7952add7a3ac319202921a6f506e0d0a Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Mon, 17 Oct 2022 11:43:21 -0400 Subject: [PATCH 06/10] Fix bug with xml declaration `utf8` causes an issue with the backend - `UTF-8` is valid Also updated the import statements so that users can declare `from bandwidth.model.bxml import Response` --- bandwidth/model/bxml/__init__.py | 4 ++-- bandwidth/model/bxml/root.py | 13 ++++++------- setup.py | 2 +- test/unit/bxml/test_base_classes.py | 14 +++++++------- test/unit/bxml/test_bxml.py | 4 ++-- test/unit/bxml/test_response.py | 2 +- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/bandwidth/model/bxml/__init__.py b/bandwidth/model/bxml/__init__.py index a9b3480d..4fc2e598 100644 --- a/bandwidth/model/bxml/__init__.py +++ b/bandwidth/model/bxml/__init__.py @@ -1,3 +1,3 @@ -from . import response -from . import bxml +from .response import Response +from .bxml import Bxml from . import verbs diff --git a/bandwidth/model/bxml/root.py b/bandwidth/model/bxml/root.py index 0ed28585..dd5e46ed 100644 --- a/bandwidth/model/bxml/root.py +++ b/bandwidth/model/bxml/root.py @@ -34,7 +34,7 @@ def __len__(self) -> int: int: Length of self._nested_verbs """ return len(self._nested_verbs) - + def __getitem__(self, position: int) -> Verb: """Override default getitem method. Makes the object iterable. @@ -42,10 +42,10 @@ def __getitem__(self, position: int) -> Verb: position (int): Desired self._nested_verbs list position Returns: - BxmlVerb: Desired BXML verb + BxmlVerb: Desired BXML verb """ return self._nested_verbs[position] - + def _generate_xml(self) -> ET.Element: """Generates an XML dom @@ -58,7 +58,7 @@ def _generate_xml(self) -> ET.Element: root.append(verb._to_etree_element()) dom = ET.ElementTree(root) return dom - + def add_verb(self, verb: Verb) -> None: """Add a verb to the object's nested_verbs array @@ -66,7 +66,7 @@ def add_verb(self, verb: Verb) -> None: verb (BxmlVerb): BXML verb to nest within the parent. Becomes a child xml element. """ self._nested_verbs.append(verb) - + def to_bxml(self) -> str: """Return the serialized BXML string @@ -74,5 +74,4 @@ def to_bxml(self) -> str: str: Serialized BXML string """ xml_document = self._generate_xml() - return ET.tostring(xml_document._root, encoding='utf8', method='xml').decode("utf8") - + return ET.tostring(xml_document._root, encoding='UTF-8', method='xml', xml_declaration=True).decode("utf8") diff --git a/setup.py b/setup.py index ffec57da..080da975 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ REQUIRES = [ "urllib3 >= 1.25.3", "python-dateutil", - "lxml>=4.9.1", + # "lxml>=4.9.1", ] setup( diff --git a/test/unit/bxml/test_base_classes.py b/test/unit/bxml/test_base_classes.py index bf831a35..1be2aa49 100644 --- a/test/unit/bxml/test_base_classes.py +++ b/test/unit/bxml/test_base_classes.py @@ -13,22 +13,22 @@ class TestBaseClasses(unittest.TestCase): - - def setUp(self): + + def setUp(self): self.root = Root(tag="TestRoot") self.verb1 = Verb(tag="TestVerb1", content="test") self.verb2 = Verb(tag="TestVerb2") self.verb3 = Verb(tag="TestVerb3") - + def test_root(self): self.root.add_verb(self.verb1) self.root.add_verb(self.verb2) - - expected_bxml = "\ntest" + + expected_bxml = "\ntest" assert(type(self.root[0]) == Verb) assert(len(self.root) == 2) assert(expected_bxml == self.root.to_bxml()) - + def test_verb(self): self.verb3.add_verb(self.verb1) @@ -36,7 +36,7 @@ def test_verb(self): assert(type(self.verb3[0]) == Verb) assert(len(self.verb3) == 1) assert(expected_bxml == self.verb3.to_bxml()) - + def test_adding_verbs_to_root_during_creation(self): self.root2 = Root(tag="TestRoot2", nested_verbs=[self.verb1, self.verb2]) diff --git a/test/unit/bxml/test_bxml.py b/test/unit/bxml/test_bxml.py index 47dcecff..748a4f30 100644 --- a/test/unit/bxml/test_bxml.py +++ b/test/unit/bxml/test_bxml.py @@ -15,8 +15,8 @@ class TestBxml(unittest.TestCase): def setUp(self): self.response = Bxml() - def test_response_init(self): + def test_bxml_init(self): """Test initializing the root """ - expected_bxml = "\n" + expected_bxml = "\n" assert self.response.to_bxml() == expected_bxml diff --git a/test/unit/bxml/test_response.py b/test/unit/bxml/test_response.py index 552eb3d4..218c2cc5 100644 --- a/test/unit/bxml/test_response.py +++ b/test/unit/bxml/test_response.py @@ -18,5 +18,5 @@ def setUp(self): def test_response_init(self): """Test initializing the root """ - expected_bxml = "\n" + expected_bxml = "\n" assert self.response.to_bxml() == expected_bxml From df0a8b939889fc220884ff9dae074bd9a4546028 Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Mon, 17 Oct 2022 11:43:52 -0400 Subject: [PATCH 07/10] Trigger Tests From 52369da753395dceaebe5a205d1563c5bc18b65b Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Mon, 17 Oct 2022 13:54:18 -0400 Subject: [PATCH 08/10] Remove LXML dependency in `setup.py` --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 080da975..2eecca34 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,6 @@ REQUIRES = [ "urllib3 >= 1.25.3", "python-dateutil", - # "lxml>=4.9.1", ] setup( From 7c687465105fd2ec94b03d3fd5e575c15daebe98 Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Tue, 18 Oct 2022 11:44:38 -0400 Subject: [PATCH 09/10] Drop Support for Python 3.7 --- .github/workflows/test.yaml | 4 ++-- test/unit/bxml/test_bridge.py | 5 +---- test/unit/bxml/test_conference.py | 10 ++-------- test/unit/bxml/test_forward.py | 10 +++------- test/unit/bxml/test_gather.py | 18 ++++++------------ test/unit/bxml/test_phone_number.py | 12 ++++-------- test/unit/bxml/test_play_audio.py | 11 ++++------- test/unit/bxml/test_ring.py | 12 ++++-------- test/unit/bxml/test_sip_uri.py | 5 +---- test/unit/bxml/test_start_gather.py | 6 +----- test/unit/bxml/test_start_recording.py | 6 +----- test/unit/bxml/test_start_stream.py | 16 +++++----------- test/unit/bxml/test_transfer.py | 16 +++++----------- 13 files changed, 39 insertions(+), 92 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6d72e6de..15eefefa 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,7 +13,7 @@ on: type: choice options: - WARNING - - DEBUG + - DEBUG jobs: deploy: @@ -22,7 +22,7 @@ jobs: strategy: matrix: os: [windows-2022, windows-2019, ubuntu-18.04, ubuntu-20.04] - python-version: [3.7, 3.8, 3.9, "3.10"] + python-version: [3.8, 3.9, "3.10"] env: BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} BW_USERNAME: ${{ secrets.BW_USERNAME }} diff --git a/test/unit/bxml/test_bridge.py b/test/unit/bxml/test_bridge.py index f9bcb352..4325883e 100644 --- a/test/unit/bxml/test_bridge.py +++ b/test/unit/bxml/test_bridge.py @@ -24,10 +24,7 @@ def setUp(self): self.test_verb = Verb(tag="test") def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = '+19198675309' - else: - expected = '+19198675309' + expected = '+19198675309' assert(expected == self.bridge.to_bxml()) def test_add_verb(self): diff --git a/test/unit/bxml/test_conference.py b/test/unit/bxml/test_conference.py index 49400dad..05ee37b2 100644 --- a/test/unit/bxml/test_conference.py +++ b/test/unit/bxml/test_conference.py @@ -51,16 +51,10 @@ def setUp(self): ) def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = 'conf1https://audio.url/audio1.wav' - else: - expected = 'conf1https://audio.url/audio1.wav' + expected = 'conf1https://audio.url/audio1.wav' assert(expected == self.conference.to_bxml()) def test_add_verb(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = 'conf1https://audio.url/audio1.wavHello there.' - else: - expected = 'conf1https://audio.url/audio1.wavHello there.' + expected = 'conf1https://audio.url/audio1.wavHello there.' self.conference.add_verb(self.speak_sentence) assert(expected == self.conference.to_bxml()) diff --git a/test/unit/bxml/test_forward.py b/test/unit/bxml/test_forward.py index f24e9f4a..40895b81 100644 --- a/test/unit/bxml/test_forward.py +++ b/test/unit/bxml/test_forward.py @@ -13,7 +13,7 @@ from bandwidth.model.bxml.verbs.forward import Forward class TestForward(unittest.TestCase): - + def setUp(self): self.forward = Forward( to="19195554321", @@ -25,14 +25,10 @@ def setUp(self): ) self.test_verb = Verb(tag="test") - def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = '' - else: - expected = '' + expected = '' assert(expected == self.forward.to_bxml()) - + def test_add_verb(self): with pytest.raises(AttributeError): self.forward.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_gather.py b/test/unit/bxml/test_gather.py index 27e3f3ba..820a2dda 100644 --- a/test/unit/bxml/test_gather.py +++ b/test/unit/bxml/test_gather.py @@ -13,7 +13,7 @@ from bandwidth.model.bxml.verbs import PlayAudio,SpeakSentence,Gather class TestGather(unittest.TestCase): - + def setUp(self): self.play_audio = PlayAudio( audio_uri="https://audio.url/audio1.wav", @@ -24,7 +24,7 @@ def setUp(self): self.speak_sentence = SpeakSentence( text='Hello. Your number is asdf, lets play a game. What is 10 + 3. Press the pound key when finished.' ) - + self.gather = Gather( gather_url="test.com", gather_method="POST", @@ -42,18 +42,12 @@ def setUp(self): repeat_count = "2", audio_verbs=[self.play_audio] ) - + def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = 'https://audio.url/audio1.wav' - else: - expected = 'https://audio.url/audio1.wav' + expected = 'https://audio.url/audio1.wav' assert(expected == self.gather.to_bxml()) - + def test_add_verb(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = 'https://audio.url/audio1.wavHello. Your number is <say-as interpret-as="telephone">asdf</say-as>, lets play a game. What is 10 + 3. Press the pound key when finished.' - else: - expected = 'https://audio.url/audio1.wavHello. Your number is <say-as interpret-as="telephone">asdf</say-as>, lets play a game. What is 10 + 3. Press the pound key when finished.' + expected = 'https://audio.url/audio1.wavHello. Your number is <say-as interpret-as="telephone">asdf</say-as>, lets play a game. What is 10 + 3. Press the pound key when finished.' self.gather.add_verb(self.speak_sentence) assert(expected == self.gather.to_bxml()) diff --git a/test/unit/bxml/test_phone_number.py b/test/unit/bxml/test_phone_number.py index 35c6b65b..fd79672c 100644 --- a/test/unit/bxml/test_phone_number.py +++ b/test/unit/bxml/test_phone_number.py @@ -14,7 +14,7 @@ class TestPhoneNumber(unittest.TestCase): - + def setUp(self): self.phone_number = PhoneNumber( number="+19195551234", @@ -23,15 +23,11 @@ def setUp(self): tag="" ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = '+19195551234' - else: - expected = '+19195551234' - + expected = '+19195551234' assert(expected == self.phone_number.to_bxml()) - + def test_add_verb(self): with pytest.raises(AttributeError): self.phone_number.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_play_audio.py b/test/unit/bxml/test_play_audio.py index 7077f44e..6c3af214 100644 --- a/test/unit/bxml/test_play_audio.py +++ b/test/unit/bxml/test_play_audio.py @@ -13,7 +13,7 @@ from bandwidth.model.bxml.verbs import PlayAudio class TestPlayAudio(unittest.TestCase): - + def setUp(self): self.play_audio = PlayAudio( audio_uri="https://audio.url/audio1.wav", @@ -22,14 +22,11 @@ def setUp(self): ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = 'https://audio.url/audio1.wav' - else: - expected = 'https://audio.url/audio1.wav' + expected = 'https://audio.url/audio1.wav' assert(expected == self.play_audio.to_bxml()) - + def test_add_verb(self): with pytest.raises(AttributeError): self.play_audio.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_ring.py b/test/unit/bxml/test_ring.py index 2ce75767..cdf34063 100644 --- a/test/unit/bxml/test_ring.py +++ b/test/unit/bxml/test_ring.py @@ -14,22 +14,18 @@ class TestRing(unittest.TestCase): - + def setUp(self): self.ring = Ring( duration="30", answer_call="true", ) self.test_verb = Verb(tag="test") - + def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = '' - else: - expected = '' - + expected = '' assert(expected == self.ring.to_bxml()) - + def test_add_verb(self): with pytest.raises(AttributeError): self.ring.add_verb(self.test_verb) diff --git a/test/unit/bxml/test_sip_uri.py b/test/unit/bxml/test_sip_uri.py index 4a668012..d41195c6 100644 --- a/test/unit/bxml/test_sip_uri.py +++ b/test/unit/bxml/test_sip_uri.py @@ -26,10 +26,7 @@ def setUp(self): self.test_verb = Verb(tag="test") def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = 'sip:1-999-123-4567@voip-provider.example.net' - else: - expected = 'sip:1-999-123-4567@voip-provider.example.net' + expected = 'sip:1-999-123-4567@voip-provider.example.net' assert(expected == self.sip_uri.to_bxml()) def test_add_verb(self): diff --git a/test/unit/bxml/test_start_gather.py b/test/unit/bxml/test_start_gather.py index ae9235ef..fb1be52c 100644 --- a/test/unit/bxml/test_start_gather.py +++ b/test/unit/bxml/test_start_gather.py @@ -26,11 +26,7 @@ def setUp(self): self.test_verb = Verb(tag="test") def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = '' - else: - expected = '' - + expected = '' assert(expected == self.start_gather.to_bxml()) def test_add_verb(self): diff --git a/test/unit/bxml/test_start_recording.py b/test/unit/bxml/test_start_recording.py index b80f9a56..c05d4163 100644 --- a/test/unit/bxml/test_start_recording.py +++ b/test/unit/bxml/test_start_recording.py @@ -32,11 +32,7 @@ def setUp(self): def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = '' - else: - expected = '' - + expected = '' assert(expected == self.start_recording.to_bxml()) diff --git a/test/unit/bxml/test_start_stream.py b/test/unit/bxml/test_start_stream.py index 912832d4..d7eea6b4 100644 --- a/test/unit/bxml/test_start_stream.py +++ b/test/unit/bxml/test_start_stream.py @@ -12,7 +12,7 @@ from bandwidth.model.bxml.verbs import StartStream, StreamParam class TestStartStream(unittest.TestCase): - + def setUp(self): self.stream_param1 = StreamParam( name="name1", @@ -34,18 +34,12 @@ def setUp(self): username = "user", password = "pass" ) - + def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = '' - else: - expected = '' + expected = '' assert(expected == self.start_stream.to_bxml()) - + def test_add_verb(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = '' - else: - expected = '' + expected = '' self.start_stream.add_verb(self.stream_param2) assert(expected == self.start_stream.to_bxml()) diff --git a/test/unit/bxml/test_transfer.py b/test/unit/bxml/test_transfer.py index 56be72e4..336b1cf4 100644 --- a/test/unit/bxml/test_transfer.py +++ b/test/unit/bxml/test_transfer.py @@ -15,7 +15,7 @@ class TestTransfer(unittest.TestCase): - + def setUp(self): self.sip_uri = SipUri( uri="sip@bw.com", @@ -31,18 +31,12 @@ def setUp(self): transfer_caller_id = "+19195554321", tag = "test" ) - + def test_to_bxml(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = 'sip@bw.com' - else: - expected = 'sip@bw.com' + expected = 'sip@bw.com' assert(expected == self.transfer.to_bxml()) - + def test_add_verb(self): - if os.environ['PYTHON_VERSION'] == '3.7': - expected = 'sip@bw.com+19195551234' - else: - expected = 'sip@bw.com+19195551234' + expected = 'sip@bw.com+19195551234' self.transfer.add_transfer_recipient(self.phone_number) assert(expected == self.transfer.to_bxml()) From 2cb1777b566b5fe22802bdb040808c82bb3e2bcc Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Tue, 18 Oct 2022 15:15:54 -0400 Subject: [PATCH 10/10] Fix tests from merge conflicts --- bandwidth/model/bxml/verbs/conference.py | 4 ++-- test/unit/bxml/test_conference.py | 7 +------ test/unit/bxml/test_ring.py | 2 +- test/unit/bxml/test_start_recording.py | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/bandwidth/model/bxml/verbs/conference.py b/bandwidth/model/bxml/verbs/conference.py index eb722b7d..9fbac54c 100644 --- a/bandwidth/model/bxml/verbs/conference.py +++ b/bandwidth/model/bxml/verbs/conference.py @@ -65,13 +65,13 @@ def __init__( self.tag = tag self.callback_timeout = callback_timeout super().__init__( - tag="Conference", - content=self.name + tag="Conference" ) @property def _attributes(self): return { + "name": self.name, "mute": self.mute, "hold": self.hold, "callIdsToCoach": self.call_ids_to_coach, diff --git a/test/unit/bxml/test_conference.py b/test/unit/bxml/test_conference.py index 8d04ef03..58718b94 100644 --- a/test/unit/bxml/test_conference.py +++ b/test/unit/bxml/test_conference.py @@ -34,10 +34,5 @@ def setUp(self): self.test_verb = Verb(tag="test") def test_to_bxml(self): - expected = 'conf1https://audio.url/audio1.wav' - assert(expected == self.conference.to_bxml()) - - def test_add_verb(self): - expected = 'conf1https://audio.url/audio1.wavHello there.' - self.conference.add_verb(self.speak_sentence) + expected = '' assert(expected == self.conference.to_bxml()) diff --git a/test/unit/bxml/test_ring.py b/test/unit/bxml/test_ring.py index ff945042..1358b878 100644 --- a/test/unit/bxml/test_ring.py +++ b/test/unit/bxml/test_ring.py @@ -22,5 +22,5 @@ def setUp(self): self.test_verb = Verb(tag="test") def test_to_bxml(self): - expected = '' + expected = '' assert(expected == self.ring.to_bxml()) diff --git a/test/unit/bxml/test_start_recording.py b/test/unit/bxml/test_start_recording.py index 2369903c..88e2bd4d 100644 --- a/test/unit/bxml/test_start_recording.py +++ b/test/unit/bxml/test_start_recording.py @@ -31,5 +31,5 @@ def setUp(self): def test_to_bxml(self): - expected = '' + expected = '' assert(expected == self.start_recording.to_bxml())