diff --git a/bandwidth/voice/bxml/verbs/__init__.py b/bandwidth/voice/bxml/verbs/__init__.py index 05b5c3e2..9e153007 100644 --- a/bandwidth/voice/bxml/verbs/__init__.py +++ b/bandwidth/voice/bxml/verbs/__init__.py @@ -18,3 +18,5 @@ from .ring import Ring from .stop_gather import StopGather from .start_gather import StartGather +from .tag import Tag +from .sip_uri import SipUri diff --git a/build/lib/bandwidth/voice/bxml/verbs/phone_number.py b/bandwidth/voice/bxml/verbs/sip_uri.py similarity index 81% rename from build/lib/bandwidth/voice/bxml/verbs/phone_number.py rename to bandwidth/voice/bxml/verbs/sip_uri.py index a1b0937f..37b73361 100644 --- a/build/lib/bandwidth/voice/bxml/verbs/phone_number.py +++ b/bandwidth/voice/bxml/verbs/sip_uri.py @@ -1,7 +1,7 @@ """ -phone_number.py +sip_uri.py -Representation of Bandwidth's phone number BXML verb +Representation of Bandwidth's sip uri BXML verb @copyright Bandwidth INC """ @@ -10,19 +10,20 @@ from .base_verb import AbstractBxmlVerb -PHONE_NUMBER_TAG = "PhoneNumber" +SIP_URI_TAG = "SipUri" -class PhoneNumber(AbstractBxmlVerb): +class SipUri(AbstractBxmlVerb): - def __init__(self, number=None, transfer_answer_url=None, transfer_answer_method=None, - username=None, password=None, tag=None, transfer_disconnect_url=None, transfer_disconnect_method=None, + def __init__(self, uri=None, transfer_answer_url=None, transfer_answer_method=None, + username=None, password=None, tag=None, uui=None, + transfer_disconnect_url=None, transfer_disconnect_method=None, transfer_answer_fallback_url=None, transfer_answer_fallback_method=None, fallback_username=None, fallback_password=None): """ - Initializes the PhoneNumber class with the following parameters + Initializes the SipUri class with the following parameters - :param str number: The phone number + :param str uri: The sip uri :param str transfer_answer_url: The url to send the transfer event to :param str transfer_answer_method: The http method of the transfer event request :param str transfer_disconnect_url: The url to send the transfer disconnect event to @@ -30,17 +31,19 @@ def __init__(self, number=None, transfer_answer_url=None, transfer_answer_method :param str username: The username to authenticate on the transfer event url :param str password: The password to authenticate on the transfer event url :param str tag: Custom string sent in the callback + :param str uui: The value of the `User-To-User` header to send within the initial `INVITE` :param str transfer_answer_fallback_url: URL for fallback events :param str transfer_answer_fallback_method: HTTP method for fallback events :param str fallback_username: Basic auth username for fallback events :param str fallback_password: Basic auth password for fallback events """ - self.number = number + self.uri = uri self.transfer_answer_url = transfer_answer_url self.transfer_answer_method = transfer_answer_method self.username = username self.password = password self.tag = tag + self.uui = uui self.transfer_disconnect_method = transfer_disconnect_method self.transfer_disconnect_url = transfer_disconnect_url self.transfer_answer_fallback_url = transfer_answer_fallback_url @@ -54,9 +57,9 @@ def to_etree_element(self): :return etree.Element: The etree Element representing this class """ - root = etree.Element(PHONE_NUMBER_TAG) - if self.number is not None: - root.text = self.number + root = etree.Element(SIP_URI_TAG) + if self.uri is not None: + root.text = self.uri if self.transfer_answer_url is not None: root.set("transferAnswerUrl", self.transfer_answer_url) if self.transfer_answer_method is not None: @@ -67,6 +70,8 @@ def to_etree_element(self): root.set("password", self.password) if self.tag is not None: root.set("tag", self.tag) + if self.uui is not None: + root.set("uui", self.uui) if self.transfer_disconnect_method is not None: root.set("transferDisconnectMethod", self.transfer_disconnect_method) if self.transfer_disconnect_url is not None: diff --git a/bandwidth/voice/bxml/verbs/tag.py b/bandwidth/voice/bxml/verbs/tag.py new file mode 100644 index 00000000..06fcd28c --- /dev/null +++ b/bandwidth/voice/bxml/verbs/tag.py @@ -0,0 +1,38 @@ +""" +play_audio.py + +Representation of Bandwidth's play audio BXML verb + +@copyright Bandwidth INC +""" + +from lxml import etree + +from .base_verb import AbstractBxmlVerb + +TAG_TAG = "Tag" + + +class Tag(AbstractBxmlVerb): + + def __init__(self, tag=None): + """ + Initializes the Tag class with the following parameters + + :param str tag: The tag to set the call to + """ + self.tag = tag + + def to_etree_element(self): + """ + Converts the class into an etree element. Used for other verb classes to build xml + + :return etree.Element: The etree Element representing this class + """ + root = etree.Element(TAG_TAG) + if self.tag is not None: + root.text = self.tag + return root + + def to_bxml(self): + return etree.tostring(self.to_etree_element()).decode() diff --git a/bandwidth/voice/bxml/verbs/transfer.py b/bandwidth/voice/bxml/verbs/transfer.py index be71c450..be67fd10 100644 --- a/bandwidth/voice/bxml/verbs/transfer.py +++ b/bandwidth/voice/bxml/verbs/transfer.py @@ -17,7 +17,7 @@ class Transfer(AbstractBxmlVerb): def __init__(self, transfer_caller_id=None, call_timeout=None, tag=None, transfer_complete_url=None, transfer_complete_method=None, username=None, password=None, diversion_treatment=None, - diversion_reason=None, phone_numbers=None, + diversion_reason=None, phone_numbers=None, sip_uris=None, transfer_complete_fallback_url=None, transfer_complete_fallback_method=None, fallback_username=None, fallback_password=None): """ @@ -33,6 +33,7 @@ def __init__(self, transfer_caller_id=None, call_timeout=None, tag=None, transfe :param str diversion_treatment: The diversion treatment for the call :param str diversion_reason: The diversion reason for the call :param list phone_numbers: The numbers to receive the transferred call + :param list sip_uris: The sip uris to receive the transferred call :param str transfer_complete_fallback_url: URL for fallback events :param str transfer_complete_fallback_method: HTTP method for fallback events :param str fallback_username: Basic auth username for fallback events @@ -48,6 +49,7 @@ def __init__(self, transfer_caller_id=None, call_timeout=None, tag=None, transfe self.diversion_treatment = diversion_treatment self.diversion_reason = diversion_reason self.phone_numbers = phone_numbers + self.sip_uris = sip_uris self.transfer_complete_fallback_url = transfer_complete_fallback_url self.transfer_complete_fallback_method = transfer_complete_fallback_method self.fallback_username = fallback_username @@ -84,4 +86,7 @@ def to_bxml(self): if self.phone_numbers is not None: for phone_number in self.phone_numbers: root.append(phone_number.to_etree_element()) + if self.sip_uris is not None: + for sip_uri in self.sip_uris: + root.append(sip_uri.to_etree_element()) return etree.tostring(root).decode() diff --git a/bandwidth_sdk.egg-info/PKG-INFO b/bandwidth_sdk.egg-info/PKG-INFO deleted file mode 100644 index 483f7257..00000000 --- a/bandwidth_sdk.egg-info/PKG-INFO +++ /dev/null @@ -1,11 +0,0 @@ -Metadata-Version: 2.1 -Name: bandwidth-sdk -Version: 6.13.2 -Summary: Bandwidth's set of APIs -Home-page: https://apimatic.io -Author: APIMatic SDK Generator -Author-email: support@apimatic.io -License: UNKNOWN -Description: UNKNOWN -Platform: UNKNOWN -Description-Content-Type: text/markdown diff --git a/bandwidth_sdk.egg-info/SOURCES.txt b/bandwidth_sdk.egg-info/SOURCES.txt deleted file mode 100644 index ea2a8feb..00000000 --- a/bandwidth_sdk.egg-info/SOURCES.txt +++ /dev/null @@ -1,139 +0,0 @@ -LICENSE -MANIFEST.in -README.md -setup.py -bandwidth/__init__.py -bandwidth/api_helper.py -bandwidth/bandwidth_client.py -bandwidth/configuration.py -bandwidth/decorators.py -bandwidth/controllers/__init__.py -bandwidth/controllers/base_controller.py -bandwidth/exceptions/__init__.py -bandwidth/exceptions/api_exception.py -bandwidth/http/__init__.py -bandwidth/http/api_response.py -bandwidth/http/http_call_back.py -bandwidth/http/http_client.py -bandwidth/http/http_method_enum.py -bandwidth/http/http_request.py -bandwidth/http/http_response.py -bandwidth/http/requests_client.py -bandwidth/http/auth/__init__.py -bandwidth/http/auth/messaging_basic_auth.py -bandwidth/http/auth/two_factor_auth_basic_auth.py -bandwidth/http/auth/voice_basic_auth.py -bandwidth/http/auth/web_rtc_basic_auth.py -bandwidth/messaging/__init__.py -bandwidth/messaging/messaging_client.py -bandwidth/messaging/controllers/__init__.py -bandwidth/messaging/controllers/api_controller.py -bandwidth/messaging/controllers/base_controller.py -bandwidth/messaging/exceptions/__init__.py -bandwidth/messaging/exceptions/messaging_exception.py -bandwidth/messaging/models/__init__.py -bandwidth/messaging/models/bandwidth_callback_message.py -bandwidth/messaging/models/bandwidth_message.py -bandwidth/messaging/models/deferred_result.py -bandwidth/messaging/models/media.py -bandwidth/messaging/models/message_request.py -bandwidth/messaging/models/tag.py -bandwidth/models/__init__.py -bandwidth/twofactorauth/__init__.py -bandwidth/twofactorauth/two_factor_auth_client.py -bandwidth/twofactorauth/controllers/__init__.py -bandwidth/twofactorauth/controllers/api_controller.py -bandwidth/twofactorauth/controllers/base_controller.py -bandwidth/twofactorauth/exceptions/__init__.py -bandwidth/twofactorauth/exceptions/invalid_request_exception.py -bandwidth/twofactorauth/models/__init__.py -bandwidth/twofactorauth/models/two_factor_code_request_schema.py -bandwidth/twofactorauth/models/two_factor_messaging_response.py -bandwidth/twofactorauth/models/two_factor_verify_code_response.py -bandwidth/twofactorauth/models/two_factor_verify_request_schema.py -bandwidth/twofactorauth/models/two_factor_voice_response.py -bandwidth/utilities/__init__.py -bandwidth/utilities/file_wrapper.py -bandwidth/voice/__init__.py -bandwidth/voice/voice_client.py -bandwidth/voice/bxml/__init__.py -bandwidth/voice/bxml/response.py -bandwidth/voice/bxml/verbs/__init__.py -bandwidth/voice/bxml/verbs/base_verb.py -bandwidth/voice/bxml/verbs/bridge.py -bandwidth/voice/bxml/verbs/conference.py -bandwidth/voice/bxml/verbs/forward.py -bandwidth/voice/bxml/verbs/gather.py -bandwidth/voice/bxml/verbs/hangup.py -bandwidth/voice/bxml/verbs/pause.py -bandwidth/voice/bxml/verbs/pause_recording.py -bandwidth/voice/bxml/verbs/phone_number.py -bandwidth/voice/bxml/verbs/play_audio.py -bandwidth/voice/bxml/verbs/record.py -bandwidth/voice/bxml/verbs/redirect.py -bandwidth/voice/bxml/verbs/resume_recording.py -bandwidth/voice/bxml/verbs/ring.py -bandwidth/voice/bxml/verbs/send_dtmf.py -bandwidth/voice/bxml/verbs/speak_sentence.py -bandwidth/voice/bxml/verbs/start_gather.py -bandwidth/voice/bxml/verbs/start_recording.py -bandwidth/voice/bxml/verbs/stop_gather.py -bandwidth/voice/bxml/verbs/stop_recording.py -bandwidth/voice/bxml/verbs/transfer.py -bandwidth/voice/controllers/__init__.py -bandwidth/voice/controllers/api_controller.py -bandwidth/voice/controllers/base_controller.py -bandwidth/voice/exceptions/__init__.py -bandwidth/voice/exceptions/api_error_response_exception.py -bandwidth/voice/models/__init__.py -bandwidth/voice/models/answer_fallback_method_enum.py -bandwidth/voice/models/answer_method_enum.py -bandwidth/voice/models/api_call_response.py -bandwidth/voice/models/api_call_state_response.py -bandwidth/voice/models/api_create_call_request.py -bandwidth/voice/models/api_modify_call_request.py -bandwidth/voice/models/api_transcribe_recording_request.py -bandwidth/voice/models/call_engine_modify_conference_request.py -bandwidth/voice/models/callback_method_enum.py -bandwidth/voice/models/conference_detail.py -bandwidth/voice/models/conference_event_method_enum.py -bandwidth/voice/models/conference_member_detail.py -bandwidth/voice/models/conference_recording_metadata_response.py -bandwidth/voice/models/direction_enum.py -bandwidth/voice/models/disconnect_cause_enum.py -bandwidth/voice/models/disconnect_method_enum.py -bandwidth/voice/models/file_format_enum.py -bandwidth/voice/models/modify_call_recording_state.py -bandwidth/voice/models/recording_metadata_response.py -bandwidth/voice/models/redirect_fallback_method_enum.py -bandwidth/voice/models/redirect_method_enum.py -bandwidth/voice/models/state_1_enum.py -bandwidth/voice/models/state_2_enum.py -bandwidth/voice/models/state_enum.py -bandwidth/voice/models/status_1_enum.py -bandwidth/voice/models/status_3_enum.py -bandwidth/voice/models/status_enum.py -bandwidth/voice/models/transcript.py -bandwidth/voice/models/transcription.py -bandwidth/voice/models/transcription_response.py -bandwidth/webrtc/__init__.py -bandwidth/webrtc/web_rtc_client.py -bandwidth/webrtc/controllers/__init__.py -bandwidth/webrtc/controllers/api_controller.py -bandwidth/webrtc/controllers/base_controller.py -bandwidth/webrtc/exceptions/__init__.py -bandwidth/webrtc/exceptions/error_exception.py -bandwidth/webrtc/models/__init__.py -bandwidth/webrtc/models/accounts_participants_response.py -bandwidth/webrtc/models/participant.py -bandwidth/webrtc/models/participant_subscription.py -bandwidth/webrtc/models/publish_permission_enum.py -bandwidth/webrtc/models/session.py -bandwidth/webrtc/models/subscriptions.py -bandwidth/webrtc/utils/__init__.py -bandwidth/webrtc/utils/transfer_util.py -bandwidth_sdk.egg-info/PKG-INFO -bandwidth_sdk.egg-info/SOURCES.txt -bandwidth_sdk.egg-info/dependency_links.txt -bandwidth_sdk.egg-info/requires.txt -bandwidth_sdk.egg-info/top_level.txt \ No newline at end of file diff --git a/bandwidth_sdk.egg-info/dependency_links.txt b/bandwidth_sdk.egg-info/dependency_links.txt deleted file mode 100644 index 8b137891..00000000 --- a/bandwidth_sdk.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/bandwidth_sdk.egg-info/requires.txt b/bandwidth_sdk.egg-info/requires.txt deleted file mode 100644 index b53c4d89..00000000 --- a/bandwidth_sdk.egg-info/requires.txt +++ /dev/null @@ -1,6 +0,0 @@ -requests<3.0,>=2.9.1 -jsonpickle<1.0,>=0.7.1 -cachecontrol<1.0,>=0.11.7 -python-dateutil<3.0,>=2.5.3 -enum34>=1.1.6 -lxml>=4.3.4 diff --git a/bandwidth_sdk.egg-info/top_level.txt b/bandwidth_sdk.egg-info/top_level.txt deleted file mode 100644 index 985310a9..00000000 --- a/bandwidth_sdk.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -bandwidth diff --git a/build/lib/bandwidth/__init__.py b/build/lib/bandwidth/__init__.py deleted file mode 100644 index cdb0db88..00000000 --- a/build/lib/bandwidth/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -__all__ = [ - 'api_helper', - 'bandwidth_client', - 'configuration', - 'controllers', - 'decorators', - 'exceptions', - 'http', - 'models', -] diff --git a/build/lib/bandwidth/api_helper.py b/build/lib/bandwidth/api_helper.py deleted file mode 100644 index 023805ca..00000000 --- a/build/lib/bandwidth/api_helper.py +++ /dev/null @@ -1,414 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -import re -import sys -import datetime -import calendar -import email.utils as eut -from time import mktime - -import jsonpickle -import dateutil.parser -from requests.utils import quote - - -class APIHelper(object): - - """A Helper Class for various functions associated with API Calls. - - This class contains static methods for operations that need to be - performed during API requests. All of the methods inside this class are - static methods, there is no need to ever initialise an instance of this - class. - - """ - - @staticmethod - def merge_dicts(dict1, dict2): - """Merges two dictionaries into one as a shallow copy. - - Args: - dict1 (dict): The first dictionary. - dict2 (dict): The second dictionary. - - Returns: - dict: A dictionary containing key value pairs - from both the argument dictionaries. In the case - of a key conflict, values from dict2 are used - and those from dict1 are lost. - - """ - temp = dict1.copy() - temp.update(dict2) - return temp - - @staticmethod - def json_serialize(obj): - """JSON Serialization of a given object. - - Args: - obj (object): The object to serialize. - - Returns: - str: The JSON serialized string of the object. - - """ - if obj is None: - return None - - # Resolve any Names if it's one of our objects that needs to have this called on - if isinstance(obj, list): - value = list() - for item in obj: - if hasattr(item, "_names"): - value.append(APIHelper.to_dictionary(item)) - else: - value.append(item) - obj = value - else: - if hasattr(obj, "_names"): - obj = APIHelper.to_dictionary(obj) - - return jsonpickle.encode(obj, False) - - @staticmethod - def json_deserialize(json, unboxing_function=None): - """JSON Deserialization of a given string. - - Args: - json (str): The JSON serialized string to deserialize. - - Returns: - dict: A dictionary representing the data contained in the - JSON serialized string. - - """ - if json is None: - return None - - try: - decoded = jsonpickle.decode(json) - except ValueError: - return json - - if unboxing_function is None: - return decoded - elif isinstance(decoded, list): - return [unboxing_function(element) for element in decoded] - else: - return unboxing_function(decoded) - - @staticmethod - def serialize_array(key, array, formatting="indexed"): - """Converts an array parameter to a list of key value tuples. - - Args: - key (str): The name of the parameter. - array (list): The value of the parameter. - formatting (str): The type of key formatting expected. - - Returns: - list: A list with key value tuples for the array elements. - - """ - tuples = [] - - if sys.version_info[0] < 3: - serializable_types = (str, int, long, float, bool, datetime.date, APIHelper.CustomDate) - else: - serializable_types = (str, int, float, bool, datetime.date, APIHelper.CustomDate) - - if isinstance(array[0], serializable_types): - if formatting == "unindexed": - tuples += [("{0}[]".format(key), element) for element in array] - elif formatting == "indexed": - tuples += [("{0}[{1}]".format(key, index), element) for index, element in enumerate(array)] - elif formatting == "plain": - tuples += [(key, element) for element in array] - else: - raise ValueError("Invalid format provided.") - else: - tuples += [("{0}[{1}]".format(key, index), element) for index, element in enumerate(array)] - - return tuples - - @staticmethod - def append_url_with_template_parameters(url, parameters): - """Replaces template parameters in the given url. - - Args: - url (str): The query url string to replace the template parameters. - parameters (dict): The parameters to replace in the url. - - Returns: - str: URL with replaced parameters. - - """ - # Parameter validation - if url is None: - raise ValueError("URL is None.") - if parameters is None: - return url - - # Iterate and replace parameters - for key in parameters: - value = parameters[key]['value'] - encode = parameters[key]['encode'] - replace_value = '' - - # Load parameter value - if value is None: - replace_value = '' - elif isinstance(value, list): - replace_value = "/".join((quote(str(x), safe='') if encode else str(x)) for x in value) - else: - replace_value = quote(str(value), safe='') if encode else str(value) - - url = url.replace('{{{0}}}'.format(key), str(replace_value)) - - return url - - @staticmethod - def append_url_with_query_parameters(url, - parameters, - array_serialization="indexed"): - """Adds query parameters to a URL. - - Args: - url (str): The URL string. - parameters (dict): The query parameters to add to the URL. - array_serialization (str): The format of array parameter serialization. - - Returns: - str: URL with added query parameters. - - """ - # Parameter validation - if url is None: - raise ValueError("URL is None.") - if parameters is None: - return url - - for key, value in parameters.items(): - seperator = '&' if '?' in url else '?' - if value is not None: - if isinstance(value, list): - value = [element for element in value if element] - if array_serialization == "csv": - url += "{0}{1}={2}".format( - seperator, - key, - ",".join(quote(str(x), safe='') for x in value) - ) - elif array_serialization == "psv": - url += "{0}{1}={2}".format( - seperator, - key, - "|".join(quote(str(x), safe='') for x in value) - ) - elif array_serialization == "tsv": - url += "{0}{1}={2}".format( - seperator, - key, - "\t".join(quote(str(x), safe='') for x in value) - ) - else: - url += "{0}{1}".format( - seperator, - "&".join(("{0}={1}".format(k, quote(str(v), safe=''))) - for k, v in APIHelper.serialize_array(key, value, array_serialization)) - ) - else: - url += "{0}{1}={2}".format(seperator, key, quote(str(value), safe='')) - - return url - - @staticmethod - def clean_url(url): - """Validates and processes the given query Url to clean empty slashes. - - Args: - url (str): The given query Url to process. - - Returns: - str: Clean Url as string. - - """ - # Ensure that the urls are absolute - regex = "^https?://[^/]+" - match = re.match(regex, url) - if match is None: - raise ValueError('Invalid Url format.') - - protocol = match.group(0) - index = url.find('?') - query_url = url[len(protocol): index if index != -1 else None] - query_url = re.sub("//+", "/", query_url) - parameters = url[index:] if index != -1 else "" - - return protocol + query_url + parameters - - @staticmethod - def form_encode_parameters(form_parameters, - array_serialization="indexed"): - """Form encodes a dictionary of form parameters - - Args: - form_parameters (dictionary): The given dictionary which has - atleast one model to form encode. - array_serialization (str): The format of array parameter serialization. - - Returns: - dict: A dictionary of form encoded properties of the model. - - """ - encoded = [] - - for key, value in form_parameters.items(): - encoded += APIHelper.form_encode(value, key, array_serialization) - - return encoded - - @staticmethod - def form_encode(obj, - instance_name, - array_serialization="indexed"): - """Encodes a model in a form-encoded manner such as person[Name] - - Args: - obj (object): The given Object to form encode. - instance_name (string): The base name to appear before each entry - for this object. - array_serialization (string): The format of array parameter serialization. - - Returns: - dict: A dictionary of form encoded properties of the model. - - """ - retval = [] - # If we received an object, resolve it's field names. - if hasattr(obj, "_names"): - obj = APIHelper.to_dictionary(obj) - - if obj is None: - return [] - elif isinstance(obj, list): - for element in APIHelper.serialize_array(instance_name, obj, array_serialization): - retval += APIHelper.form_encode(element[1], element[0], array_serialization) - elif isinstance(obj, dict): - for item in obj: - retval += APIHelper.form_encode(obj[item], instance_name + "[" + item + "]", array_serialization) - else: - retval.append((instance_name, obj)) - - return retval - - @staticmethod - def to_dictionary(obj): - """Creates a dictionary representation of a class instance. The - keys are taken from the API description and may differ from language - specific variable names of properties. - - Args: - obj: The object to be converted into a dictionary. - - Returns: - dictionary: A dictionary form of the model with properties in - their API formats. - - """ - dictionary = dict() - - # Loop through all properties in this model - for name in {k: v for k, v in obj.__dict__.items() if v is not None}: - value = getattr(obj, name) - if isinstance(value, list): - # Loop through each item - dictionary[obj._names[name]] = list() - for item in value: - dictionary[obj._names[name]].append(APIHelper.to_dictionary(item) if hasattr(item, "_names") else item) - elif isinstance(value, dict): - # Loop through each item - dictionary[obj._names[name]] = dict() - for key in value: - dictionary[obj._names[name]][key] = APIHelper.to_dictionary(value[key]) if hasattr(value[key], "_names") else value[key] - else: - dictionary[obj._names[name]] = APIHelper.to_dictionary(value) if hasattr(value, "_names") else value - - # Return the result - return dictionary - - @staticmethod - def when_defined(func, value): - return func(value) if value else None - - class CustomDate(object): - - """ A base class for wrapper classes of datetime. - - This class contains methods which help in - appropriate serialization of datetime objects. - - """ - - def __init__(self, dtime, value=None): - self.datetime = dtime - if not value: - self.value = self.from_datetime(dtime) - else: - self.value = value - - def __repr__(self): - return str(self.value) - - def __getstate__(self): - return self.value - - def __setstate__(self, state): - pass - - class HttpDateTime(CustomDate): - - """ A wrapper class for datetime to support HTTP date format.""" - - @classmethod - def from_datetime(cls, date_time): - return eut.formatdate(timeval=mktime(date_time.timetuple()), - localtime=False, usegmt=True) - - @classmethod - def from_value(cls, value): - dtime = datetime.datetime.fromtimestamp(eut.mktime_tz(eut.parsedate_tz(value))) - return cls(dtime, value) - - class UnixDateTime(CustomDate): - - """ A wrapper class for datetime to support Unix date format.""" - - @classmethod - def from_datetime(cls, date_time): - return calendar.timegm(date_time.utctimetuple()) - - @classmethod - def from_value(cls, value): - dtime = datetime.datetime.utcfromtimestamp(float(value)) - return cls(dtime, float(value)) - - class RFC3339DateTime(CustomDate): - - """ A wrapper class for datetime to support Rfc 3339 format.""" - - @classmethod - def from_datetime(cls, date_time): - return date_time.isoformat() - - @classmethod - def from_value(cls, value): - dtime = dateutil.parser.parse(value) - return cls(dtime, value) diff --git a/build/lib/bandwidth/bandwidth_client.py b/build/lib/bandwidth/bandwidth_client.py deleted file mode 100644 index ab40fdca..00000000 --- a/build/lib/bandwidth/bandwidth_client.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.decorators import lazy_property -from bandwidth.configuration import Configuration -from bandwidth.configuration import Environment -from bandwidth.messaging.messaging_client import MessagingClient -from bandwidth.twofactorauth.two_factor_auth_client import TwoFactorAuthClient -from bandwidth.voice.voice_client import VoiceClient -from bandwidth.webrtc.web_rtc_client import WebRtcClient - - -class BandwidthClient(object): - - @lazy_property - def messaging_client(self): - return MessagingClient(config=self.config) - - @lazy_property - def two_factor_auth_client(self): - return TwoFactorAuthClient(config=self.config) - - @lazy_property - def voice_client(self): - return VoiceClient(config=self.config) - - @lazy_property - def web_rtc_client(self): - return WebRtcClient(config=self.config) - - def __init__(self, timeout=60, max_retries=3, backoff_factor=0, - environment=Environment.PRODUCTION, - base_url='https://www.example.com', - messaging_basic_auth_user_name='TODO: Replace', - messaging_basic_auth_password='TODO: Replace', - two_factor_auth_basic_auth_user_name='TODO: Replace', - two_factor_auth_basic_auth_password='TODO: Replace', - voice_basic_auth_user_name='TODO: Replace', - voice_basic_auth_password='TODO: Replace', - web_rtc_basic_auth_user_name='TODO: Replace', - web_rtc_basic_auth_password='TODO: Replace', config=None): - if config is None: - self.config = Configuration(timeout=timeout, - max_retries=max_retries, - backoff_factor=backoff_factor, - environment=environment, - base_url=base_url, - messaging_basic_auth_user_name=messaging_basic_auth_user_name, - messaging_basic_auth_password=messaging_basic_auth_password, - two_factor_auth_basic_auth_user_name=two_factor_auth_basic_auth_user_name, - two_factor_auth_basic_auth_password=two_factor_auth_basic_auth_password, - voice_basic_auth_user_name=voice_basic_auth_user_name, - voice_basic_auth_password=voice_basic_auth_password, - web_rtc_basic_auth_user_name=web_rtc_basic_auth_user_name, - web_rtc_basic_auth_password=web_rtc_basic_auth_password) - else: - self.config = config diff --git a/build/lib/bandwidth/configuration.py b/build/lib/bandwidth/configuration.py deleted file mode 100644 index 4c6253c1..00000000 --- a/build/lib/bandwidth/configuration.py +++ /dev/null @@ -1,222 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from enum import Enum -from bandwidth.api_helper import APIHelper -from bandwidth.http.requests_client import RequestsClient - - -class Environment(Enum): - """An enum for SDK environments""" - PRODUCTION = 0 - CUSTOM = 1 - - -class Server(Enum): - """An enum for API servers""" - DEFAULT = 0 - MESSAGINGDEFAULT = 1 - TWOFACTORAUTHDEFAULT = 2 - VOICEDEFAULT = 3 - WEBRTCDEFAULT = 4 - - -class Configuration(object): - """A class used for configuring the SDK by a user. - """ - - @property - def http_client(self): - return self._http_client - - @property - def timeout(self): - return self._timeout - - @property - def max_retries(self): - return self._max_retries - - @property - def backoff_factor(self): - return self._backoff_factor - - @property - def environment(self): - return self._environment - - @property - def base_url(self): - return self._base_url - - @property - def messaging_basic_auth_user_name(self): - return self._messaging_basic_auth_user_name - - @property - def messaging_basic_auth_password(self): - return self._messaging_basic_auth_password - - @property - def two_factor_auth_basic_auth_user_name(self): - return self._two_factor_auth_basic_auth_user_name - - @property - def two_factor_auth_basic_auth_password(self): - return self._two_factor_auth_basic_auth_password - - @property - def voice_basic_auth_user_name(self): - return self._voice_basic_auth_user_name - - @property - def voice_basic_auth_password(self): - return self._voice_basic_auth_password - - @property - def web_rtc_basic_auth_user_name(self): - return self._web_rtc_basic_auth_user_name - - @property - def web_rtc_basic_auth_password(self): - return self._web_rtc_basic_auth_password - - def __init__(self, timeout=60, max_retries=3, backoff_factor=0, - environment=Environment.PRODUCTION, - base_url='https://www.example.com', - messaging_basic_auth_user_name='TODO: Replace', - messaging_basic_auth_password='TODO: Replace', - two_factor_auth_basic_auth_user_name='TODO: Replace', - two_factor_auth_basic_auth_password='TODO: Replace', - voice_basic_auth_user_name='TODO: Replace', - voice_basic_auth_password='TODO: Replace', - web_rtc_basic_auth_user_name='TODO: Replace', - web_rtc_basic_auth_password='TODO: Replace'): - # The value to use for connection timeout - self._timeout = timeout - - # The number of times to retry an endpoint call if it fails - self._max_retries = max_retries - - # A backoff factor to apply between attempts after the second try. - # urllib3 will sleep for: - # `{backoff factor} * (2 ** ({number of total retries} - 1))` - self._backoff_factor = backoff_factor - - # Current API environment - self._environment = environment - - # base_url value - self._base_url = base_url - - # The username to use with basic authentication - self._messaging_basic_auth_user_name = messaging_basic_auth_user_name - - # The password to use with basic authentication - self._messaging_basic_auth_password = messaging_basic_auth_password - - # The username to use with basic authentication - self._two_factor_auth_basic_auth_user_name = two_factor_auth_basic_auth_user_name - - # The password to use with basic authentication - self._two_factor_auth_basic_auth_password = two_factor_auth_basic_auth_password - - # The username to use with basic authentication - self._voice_basic_auth_user_name = voice_basic_auth_user_name - - # The password to use with basic authentication - self._voice_basic_auth_password = voice_basic_auth_password - - # The username to use with basic authentication - self._web_rtc_basic_auth_user_name = web_rtc_basic_auth_user_name - - # The password to use with basic authentication - self._web_rtc_basic_auth_password = web_rtc_basic_auth_password - - # The Http Client to use for making requests. - self._http_client = self.create_http_client() - - def clone_with(self, timeout=None, max_retries=None, backoff_factor=None, - environment=None, base_url=None, - messaging_basic_auth_user_name=None, - messaging_basic_auth_password=None, - two_factor_auth_basic_auth_user_name=None, - two_factor_auth_basic_auth_password=None, - voice_basic_auth_user_name=None, - voice_basic_auth_password=None, - web_rtc_basic_auth_user_name=None, - web_rtc_basic_auth_password=None): - timeout = timeout or self.timeout - max_retries = max_retries or self.max_retries - backoff_factor = backoff_factor or self.backoff_factor - environment = environment or self.environment - base_url = base_url or self.base_url - messaging_basic_auth_user_name = messaging_basic_auth_user_name or self.messaging_basic_auth_user_name - messaging_basic_auth_password = messaging_basic_auth_password or self.messaging_basic_auth_password - two_factor_auth_basic_auth_user_name = two_factor_auth_basic_auth_user_name or self.two_factor_auth_basic_auth_user_name - two_factor_auth_basic_auth_password = two_factor_auth_basic_auth_password or self.two_factor_auth_basic_auth_password - voice_basic_auth_user_name = voice_basic_auth_user_name or self.voice_basic_auth_user_name - voice_basic_auth_password = voice_basic_auth_password or self.voice_basic_auth_password - web_rtc_basic_auth_user_name = web_rtc_basic_auth_user_name or self.web_rtc_basic_auth_user_name - web_rtc_basic_auth_password = web_rtc_basic_auth_password or self.web_rtc_basic_auth_password - - return Configuration( - timeout=timeout, max_retries=max_retries, - backoff_factor=backoff_factor, environment=environment, base_url=base_url, - messaging_basic_auth_user_name=messaging_basic_auth_user_name, - messaging_basic_auth_password=messaging_basic_auth_password, - two_factor_auth_basic_auth_user_name=two_factor_auth_basic_auth_user_name, - two_factor_auth_basic_auth_password=two_factor_auth_basic_auth_password, - voice_basic_auth_user_name=voice_basic_auth_user_name, - voice_basic_auth_password=voice_basic_auth_password, - web_rtc_basic_auth_user_name=web_rtc_basic_auth_user_name, - web_rtc_basic_auth_password=web_rtc_basic_auth_password - ) - - def create_http_client(self): - return RequestsClient(timeout=self.timeout, - max_retries=self.max_retries, - backoff_factor=self.backoff_factor) - - # All the environments the SDK can run in - environments = { - Environment.PRODUCTION: { - Server.DEFAULT: 'api.bandwidth.com', - Server.MESSAGINGDEFAULT: 'https://messaging.bandwidth.com/api/v2', - Server.TWOFACTORAUTHDEFAULT: 'https://mfa.bandwidth.com/api/v1/', - Server.VOICEDEFAULT: 'https://voice.bandwidth.com', - Server.WEBRTCDEFAULT: 'https://api.webrtc.bandwidth.com/v1' - }, - Environment.CUSTOM: { - Server.DEFAULT: '{base_url}', - Server.MESSAGINGDEFAULT: '{base_url}', - Server.TWOFACTORAUTHDEFAULT: '{base_url}', - Server.VOICEDEFAULT: '{base_url}', - Server.WEBRTCDEFAULT: '{base_url}' - } - } - - def get_base_uri(self, server=Server.DEFAULT): - """Generates the appropriate base URI for the environment and the - server. - - Args: - server (Configuration.Server): The server enum for which the base - URI is required. - - Returns: - String: The base URI. - - """ - parameters = { - "base_url": {'value': self.base_url, 'encode': False}, - } - - return APIHelper.append_url_with_template_parameters( - self.environments[self.environment][server], parameters - ) diff --git a/build/lib/bandwidth/controllers/__init__.py b/build/lib/bandwidth/controllers/__init__.py deleted file mode 100644 index 3d169dc3..00000000 --- a/build/lib/bandwidth/controllers/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -__all__ = [ - 'base_controller', -] diff --git a/build/lib/bandwidth/controllers/base_controller.py b/build/lib/bandwidth/controllers/base_controller.py deleted file mode 100644 index 3f7583fb..00000000 --- a/build/lib/bandwidth/controllers/base_controller.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -from bandwidth.exceptions.api_exception import APIException - - -class BaseController(object): - - """All controllers inherit from this base class. - - Attributes: - config (Configuration): The HttpClient which a specific controller - instance will use. By default all the controller objects share - the same HttpClient. A user can use his own custom HttpClient - as well. - http_call_back (HttpCallBack): An object which holds call back - methods to be called before and after the execution of an HttpRequest. - global_headers (dict): The global headers of the API which are sent with - every request. - - """ - - def global_headers(self): - return { - 'user-agent': 'python-sdk-refs/tags/python6.13.2' - } - - def __init__(self, config, call_back=None): - self._config = config - self._http_call_back = call_back - - @property - def config(self): - return self._config - - @property - def http_call_back(self): - return self._http_call_back - - def validate_parameters(self, **kwargs): - """Validates required parameters of an endpoint. - - Args: - kwargs (dict): A dictionary of the required parameters. - - """ - for name, value in kwargs.items(): - if value is None: - raise ValueError("Required parameter {} cannot be None.".format(name)) - - def execute_request(self, request, binary=False): - """Executes an HttpRequest. - - Args: - request (HttpRequest): The HttpRequest to execute. - binary (bool): A flag which should be set to True if - a binary response is expected. - - Returns: - HttpResponse: The HttpResponse received. - - """ - # Invoke the on before request HttpCallBack if specified - if self.http_call_back is not None: - self.http_call_back.on_before_request(request) - - # Add global headers to request - request.headers = APIHelper.merge_dicts(self.global_headers(), request.headers) - - # Invoke the API call to fetch the response. - func = self.config.http_client.execute_as_binary if binary else self.config.http_client.execute_as_string - response = func(request) - - # Invoke the on after response HttpCallBack if specified - if self.http_call_back is not None: - self.http_call_back.on_after_response(response) - - return response - - def validate_response(self, response): - """Validates an HTTP response by checking for global errors. - - Args: - response (HttpResponse): The HttpResponse of the API call. - - """ - if (response.status_code < 200) or (response.status_code > 208): # [200,208] = HTTP OK - raise APIException('HTTP response not OK.', response) diff --git a/build/lib/bandwidth/decorators.py b/build/lib/bandwidth/decorators.py deleted file mode 100644 index a112ab65..00000000 --- a/build/lib/bandwidth/decorators.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class lazy_property(object): - - """A decorator class for lazy instantiation.""" - - def __init__(self, fget): - self.fget = fget - self.func_name = fget.__name__ - - def __get__(self, obj, cls): - if obj is None: - return None - value = self.fget(obj) - setattr(obj, self.func_name, value) - return value diff --git a/build/lib/bandwidth/exceptions/__init__.py b/build/lib/bandwidth/exceptions/__init__.py deleted file mode 100644 index 1f4885eb..00000000 --- a/build/lib/bandwidth/exceptions/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -__all__ = [ - 'api_exception', -] diff --git a/build/lib/bandwidth/exceptions/api_exception.py b/build/lib/bandwidth/exceptions/api_exception.py deleted file mode 100644 index c778fbae..00000000 --- a/build/lib/bandwidth/exceptions/api_exception.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class APIException(Exception): - - """Class that handles HTTP Exceptions when fetching API Endpoints. - - Attributes: - response_code (int): The status code of the response. - response (HttpResponse): The HttpResponse of the API call. - - """ - - def __init__(self, - reason, - response): - """Constructor for the APIException class - - Args: - reason (string): The reason (or error message) for the Exception - to be raised. - response (HttpResponse): The HttpResponse of the API call. - - """ - super(APIException, self).__init__(reason) - self.response = response - self.response_code = response.status_code diff --git a/build/lib/bandwidth/http/__init__.py b/build/lib/bandwidth/http/__init__.py deleted file mode 100644 index 4348222a..00000000 --- a/build/lib/bandwidth/http/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -__all__ = [ - 'auth', - 'http_method_enum', - 'http_request', - 'http_response', - 'http_client', - 'requests_client', - 'http_call_back', -] diff --git a/build/lib/bandwidth/http/api_response.py b/build/lib/bandwidth/http/api_response.py deleted file mode 100644 index 77edf3a7..00000000 --- a/build/lib/bandwidth/http/api_response.py +++ /dev/null @@ -1,49 +0,0 @@ -import json - - -class ApiResponse: - - """Http response received. - - Attributes: - status_code (int): The status code response from the server that - corresponds to this response. - reason_phrase (string): The reason phrase returned by the server. - headers (dict): A dictionary of headers (key : value) that were - returned with the response - text (string): The Raw body of the HTTP Response as a string - request (HttpRequest): The request that resulted in this response. - body (Object): The data field specified for the response - errors (Array): Any errors returned by the server - - """ - - def __init__(self, http_response, - body=None, - errors=None): - - """The Constructor - - Args: - http_response (HttpResponse): The original, raw response from the api - data (Object): The data field specified for the response - errors (Array): Any errors returned by the server - - """ - - self.status_code = http_response.status_code - self.reason_phrase = http_response.reason_phrase - self.headers = http_response.headers - self.text = http_response.text - self.request = http_response.request - self.body = body - self.errors = errors - - def is_success(self): - return 200 <= self.status_code < 300 - - def is_error(self): - return 400 <= self.status_code < 600 - - def __repr__(self): - return '' % (self.text) diff --git a/build/lib/bandwidth/http/auth/__init__.py b/build/lib/bandwidth/http/auth/__init__.py deleted file mode 100644 index 8ce8edd6..00000000 --- a/build/lib/bandwidth/http/auth/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -__all__ = [ - 'messaging_basic_auth', - 'two_factor_auth_basic_auth', - 'voice_basic_auth', - 'web_rtc_basic_auth', -] diff --git a/build/lib/bandwidth/http/auth/messaging_basic_auth.py b/build/lib/bandwidth/http/auth/messaging_basic_auth.py deleted file mode 100644 index 5bd4c174..00000000 --- a/build/lib/bandwidth/http/auth/messaging_basic_auth.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -import base64 - - -class MessagingBasicAuth: - - @staticmethod - def apply(config, http_request): - """ Add basic authentication to the request. - - Args: - config (Configuration): The Configuration object which holds the - authentication information. - http_request (HttpRequest): The HttpRequest object to which - authentication will be added. - - """ - username = config.messaging_basic_auth_user_name - password = config.messaging_basic_auth_password - joined = "{}:{}".format(username, password) - encoded = base64.b64encode(str.encode(joined)).decode('iso-8859-1') - header_value = "Basic {}".format(encoded) - http_request.headers["Authorization"] = header_value diff --git a/build/lib/bandwidth/http/auth/two_factor_auth_basic_auth.py b/build/lib/bandwidth/http/auth/two_factor_auth_basic_auth.py deleted file mode 100644 index c370f3ff..00000000 --- a/build/lib/bandwidth/http/auth/two_factor_auth_basic_auth.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -import base64 - - -class TwoFactorAuthBasicAuth: - - @staticmethod - def apply(config, http_request): - """ Add basic authentication to the request. - - Args: - config (Configuration): The Configuration object which holds the - authentication information. - http_request (HttpRequest): The HttpRequest object to which - authentication will be added. - - """ - username = config.two_factor_auth_basic_auth_user_name - password = config.two_factor_auth_basic_auth_password - joined = "{}:{}".format(username, password) - encoded = base64.b64encode(str.encode(joined)).decode('iso-8859-1') - header_value = "Basic {}".format(encoded) - http_request.headers["Authorization"] = header_value diff --git a/build/lib/bandwidth/http/auth/voice_basic_auth.py b/build/lib/bandwidth/http/auth/voice_basic_auth.py deleted file mode 100644 index 514a94b0..00000000 --- a/build/lib/bandwidth/http/auth/voice_basic_auth.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -import base64 - - -class VoiceBasicAuth: - - @staticmethod - def apply(config, http_request): - """ Add basic authentication to the request. - - Args: - config (Configuration): The Configuration object which holds the - authentication information. - http_request (HttpRequest): The HttpRequest object to which - authentication will be added. - - """ - username = config.voice_basic_auth_user_name - password = config.voice_basic_auth_password - joined = "{}:{}".format(username, password) - encoded = base64.b64encode(str.encode(joined)).decode('iso-8859-1') - header_value = "Basic {}".format(encoded) - http_request.headers["Authorization"] = header_value diff --git a/build/lib/bandwidth/http/auth/web_rtc_basic_auth.py b/build/lib/bandwidth/http/auth/web_rtc_basic_auth.py deleted file mode 100644 index 0dffdbb8..00000000 --- a/build/lib/bandwidth/http/auth/web_rtc_basic_auth.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -import base64 - - -class WebRtcBasicAuth: - - @staticmethod - def apply(config, http_request): - """ Add basic authentication to the request. - - Args: - config (Configuration): The Configuration object which holds the - authentication information. - http_request (HttpRequest): The HttpRequest object to which - authentication will be added. - - """ - username = config.web_rtc_basic_auth_user_name - password = config.web_rtc_basic_auth_password - joined = "{}:{}".format(username, password) - encoded = base64.b64encode(str.encode(joined)).decode('iso-8859-1') - header_value = "Basic {}".format(encoded) - http_request.headers["Authorization"] = header_value diff --git a/build/lib/bandwidth/http/http_call_back.py b/build/lib/bandwidth/http/http_call_back.py deleted file mode 100644 index 694fd393..00000000 --- a/build/lib/bandwidth/http/http_call_back.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class HttpCallBack(object): - - """An interface for the callback to be called before and after the - HTTP call for an endpoint is made. - - This class should not be instantiated but should be used as a base class - for HttpCallBack classes. - - """ - - def on_before_request(self, - request): - """The controller will call this method before making the HttpRequest. - - Args: - request (HttpRequest): The request object which will be sent - to the HttpClient to be executed. - """ - raise NotImplementedError("This method has not been implemented.") - - def on_after_response(self, - http_response): - """The controller will call this method after making the HttpRequest. - - Args: - http_response (HttpResponse): The HttpResponse of the API call. - """ - raise NotImplementedError("This method has not been implemented.") diff --git a/build/lib/bandwidth/http/http_client.py b/build/lib/bandwidth/http/http_client.py deleted file mode 100644 index 5bec9e4f..00000000 --- a/build/lib/bandwidth/http/http_client.py +++ /dev/null @@ -1,209 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.http.http_method_enum import HttpMethodEnum -from bandwidth.http.http_request import HttpRequest - - -class HttpClient(object): - - """An interface for the methods that an HTTP Client must implement - - This class should not be instantiated but should be used as a base class - for HTTP Client classes. - - """ - - def execute_as_string(self, request): - """Execute a given HttpRequest to get a string response back - - Args: - request (HttpRequest): The given HttpRequest to execute. - - Returns: - HttpResponse: The response of the HttpRequest. - - """ - raise NotImplementedError("Please Implement this method") - - def execute_as_binary(self, request): - """Execute a given HttpRequest to get a binary response back - - Args: - request (HttpRequest): The given HttpRequest to execute. - - Returns: - HttpResponse: The response of the HttpRequest. - - """ - raise NotImplementedError("Please Implement this method") - - def convert_response(self, response, binary): - """Converts the Response object of the HttpClient into an - HttpResponse object. - - Args: - response (dynamic): The original response object. - - Returns: - HttpResponse: The converted HttpResponse object. - - """ - raise NotImplementedError("Please Implement this method") - - def get(self, query_url, - headers={}, - query_parameters={}): - """Create a simple GET HttpRequest object for the given parameters - - Args: - query_url (string): The URL to send the request to. - headers (dict, optional): The headers for the HTTP Request. - query_parameters (dict, optional): Query parameters to add in the - URL. - - Returns: - HttpRequest: The generated HttpRequest for the given paremeters. - - """ - return HttpRequest(HttpMethodEnum.GET, - query_url, - headers, - query_parameters, - None, - None) - - def head(self, query_url, - headers={}, - query_parameters={}): - """Create a simple HEAD HttpRequest object for the given parameters - - Args: - query_url (string): The URL to send the request to. - headers (dict, optional): The headers for the HTTP Request. - query_parameters (dict, optional): Query parameters to add in the - URL. - - Returns: - HttpRequest: The generated HttpRequest for the given paremeters. - - """ - return HttpRequest(HttpMethodEnum.HEAD, - query_url, - headers, - query_parameters, - None, - None) - - def post(self, query_url, - headers={}, - query_parameters={}, - parameters={}, - files={}): - """Create a simple POST HttpRequest object for the given parameters - - Args: - query_url (string): The URL to send the request to. - headers (dict, optional): The headers for the HTTP Request. - query_parameters (dict, optional): Query parameters to add in the - URL. - parameters (dict, optional): Form or body parameters to be included - in the body. - files (dict, optional): Files to be sent with the request. - - Returns: - HttpRequest: The generated HttpRequest for the given paremeters. - - """ - return HttpRequest(HttpMethodEnum.POST, - query_url, - headers, - query_parameters, - parameters, - files) - - def put(self, query_url, - headers={}, - query_parameters={}, - parameters={}, - files={}): - """Create a simple PUT HttpRequest object for the given parameters - - Args: - query_url (string): The URL to send the request to. - headers (dict, optional): The headers for the HTTP Request. - query_parameters (dict, optional): Query parameters to add in the - URL. - parameters (dict, optional): Form or body parameters to be included - in the body. - files (dict, optional): Files to be sent with the request. - - Returns: - HttpRequest: The generated HttpRequest for the given paremeters. - - """ - return HttpRequest(HttpMethodEnum.PUT, - query_url, - headers, - query_parameters, - parameters, - files) - - def patch(self, query_url, - headers={}, - query_parameters={}, - parameters={}, - files={}): - """Create a simple PATCH HttpRequest object for the given parameters - - Args: - query_url (string): The URL to send the request to. - headers (dict, optional): The headers for the HTTP Request. - query_parameters (dict, optional): Query parameters to add in the - URL. - parameters (dict, optional): Form or body parameters to be included - in the body. - files (dict, optional): Files to be sent with the request. - - Returns: - HttpRequest: The generated HttpRequest for the given paremeters. - - """ - return HttpRequest(HttpMethodEnum.PATCH, - query_url, - headers, - query_parameters, - parameters, - files) - - def delete(self, query_url, - headers={}, - query_parameters={}, - parameters={}, - files={}): - """Create a simple DELETE HttpRequest object for the given parameters - - Args: - query_url (string): The URL to send the request to. - headers (dict, optional): The headers for the HTTP Request. - query_parameters (dict, optional): Query parameters to add in the - URL. - parameters (dict, optional): Form or body parameters to be - included in the body. - files (dict, optional): Files to be sent with the request. - - Returns: - HttpRequest: The generated HttpRequest for the given paremeters. - - """ - return HttpRequest(HttpMethodEnum.DELETE, - query_url, - headers, - query_parameters, - parameters, - files) diff --git a/build/lib/bandwidth/http/http_method_enum.py b/build/lib/bandwidth/http/http_method_enum.py deleted file mode 100644 index 83cfbd59..00000000 --- a/build/lib/bandwidth/http/http_method_enum.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class HttpMethodEnum(object): - - """Enumeration of an HTTP Method - - Attributes: - GET: A GET Request - POST: A POST Request - PUT: A PUT Request - PATCH: A PATCH Request - DELETE: A DELETE Request - - """ - - GET = "GET" - - POST = "POST" - - PUT = "PUT" - - PATCH = "PATCH" - - DELETE = "DELETE" - - HEAD = "HEAD" - - @classmethod - def to_string(cls, val): - """Returns the string equivalent for the Enum. - - """ - for k, v in list(vars(cls).items()): - if v == val: - return k - - @classmethod - def from_string(cls, str): - """Creates an instance of the Enum from a given string. - - """ - return getattr(cls, str.upper(), None) diff --git a/build/lib/bandwidth/http/http_request.py b/build/lib/bandwidth/http/http_request.py deleted file mode 100644 index ac1e0e5a..00000000 --- a/build/lib/bandwidth/http/http_request.py +++ /dev/null @@ -1,87 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper - - -class HttpRequest(object): - - """Information about an HTTP Request including its method, headers, - parameters, URL, and Basic Auth details - - Attributes: - http_method (HttpMethodEnum): The HTTP Method that this request should - perform when called. - headers (dict): A dictionary of headers (key : value) that should be - sent along with the request. - query_url (string): The URL that the request should be sent to. - parameters (dict): A dictionary of parameters that are to be sent along - with the request in the form body of the request - - """ - - def __init__(self, - http_method, - query_url, - headers=None, - query_parameters=None, - parameters=None, - files=None): - """Constructor for the HttpRequest class - - Args: - http_method (HttpMethodEnum): The HTTP Method. - query_url (string): The URL to send the request to. - headers (dict, optional): The headers for the HTTP Request. - query_parameters (dict, optional): Query parameters to add in the - URL. - parameters (dict, optional): Form or body parameters to be included - in the body. - files (dict, optional): Files to be sent with the request. - - """ - self.http_method = http_method - self.query_url = query_url - self.headers = headers - self.query_parameters = query_parameters - self.parameters = parameters - self.files = files - - def add_header(self, name, value): - """ Add a header to the HttpRequest. - - Args: - name (string): The name of the header. - value (string): The value of the header. - - """ - self.headers[name] = value - - def add_parameter(self, name, value): - """ Add a parameter to the HttpRequest. - - Args: - name (string): The name of the parameter. - value (string): The value of the parameter. - - """ - self.parameters[name] = value - - def add_query_parameter(self, name, value): - """ Add a query parameter to the HttpRequest. - - Args: - name (string): The name of the query parameter. - value (string): The value of the query parameter. - - """ - self.query_url = APIHelper.append_url_with_query_parameters( - self.query_url, - {name: value} - ) - self.query_url = APIHelper.clean_url(self.query_url) diff --git a/build/lib/bandwidth/http/http_response.py b/build/lib/bandwidth/http/http_response.py deleted file mode 100644 index 98c25bf0..00000000 --- a/build/lib/bandwidth/http/http_response.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class HttpResponse(object): - - """Information about an HTTP Response including its status code, returned - headers, and raw body - - Attributes: - status_code (int): The status code response from the server that - corresponds to this response. - reason_phrase (string): The reason phrase returned by the server. - headers (dict): A dictionary of headers (key : value) that were - returned with the response - text (string): The Raw body of the HTTP Response as a string - request (HttpRequest): The request that resulted in this response. - - """ - - def __init__(self, - status_code, - reason_phrase, - headers, - text, - request): - """Constructor for the HttpResponse class - - Args: - status_code (int): The response status code. - reason_phrase (string): The response reason phrase. - headers (dict): The response headers. - text (string): The raw body from the server. - request (HttpRequest): The request that resulted in this response. - - """ - self.status_code = status_code - self.reason_phrase = reason_phrase - self.headers = headers - self.text = text - self.request = request diff --git a/build/lib/bandwidth/http/requests_client.py b/build/lib/bandwidth/http/requests_client.py deleted file mode 100644 index 1983ecdd..00000000 --- a/build/lib/bandwidth/http/requests_client.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from cachecontrol import CacheControl -from requests import session -from requests.adapters import HTTPAdapter -from urllib3.util.retry import Retry - -from bandwidth.http.http_client import HttpClient -from bandwidth.http.http_method_enum import HttpMethodEnum -from bandwidth.http.http_response import HttpResponse - - -class RequestsClient(HttpClient): - - """An implementation of HttpClient that uses Requests as its HTTP Client - - Attributes: - timeout (int): The default timeout for all API requests. - - """ - - def __init__(self, - timeout=60, - cache=False, - max_retries=None, - backoff_factor=None, - verify=True): - """The constructor. - - Args: - timeout (float): The default global timeout(seconds). - - """ - self.timeout = timeout - self.session = session() - - retries = Retry(total=max_retries, backoff_factor=backoff_factor) - self.session.mount('http://', HTTPAdapter(max_retries=retries)) - self.session.mount('https://', HTTPAdapter(max_retries=retries)) - - if cache: - self.session = CacheControl(self.session) - - self.session.verify = verify - - def execute_as_string(self, request): - """Execute a given HttpRequest to get a string response back - - Args: - request (HttpRequest): The given HttpRequest to execute. - - Returns: - HttpResponse: The response of the HttpRequest. - - """ - response = self.session.request( - HttpMethodEnum.to_string(request.http_method), - request.query_url, - headers=request.headers, - params=request.query_parameters, - data=request.parameters, - files=request.files, - timeout=self.timeout - ) - - return self.convert_response(response, False, request) - - def execute_as_binary(self, request): - """Execute a given HttpRequest to get a binary response back - - Args: - request (HttpRequest): The given HttpRequest to execute. - - Returns: - HttpResponse: The response of the HttpRequest. - - """ - - response = self.session.request( - HttpMethodEnum.to_string(request.http_method), - request.query_url, - headers=request.headers, - params=request.query_parameters, - data=request.parameters, - files=request.files, - timeout=self.timeout - ) - - return self.convert_response(response, True, request) - - def convert_response(self, response, binary, http_request): - """Converts the Response object of the HttpClient into an - HttpResponse object. - - Args: - response (dynamic): The original response object. - http_request (HttpRequest): The original HttpRequest object. - - Returns: - HttpResponse: The converted HttpResponse object. - - """ - if binary: - return HttpResponse( - response.status_code, - response.reason, - response.headers, - response.content, - http_request - ) - else: - return HttpResponse( - response.status_code, - response.reason, - response.headers, - response.text, - http_request - ) diff --git a/build/lib/bandwidth/messaging/__init__.py b/build/lib/bandwidth/messaging/__init__.py deleted file mode 100644 index 1216246e..00000000 --- a/build/lib/bandwidth/messaging/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -__all__ = [ - 'controllers', - 'exceptions', - 'messaging_client', - 'models', -] diff --git a/build/lib/bandwidth/messaging/controllers/__init__.py b/build/lib/bandwidth/messaging/controllers/__init__.py deleted file mode 100644 index c1660224..00000000 --- a/build/lib/bandwidth/messaging/controllers/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -__all__ = [ - 'base_controller', - 'api_controller', -] diff --git a/build/lib/bandwidth/messaging/controllers/api_controller.py b/build/lib/bandwidth/messaging/controllers/api_controller.py deleted file mode 100644 index 28ec5dee..00000000 --- a/build/lib/bandwidth/messaging/controllers/api_controller.py +++ /dev/null @@ -1,345 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -from bandwidth.configuration import Server -from bandwidth.http.api_response import ApiResponse -from bandwidth.utilities.file_wrapper import FileWrapper -from bandwidth.messaging.controllers.base_controller import BaseController -from bandwidth.http.auth.messaging_basic_auth import MessagingBasicAuth -from bandwidth.messaging.models.media import Media -from bandwidth.messaging.models.bandwidth_message import BandwidthMessage -from bandwidth.messaging.exceptions.messaging_exception import MessagingException - - -class APIController(BaseController): - - """A Controller to access Endpoints in the bandwidth API.""" - - def __init__(self, config, call_back=None): - super(APIController, self).__init__(config, call_back) - - def list_media(self, - user_id, - continuation_token=None): - """Does a GET request to /users/{userId}/media. - - listMedia - - Args: - user_id (string): TODO: type description here. - continuation_token (string, optional): TODO: type description - here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/users/{userId}/media' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'userId': {'value': user_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json', - 'Continuation-Token': continuation_token - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - MessagingBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise MessagingException('400 Request is malformed or invalid', _response) - elif _response.status_code == 401: - raise MessagingException('401 The specified user does not have access to the account', _response) - elif _response.status_code == 403: - raise MessagingException('403 The user does not have access to this API', _response) - elif _response.status_code == 404: - raise MessagingException('404 Path not found', _response) - elif _response.status_code == 415: - raise MessagingException('415 The content-type of the request is incorrect', _response) - elif _response.status_code == 429: - raise MessagingException('429 The rate limit has been reached', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, Media.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def get_media(self, - user_id, - media_id): - """Does a GET request to /users/{userId}/media/{mediaId}. - - getMedia - - Args: - user_id (string): TODO: type description here. - media_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/users/{userId}/media/{mediaId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'userId': {'value': user_id, 'encode': True}, - 'mediaId': {'value': media_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare and execute request - _request = self.config.http_client.get(_query_url) - MessagingBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request, binary=True) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise MessagingException('400 Request is malformed or invalid', _response) - elif _response.status_code == 401: - raise MessagingException('401 The specified user does not have access to the account', _response) - elif _response.status_code == 403: - raise MessagingException('403 The user does not have access to this API', _response) - elif _response.status_code == 404: - raise MessagingException('404 Path not found', _response) - elif _response.status_code == 415: - raise MessagingException('415 The content-type of the request is incorrect', _response) - elif _response.status_code == 429: - raise MessagingException('429 The rate limit has been reached', _response) - self.validate_response(_response) - - decoded = _response.text - _result = ApiResponse(_response, body=decoded) - return _result - - def upload_media(self, - user_id, - media_id, - content_length, - body, - content_type='application/octet-stream', - cache_control=None): - """Does a PUT request to /users/{userId}/media/{mediaId}. - - uploadMedia - - Args: - user_id (string): TODO: type description here. - media_id (string): TODO: type description here. - content_length (long|int): TODO: type description here. - body (typing.BinaryIO): TODO: type description here. - content_type (string, optional): TODO: type description here. - Example: application/octet-stream - cache_control (string, optional): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/users/{userId}/media/{mediaId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'userId': {'value': user_id, 'encode': True}, - 'mediaId': {'value': media_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - if isinstance(body, FileWrapper): - body_wrapper = body.file_stream - body_content_type = body.content_type - else: - body_wrapper = body - body_content_type = content_type - - # Prepare headers - _headers = { - 'content-type': body_content_type, - 'Content-Length': content_length, - 'Cache-Control': cache_control - } - - # Prepare and execute request - _request = self.config.http_client.put(_query_url, headers=_headers, parameters=body_wrapper) - MessagingBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise MessagingException('400 Request is malformed or invalid', _response) - elif _response.status_code == 401: - raise MessagingException('401 The specified user does not have access to the account', _response) - elif _response.status_code == 403: - raise MessagingException('403 The user does not have access to this API', _response) - elif _response.status_code == 404: - raise MessagingException('404 Path not found', _response) - elif _response.status_code == 415: - raise MessagingException('415 The content-type of the request is incorrect', _response) - elif _response.status_code == 429: - raise MessagingException('429 The rate limit has been reached', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def delete_media(self, - user_id, - media_id): - """Does a DELETE request to /users/{userId}/media/{mediaId}. - - deleteMedia - - Args: - user_id (string): TODO: type description here. - media_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/users/{userId}/media/{mediaId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'userId': {'value': user_id, 'encode': True}, - 'mediaId': {'value': media_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare and execute request - _request = self.config.http_client.delete(_query_url) - MessagingBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise MessagingException('400 Request is malformed or invalid', _response) - elif _response.status_code == 401: - raise MessagingException('401 The specified user does not have access to the account', _response) - elif _response.status_code == 403: - raise MessagingException('403 The user does not have access to this API', _response) - elif _response.status_code == 404: - raise MessagingException('404 Path not found', _response) - elif _response.status_code == 415: - raise MessagingException('415 The content-type of the request is incorrect', _response) - elif _response.status_code == 429: - raise MessagingException('429 The rate limit has been reached', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def create_message(self, - user_id, - body=None): - """Does a POST request to /users/{userId}/messages. - - createMessage - - Args: - user_id (string): TODO: type description here. - body (MessageRequest, optional): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/users/{userId}/messages' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'userId': {'value': user_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json', - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - MessagingBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise MessagingException('400 Request is malformed or invalid', _response) - elif _response.status_code == 401: - raise MessagingException('401 The specified user does not have access to the account', _response) - elif _response.status_code == 403: - raise MessagingException('403 The user does not have access to this API', _response) - elif _response.status_code == 404: - raise MessagingException('404 Path not found', _response) - elif _response.status_code == 415: - raise MessagingException('415 The content-type of the request is incorrect', _response) - elif _response.status_code == 429: - raise MessagingException('429 The rate limit has been reached', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, BandwidthMessage.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result diff --git a/build/lib/bandwidth/messaging/controllers/base_controller.py b/build/lib/bandwidth/messaging/controllers/base_controller.py deleted file mode 100644 index 3f7583fb..00000000 --- a/build/lib/bandwidth/messaging/controllers/base_controller.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -from bandwidth.exceptions.api_exception import APIException - - -class BaseController(object): - - """All controllers inherit from this base class. - - Attributes: - config (Configuration): The HttpClient which a specific controller - instance will use. By default all the controller objects share - the same HttpClient. A user can use his own custom HttpClient - as well. - http_call_back (HttpCallBack): An object which holds call back - methods to be called before and after the execution of an HttpRequest. - global_headers (dict): The global headers of the API which are sent with - every request. - - """ - - def global_headers(self): - return { - 'user-agent': 'python-sdk-refs/tags/python6.13.2' - } - - def __init__(self, config, call_back=None): - self._config = config - self._http_call_back = call_back - - @property - def config(self): - return self._config - - @property - def http_call_back(self): - return self._http_call_back - - def validate_parameters(self, **kwargs): - """Validates required parameters of an endpoint. - - Args: - kwargs (dict): A dictionary of the required parameters. - - """ - for name, value in kwargs.items(): - if value is None: - raise ValueError("Required parameter {} cannot be None.".format(name)) - - def execute_request(self, request, binary=False): - """Executes an HttpRequest. - - Args: - request (HttpRequest): The HttpRequest to execute. - binary (bool): A flag which should be set to True if - a binary response is expected. - - Returns: - HttpResponse: The HttpResponse received. - - """ - # Invoke the on before request HttpCallBack if specified - if self.http_call_back is not None: - self.http_call_back.on_before_request(request) - - # Add global headers to request - request.headers = APIHelper.merge_dicts(self.global_headers(), request.headers) - - # Invoke the API call to fetch the response. - func = self.config.http_client.execute_as_binary if binary else self.config.http_client.execute_as_string - response = func(request) - - # Invoke the on after response HttpCallBack if specified - if self.http_call_back is not None: - self.http_call_back.on_after_response(response) - - return response - - def validate_response(self, response): - """Validates an HTTP response by checking for global errors. - - Args: - response (HttpResponse): The HttpResponse of the API call. - - """ - if (response.status_code < 200) or (response.status_code > 208): # [200,208] = HTTP OK - raise APIException('HTTP response not OK.', response) diff --git a/build/lib/bandwidth/messaging/exceptions/__init__.py b/build/lib/bandwidth/messaging/exceptions/__init__.py deleted file mode 100644 index 8d2920ac..00000000 --- a/build/lib/bandwidth/messaging/exceptions/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -__all__ = [ - 'messaging_exception', -] diff --git a/build/lib/bandwidth/messaging/exceptions/messaging_exception.py b/build/lib/bandwidth/messaging/exceptions/messaging_exception.py deleted file mode 100644 index 283ebde2..00000000 --- a/build/lib/bandwidth/messaging/exceptions/messaging_exception.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -import bandwidth.exceptions.api_exception - - -class MessagingException(bandwidth.exceptions.api_exception.APIException): - def __init__(self, reason, response): - """Constructor for the MessagingException class - - Args: - reason (string): The reason (or error message) for the Exception - to be raised. - response (HttpResponse): The HttpResponse of the API call. - - """ - super(MessagingException, self).__init__(reason, response) - dictionary = APIHelper.json_deserialize(self.response.text) - if isinstance(dictionary, dict): - self.unbox(dictionary) - - def unbox(self, dictionary): - """Populates the properties of this object by extracting them from a dictionary. - - Args: - dictionary (dictionary): A dictionary representation of the object as - obtained from the deserialization of the server's response. The keys - MUST match property names in the API description. - - """ - self.mtype = dictionary.get('type') - self.description = dictionary.get('description') diff --git a/build/lib/bandwidth/messaging/messaging_client.py b/build/lib/bandwidth/messaging/messaging_client.py deleted file mode 100644 index 86b29def..00000000 --- a/build/lib/bandwidth/messaging/messaging_client.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.decorators import lazy_property -from bandwidth.configuration import Configuration -from bandwidth.configuration import Environment -from bandwidth.messaging.controllers.api_controller import APIController - - -class MessagingClient(object): - - @lazy_property - def client(self): - return APIController(self.config) - - def __init__(self, timeout=60, max_retries=3, backoff_factor=0, - environment=Environment.PRODUCTION, - base_url='https://www.example.com', - messaging_basic_auth_user_name='TODO: Replace', - messaging_basic_auth_password='TODO: Replace', - two_factor_auth_basic_auth_user_name='TODO: Replace', - two_factor_auth_basic_auth_password='TODO: Replace', - voice_basic_auth_user_name='TODO: Replace', - voice_basic_auth_password='TODO: Replace', - web_rtc_basic_auth_user_name='TODO: Replace', - web_rtc_basic_auth_password='TODO: Replace', config=None): - if config is None: - self.config = Configuration(timeout=timeout, - max_retries=max_retries, - backoff_factor=backoff_factor, - environment=environment, - base_url=base_url, - messaging_basic_auth_user_name=messaging_basic_auth_user_name, - messaging_basic_auth_password=messaging_basic_auth_password, - two_factor_auth_basic_auth_user_name=two_factor_auth_basic_auth_user_name, - two_factor_auth_basic_auth_password=two_factor_auth_basic_auth_password, - voice_basic_auth_user_name=voice_basic_auth_user_name, - voice_basic_auth_password=voice_basic_auth_password, - web_rtc_basic_auth_user_name=web_rtc_basic_auth_user_name, - web_rtc_basic_auth_password=web_rtc_basic_auth_password) - else: - self.config = config diff --git a/build/lib/bandwidth/messaging/models/__init__.py b/build/lib/bandwidth/messaging/models/__init__.py deleted file mode 100644 index 46d2bfc0..00000000 --- a/build/lib/bandwidth/messaging/models/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -__all__ = [ - 'media', - 'tag', - 'deferred_result', - 'bandwidth_callback_message', - 'bandwidth_message', - 'message_request', -] diff --git a/build/lib/bandwidth/messaging/models/bandwidth_callback_message.py b/build/lib/bandwidth/messaging/models/bandwidth_callback_message.py deleted file mode 100644 index 6ce2d18d..00000000 --- a/build/lib/bandwidth/messaging/models/bandwidth_callback_message.py +++ /dev/null @@ -1,85 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" -from bandwidth.messaging.models.bandwidth_message import BandwidthMessage - - -class BandwidthCallbackMessage(object): - - """Implementation of the 'BandwidthCallbackMessage' model. - - TODO: type model description here. - - Attributes: - time (string): TODO: type description here. - mtype (string): TODO: type description here. - to (string): TODO: type description here. - error_code (string): TODO: type description here. - description (string): TODO: type description here. - message (BandwidthMessage): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "time": 'time', - "mtype": 'type', - "to": 'to', - "error_code": 'errorCode', - "description": 'description', - "message": 'message' - } - - def __init__(self, - time=None, - mtype=None, - to=None, - error_code=None, - description=None, - message=None): - """Constructor for the BandwidthCallbackMessage class""" - - # Initialize members of the class - self.time = time - self.mtype = mtype - self.to = to - self.error_code = error_code - self.description = description - self.message = message - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - time = dictionary.get('time') - mtype = dictionary.get('type') - to = dictionary.get('to') - error_code = dictionary.get('errorCode') - description = dictionary.get('description') - message = BandwidthMessage.from_dictionary(dictionary.get('message')) if dictionary.get('message') else None - - # Return an object of this model - return cls(time, - mtype, - to, - error_code, - description, - message) diff --git a/build/lib/bandwidth/messaging/models/bandwidth_message.py b/build/lib/bandwidth/messaging/models/bandwidth_message.py deleted file mode 100644 index 58098c98..00000000 --- a/build/lib/bandwidth/messaging/models/bandwidth_message.py +++ /dev/null @@ -1,114 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class BandwidthMessage(object): - - """Implementation of the 'BandwidthMessage' model. - - TODO: type model description here. - - Attributes: - id (string): TODO: type description here. - owner (string): TODO: type description here. - application_id (string): TODO: type description here. - time (string): TODO: type description here. - segment_count (int): TODO: type description here. - direction (string): TODO: type description here. - to (list of string): TODO: type description here. - mfrom (string): TODO: type description here. - media (list of string): TODO: type description here. - text (string): TODO: type description here. - tag (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "id": 'id', - "owner": 'owner', - "application_id": 'applicationId', - "time": 'time', - "segment_count": 'segmentCount', - "direction": 'direction', - "to": 'to', - "mfrom": 'from', - "media": 'media', - "text": 'text', - "tag": 'tag' - } - - def __init__(self, - id=None, - owner=None, - application_id=None, - time=None, - segment_count=None, - direction=None, - to=None, - mfrom=None, - media=None, - text=None, - tag=None): - """Constructor for the BandwidthMessage class""" - - # Initialize members of the class - self.id = id - self.owner = owner - self.application_id = application_id - self.time = time - self.segment_count = segment_count - self.direction = direction - self.to = to - self.mfrom = mfrom - self.media = media - self.text = text - self.tag = tag - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - id = dictionary.get('id') - owner = dictionary.get('owner') - application_id = dictionary.get('applicationId') - time = dictionary.get('time') - segment_count = dictionary.get('segmentCount') - direction = dictionary.get('direction') - to = dictionary.get('to') - mfrom = dictionary.get('from') - media = dictionary.get('media') - text = dictionary.get('text') - tag = dictionary.get('tag') - - # Return an object of this model - return cls(id, - owner, - application_id, - time, - segment_count, - direction, - to, - mfrom, - media, - text, - tag) diff --git a/build/lib/bandwidth/messaging/models/deferred_result.py b/build/lib/bandwidth/messaging/models/deferred_result.py deleted file mode 100644 index da85ac48..00000000 --- a/build/lib/bandwidth/messaging/models/deferred_result.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class DeferredResult(object): - - """Implementation of the 'DeferredResult' model. - - TODO: type model description here. - - Attributes: - result (object): TODO: type description here. - set_or_expired (bool): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "result": 'result', - "set_or_expired": 'setOrExpired' - } - - def __init__(self, - result=None, - set_or_expired=None): - """Constructor for the DeferredResult class""" - - # Initialize members of the class - self.result = result - self.set_or_expired = set_or_expired - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - result = dictionary.get('result') - set_or_expired = dictionary.get('setOrExpired') - - # Return an object of this model - return cls(result, - set_or_expired) diff --git a/build/lib/bandwidth/messaging/models/media.py b/build/lib/bandwidth/messaging/models/media.py deleted file mode 100644 index 33f6f6c9..00000000 --- a/build/lib/bandwidth/messaging/models/media.py +++ /dev/null @@ -1,111 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" -from bandwidth.messaging.models.tag import Tag - - -class Media(object): - - """Implementation of the 'Media' model. - - TODO: type model description here. - - Attributes: - input_stream (object): TODO: type description here. - content (string): TODO: type description here. - url (string): TODO: type description here. - content_length (string): TODO: type description here. - content_type (string): TODO: type description here. - tags (list of Tag): TODO: type description here. - user_id (string): TODO: type description here. - media_name (string): TODO: type description here. - media_id (string): TODO: type description here. - cache_control (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "input_stream": 'inputStream', - "content": 'content', - "url": 'url', - "content_length": 'contentLength', - "content_type": 'contentType', - "tags": 'tags', - "user_id": 'userId', - "media_name": 'mediaName', - "media_id": 'mediaId', - "cache_control": 'cacheControl' - } - - def __init__(self, - input_stream=None, - content=None, - url=None, - content_length=None, - content_type=None, - tags=None, - user_id=None, - media_name=None, - media_id=None, - cache_control=None): - """Constructor for the Media class""" - - # Initialize members of the class - self.input_stream = input_stream - self.content = content - self.url = url - self.content_length = content_length - self.content_type = content_type - self.tags = tags - self.user_id = user_id - self.media_name = media_name - self.media_id = media_id - self.cache_control = cache_control - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - input_stream = dictionary.get('inputStream') - content = dictionary.get('content') - url = dictionary.get('url') - content_length = dictionary.get('contentLength') - content_type = dictionary.get('contentType') - tags = None - if dictionary.get('tags') is not None: - tags = [Tag.from_dictionary(x) for x in dictionary.get('tags')] - user_id = dictionary.get('userId') - media_name = dictionary.get('mediaName') - media_id = dictionary.get('mediaId') - cache_control = dictionary.get('cacheControl') - - # Return an object of this model - return cls(input_stream, - content, - url, - content_length, - content_type, - tags, - user_id, - media_name, - media_id, - cache_control) diff --git a/build/lib/bandwidth/messaging/models/message_request.py b/build/lib/bandwidth/messaging/models/message_request.py deleted file mode 100644 index 2af96789..00000000 --- a/build/lib/bandwidth/messaging/models/message_request.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class MessageRequest(object): - - """Implementation of the 'MessageRequest' model. - - TODO: type model description here. - - Attributes: - application_id (string): TODO: type description here. - to (list of string): TODO: type description here. - mfrom (string): TODO: type description here. - text (string): TODO: type description here. - media (list of string): TODO: type description here. - tag (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "application_id": 'applicationId', - "to": 'to', - "mfrom": 'from', - "text": 'text', - "media": 'media', - "tag": 'tag' - } - - def __init__(self, - application_id=None, - to=None, - mfrom=None, - text=None, - media=None, - tag=None): - """Constructor for the MessageRequest class""" - - # Initialize members of the class - self.application_id = application_id - self.to = to - self.mfrom = mfrom - self.text = text - self.media = media - self.tag = tag - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - application_id = dictionary.get('applicationId') - to = dictionary.get('to') - mfrom = dictionary.get('from') - text = dictionary.get('text') - media = dictionary.get('media') - tag = dictionary.get('tag') - - # Return an object of this model - return cls(application_id, - to, - mfrom, - text, - media, - tag) diff --git a/build/lib/bandwidth/messaging/models/tag.py b/build/lib/bandwidth/messaging/models/tag.py deleted file mode 100644 index 43236b04..00000000 --- a/build/lib/bandwidth/messaging/models/tag.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class Tag(object): - - """Implementation of the 'Tag' model. - - TODO: type model description here. - - Attributes: - key (string): TODO: type description here. - value (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "key": 'key', - "value": 'value' - } - - def __init__(self, - key=None, - value=None): - """Constructor for the Tag class""" - - # Initialize members of the class - self.key = key - self.value = value - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - key = dictionary.get('key') - value = dictionary.get('value') - - # Return an object of this model - return cls(key, - value) diff --git a/build/lib/bandwidth/models/__init__.py b/build/lib/bandwidth/models/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/build/lib/bandwidth/twofactorauth/__init__.py b/build/lib/bandwidth/twofactorauth/__init__.py deleted file mode 100644 index dbf8f2d9..00000000 --- a/build/lib/bandwidth/twofactorauth/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -__all__ = [ - 'controllers', - 'exceptions', - 'models', - 'two_factor_auth_client', -] diff --git a/build/lib/bandwidth/twofactorauth/controllers/__init__.py b/build/lib/bandwidth/twofactorauth/controllers/__init__.py deleted file mode 100644 index c1660224..00000000 --- a/build/lib/bandwidth/twofactorauth/controllers/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -__all__ = [ - 'base_controller', - 'api_controller', -] diff --git a/build/lib/bandwidth/twofactorauth/controllers/api_controller.py b/build/lib/bandwidth/twofactorauth/controllers/api_controller.py deleted file mode 100644 index 436d2458..00000000 --- a/build/lib/bandwidth/twofactorauth/controllers/api_controller.py +++ /dev/null @@ -1,186 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -from bandwidth.configuration import Server -from bandwidth.http.api_response import ApiResponse -from bandwidth.twofactorauth.controllers.base_controller import BaseController -from bandwidth.http.auth.two_factor_auth_basic_auth import TwoFactorAuthBasicAuth -from bandwidth.twofactorauth.models.two_factor_voice_response import TwoFactorVoiceResponse -from bandwidth.twofactorauth.models.two_factor_messaging_response import TwoFactorMessagingResponse -from bandwidth.twofactorauth.models.two_factor_verify_code_response import TwoFactorVerifyCodeResponse -from bandwidth.twofactorauth.exceptions.invalid_request_exception import InvalidRequestException - - -class APIController(BaseController): - - """A Controller to access Endpoints in the bandwidth API.""" - - def __init__(self, config, call_back=None): - super(APIController, self).__init__(config, call_back) - - def create_voice_two_factor(self, - account_id, - body): - """Does a POST request to /accounts/{accountId}/code/voice. - - Two-Factor authentication with Bandwidth Voice services - - Args: - account_id (string): Bandwidth Account ID with Voice service - enabled - body (TwoFactorCodeRequestSchema): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/code/voice' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.TWOFACTORAUTHDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json', - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - TwoFactorAuthBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise InvalidRequestException('client request error', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, TwoFactorVoiceResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def create_messaging_two_factor(self, - account_id, - body): - """Does a POST request to /accounts/{accountId}/code/messaging. - - Two-Factor authentication with Bandwidth messaging services - - Args: - account_id (string): Bandwidth Account ID with Messaging service - enabled - body (TwoFactorCodeRequestSchema): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/code/messaging' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.TWOFACTORAUTHDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json', - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - TwoFactorAuthBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise InvalidRequestException('client request error', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, TwoFactorMessagingResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def create_verify_two_factor(self, - account_id, - body): - """Does a POST request to /accounts/{accountId}/code/verify. - - Verify a previously sent two-factor authentication code - - Args: - account_id (string): Bandwidth Account ID with Two-Factor enabled - body (TwoFactorVerifyRequestSchema): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/code/verify' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.TWOFACTORAUTHDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json', - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - TwoFactorAuthBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise InvalidRequestException('client request error', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, TwoFactorVerifyCodeResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result diff --git a/build/lib/bandwidth/twofactorauth/controllers/base_controller.py b/build/lib/bandwidth/twofactorauth/controllers/base_controller.py deleted file mode 100644 index 3f7583fb..00000000 --- a/build/lib/bandwidth/twofactorauth/controllers/base_controller.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -from bandwidth.exceptions.api_exception import APIException - - -class BaseController(object): - - """All controllers inherit from this base class. - - Attributes: - config (Configuration): The HttpClient which a specific controller - instance will use. By default all the controller objects share - the same HttpClient. A user can use his own custom HttpClient - as well. - http_call_back (HttpCallBack): An object which holds call back - methods to be called before and after the execution of an HttpRequest. - global_headers (dict): The global headers of the API which are sent with - every request. - - """ - - def global_headers(self): - return { - 'user-agent': 'python-sdk-refs/tags/python6.13.2' - } - - def __init__(self, config, call_back=None): - self._config = config - self._http_call_back = call_back - - @property - def config(self): - return self._config - - @property - def http_call_back(self): - return self._http_call_back - - def validate_parameters(self, **kwargs): - """Validates required parameters of an endpoint. - - Args: - kwargs (dict): A dictionary of the required parameters. - - """ - for name, value in kwargs.items(): - if value is None: - raise ValueError("Required parameter {} cannot be None.".format(name)) - - def execute_request(self, request, binary=False): - """Executes an HttpRequest. - - Args: - request (HttpRequest): The HttpRequest to execute. - binary (bool): A flag which should be set to True if - a binary response is expected. - - Returns: - HttpResponse: The HttpResponse received. - - """ - # Invoke the on before request HttpCallBack if specified - if self.http_call_back is not None: - self.http_call_back.on_before_request(request) - - # Add global headers to request - request.headers = APIHelper.merge_dicts(self.global_headers(), request.headers) - - # Invoke the API call to fetch the response. - func = self.config.http_client.execute_as_binary if binary else self.config.http_client.execute_as_string - response = func(request) - - # Invoke the on after response HttpCallBack if specified - if self.http_call_back is not None: - self.http_call_back.on_after_response(response) - - return response - - def validate_response(self, response): - """Validates an HTTP response by checking for global errors. - - Args: - response (HttpResponse): The HttpResponse of the API call. - - """ - if (response.status_code < 200) or (response.status_code > 208): # [200,208] = HTTP OK - raise APIException('HTTP response not OK.', response) diff --git a/build/lib/bandwidth/twofactorauth/exceptions/__init__.py b/build/lib/bandwidth/twofactorauth/exceptions/__init__.py deleted file mode 100644 index 62a035cd..00000000 --- a/build/lib/bandwidth/twofactorauth/exceptions/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -__all__ = [ - 'invalid_request_exception', -] diff --git a/build/lib/bandwidth/twofactorauth/exceptions/invalid_request_exception.py b/build/lib/bandwidth/twofactorauth/exceptions/invalid_request_exception.py deleted file mode 100644 index 9c91cb66..00000000 --- a/build/lib/bandwidth/twofactorauth/exceptions/invalid_request_exception.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -import bandwidth.exceptions.api_exception - - -class InvalidRequestException(bandwidth.exceptions.api_exception.APIException): - def __init__(self, reason, response): - """Constructor for the InvalidRequestException class - - Args: - reason (string): The reason (or error message) for the Exception - to be raised. - response (HttpResponse): The HttpResponse of the API call. - - """ - super(InvalidRequestException, self).__init__(reason, response) - dictionary = APIHelper.json_deserialize(self.response.text) - if isinstance(dictionary, dict): - self.unbox(dictionary) - - def unbox(self, dictionary): - """Populates the properties of this object by extracting them from a dictionary. - - Args: - dictionary (dictionary): A dictionary representation of the object as - obtained from the deserialization of the server's response. The keys - MUST match property names in the API description. - - """ - self.result = dictionary.get('result') diff --git a/build/lib/bandwidth/twofactorauth/models/__init__.py b/build/lib/bandwidth/twofactorauth/models/__init__.py deleted file mode 100644 index a22a5a11..00000000 --- a/build/lib/bandwidth/twofactorauth/models/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -__all__ = [ - 'two_factor_code_request_schema', - 'two_factor_voice_response', - 'two_factor_messaging_response', - 'two_factor_verify_request_schema', - 'two_factor_verify_code_response', -] diff --git a/build/lib/bandwidth/twofactorauth/models/two_factor_code_request_schema.py b/build/lib/bandwidth/twofactorauth/models/two_factor_code_request_schema.py deleted file mode 100644 index ba0b3a28..00000000 --- a/build/lib/bandwidth/twofactorauth/models/two_factor_code_request_schema.py +++ /dev/null @@ -1,95 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class TwoFactorCodeRequestSchema(object): - - """Implementation of the 'TwoFactorCodeRequestSchema' model. - - TODO: type model description here. - - Attributes: - to (string): The phone number to send the 2fa code to. - mfrom (string): The application phone number, the sender of the 2fa - code. - application_id (string): The application unique ID, obtained from - Bandwidth. - scope (string): An optional field to denote what scope or action the - 2fa code is addressing. If not supplied, defaults to "2FA". - message (string): The message format of the 2fa code. There are three - values that the system will replace "{CODE}", "{NAME}", "{SCOPE}". - The "{SCOPE}" and "{NAME} value template are optional, while - "{CODE}" must be supplied. As the name would suggest, code will - be replace with the actual 2fa code. Name is replaced with the - application name, configured during provisioning of 2fa. The - scope value is the same value sent during the call and partitioned - by the server. - digits (float): The number of digits for your 2fa code. The valid - number ranges from 2 to 8, inclusively. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "to": 'to', - "mfrom": 'from', - "application_id": 'applicationId', - "message": 'message', - "digits": 'digits', - "scope": 'scope' - } - - def __init__(self, - to=None, - mfrom=None, - application_id=None, - message=None, - digits=None, - scope=None): - """Constructor for the TwoFactorCodeRequestSchema class""" - - # Initialize members of the class - self.to = to - self.mfrom = mfrom - self.application_id = application_id - self.scope = scope - self.message = message - self.digits = digits - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - to = dictionary.get('to') - mfrom = dictionary.get('from') - application_id = dictionary.get('applicationId') - message = dictionary.get('message') - digits = dictionary.get('digits') - scope = dictionary.get('scope') - - # Return an object of this model - return cls(to, - mfrom, - application_id, - message, - digits, - scope) diff --git a/build/lib/bandwidth/twofactorauth/models/two_factor_messaging_response.py b/build/lib/bandwidth/twofactorauth/models/two_factor_messaging_response.py deleted file mode 100644 index 6bd78ee4..00000000 --- a/build/lib/bandwidth/twofactorauth/models/two_factor_messaging_response.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class TwoFactorMessagingResponse(object): - - """Implementation of the 'TwoFactorMessagingResponse' model. - - TODO: type model description here. - - Attributes: - message_id (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "message_id": 'messageId' - } - - def __init__(self, - message_id=None): - """Constructor for the TwoFactorMessagingResponse class""" - - # Initialize members of the class - self.message_id = message_id - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - message_id = dictionary.get('messageId') - - # Return an object of this model - return cls(message_id) diff --git a/build/lib/bandwidth/twofactorauth/models/two_factor_verify_code_response.py b/build/lib/bandwidth/twofactorauth/models/two_factor_verify_code_response.py deleted file mode 100644 index 5ee46a6d..00000000 --- a/build/lib/bandwidth/twofactorauth/models/two_factor_verify_code_response.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class TwoFactorVerifyCodeResponse(object): - - """Implementation of the 'TwoFactorVerifyCodeResponse' model. - - TODO: type model description here. - - Attributes: - valid (bool): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "valid": 'valid' - } - - def __init__(self, - valid=None): - """Constructor for the TwoFactorVerifyCodeResponse class""" - - # Initialize members of the class - self.valid = valid - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - valid = dictionary.get('valid') - - # Return an object of this model - return cls(valid) diff --git a/build/lib/bandwidth/twofactorauth/models/two_factor_verify_request_schema.py b/build/lib/bandwidth/twofactorauth/models/two_factor_verify_request_schema.py deleted file mode 100644 index eb147906..00000000 --- a/build/lib/bandwidth/twofactorauth/models/two_factor_verify_request_schema.py +++ /dev/null @@ -1,98 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class TwoFactorVerifyRequestSchema(object): - - """Implementation of the 'TwoFactorVerifyRequestSchema' model. - - TODO: type model description here. - - Attributes: - to (string): The phone number to send the 2fa code to. - mfrom (string): The application phone number, the sender of the 2fa - code. - application_id (string): The application unique ID, obtained from - Bandwidth. - scope (string): An optional field to denote what scope or action the - 2fa code is addressing. If not supplied, defaults to "2FA". - digits (float): The number of digits for your 2fa code. The valid - number ranges from 2 to 8, inclusively. - expiration_time_in_minutes (float): The time period, in minutes, to - validate the 2fa code. By setting this to 3 minutes, it will mean - any code generated within the last 3 minutes are still valid. The - valid range for expiration time is between 0 and 15 minutes, - exclusively and inclusively, respectively. - code (string): The generated 2fa code to check if valid - - """ - - # Create a mapping from Model property names to API property names - _names = { - "to": 'to', - "mfrom": 'from', - "application_id": 'applicationId', - "digits": 'digits', - "expiration_time_in_minutes": 'expirationTimeInMinutes', - "code": 'code', - "scope": 'scope' - } - - def __init__(self, - to=None, - mfrom=None, - application_id=None, - digits=None, - expiration_time_in_minutes=None, - code=None, - scope=None): - """Constructor for the TwoFactorVerifyRequestSchema class""" - - # Initialize members of the class - self.to = to - self.mfrom = mfrom - self.application_id = application_id - self.scope = scope - self.digits = digits - self.expiration_time_in_minutes = expiration_time_in_minutes - self.code = code - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - to = dictionary.get('to') - mfrom = dictionary.get('from') - application_id = dictionary.get('applicationId') - digits = dictionary.get('digits') - expiration_time_in_minutes = dictionary.get('expirationTimeInMinutes') - code = dictionary.get('code') - scope = dictionary.get('scope') - - # Return an object of this model - return cls(to, - mfrom, - application_id, - digits, - expiration_time_in_minutes, - code, - scope) diff --git a/build/lib/bandwidth/twofactorauth/models/two_factor_voice_response.py b/build/lib/bandwidth/twofactorauth/models/two_factor_voice_response.py deleted file mode 100644 index 0734c4b7..00000000 --- a/build/lib/bandwidth/twofactorauth/models/two_factor_voice_response.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class TwoFactorVoiceResponse(object): - - """Implementation of the 'TwoFactorVoiceResponse' model. - - TODO: type model description here. - - Attributes: - call_id (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "call_id": 'callId' - } - - def __init__(self, - call_id=None): - """Constructor for the TwoFactorVoiceResponse class""" - - # Initialize members of the class - self.call_id = call_id - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - call_id = dictionary.get('callId') - - # Return an object of this model - return cls(call_id) diff --git a/build/lib/bandwidth/twofactorauth/two_factor_auth_client.py b/build/lib/bandwidth/twofactorauth/two_factor_auth_client.py deleted file mode 100644 index 8da2ce1d..00000000 --- a/build/lib/bandwidth/twofactorauth/two_factor_auth_client.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.decorators import lazy_property -from bandwidth.configuration import Configuration -from bandwidth.configuration import Environment -from bandwidth.twofactorauth.controllers.api_controller import APIController - - -class TwoFactorAuthClient(object): - - @lazy_property - def client(self): - return APIController(self.config) - - def __init__(self, timeout=60, max_retries=3, backoff_factor=0, - environment=Environment.PRODUCTION, - base_url='https://www.example.com', - messaging_basic_auth_user_name='TODO: Replace', - messaging_basic_auth_password='TODO: Replace', - two_factor_auth_basic_auth_user_name='TODO: Replace', - two_factor_auth_basic_auth_password='TODO: Replace', - voice_basic_auth_user_name='TODO: Replace', - voice_basic_auth_password='TODO: Replace', - web_rtc_basic_auth_user_name='TODO: Replace', - web_rtc_basic_auth_password='TODO: Replace', config=None): - if config is None: - self.config = Configuration(timeout=timeout, - max_retries=max_retries, - backoff_factor=backoff_factor, - environment=environment, - base_url=base_url, - messaging_basic_auth_user_name=messaging_basic_auth_user_name, - messaging_basic_auth_password=messaging_basic_auth_password, - two_factor_auth_basic_auth_user_name=two_factor_auth_basic_auth_user_name, - two_factor_auth_basic_auth_password=two_factor_auth_basic_auth_password, - voice_basic_auth_user_name=voice_basic_auth_user_name, - voice_basic_auth_password=voice_basic_auth_password, - web_rtc_basic_auth_user_name=web_rtc_basic_auth_user_name, - web_rtc_basic_auth_password=web_rtc_basic_auth_password) - else: - self.config = config diff --git a/build/lib/bandwidth/utilities/__init__.py b/build/lib/bandwidth/utilities/__init__.py deleted file mode 100644 index 6ade54ba..00000000 --- a/build/lib/bandwidth/utilities/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -__all__ = [ - 'file_wrapper.py', -] diff --git a/build/lib/bandwidth/utilities/file_wrapper.py b/build/lib/bandwidth/utilities/file_wrapper.py deleted file mode 100644 index 274b196e..00000000 --- a/build/lib/bandwidth/utilities/file_wrapper.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class FileWrapper(): - - """A wrapper to allow passing in content type for file uploads.""" - - def __init__(self, file, content_type='application/octet-stream'): - self._file_stream = file - self._content_type = content_type - - @property - def file_stream(self): - return self._file_stream - - @property - def content_type(self): - return self._content_type diff --git a/build/lib/bandwidth/voice/__init__.py b/build/lib/bandwidth/voice/__init__.py deleted file mode 100644 index 358ad66e..00000000 --- a/build/lib/bandwidth/voice/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -__all__ = [ - 'bxml', - 'controllers', - 'exceptions', - 'models', - 'voice_client', -] diff --git a/build/lib/bandwidth/voice/bxml/__init__.py b/build/lib/bandwidth/voice/bxml/__init__.py deleted file mode 100644 index 27199698..00000000 --- a/build/lib/bandwidth/voice/bxml/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from . import response -from . import verbs diff --git a/build/lib/bandwidth/voice/bxml/response.py b/build/lib/bandwidth/voice/bxml/response.py deleted file mode 100644 index b3280225..00000000 --- a/build/lib/bandwidth/voice/bxml/response.py +++ /dev/null @@ -1,41 +0,0 @@ -""" -response.py - -Class that allows user to generate BXML programatically in python - -@copyright Bandwidth INC -""" - -RESPONSE_TAG = "Response" -XML_HEADER = '' - - -class Response: - - def __init__(self): - """ - Creates the Response class - """ - self.verbs = [] - - def add_verb(self, verb): - """ - Adds the Verb to the already existing verbs - - :param Verb verb: The Verb to add - """ - self.verbs.append(verb) - - def to_bxml(self): - """ - Converts the Response class to its XML representation - - :rtype str: The XML representation of the Response class - """ - xml_string = XML_HEADER - xml_string += '<' + RESPONSE_TAG + '>' - for verb in self.verbs: - xml_string += verb.to_bxml() - xml_string += '' - - return xml_string diff --git a/build/lib/bandwidth/voice/bxml/verbs/__init__.py b/build/lib/bandwidth/voice/bxml/verbs/__init__.py deleted file mode 100644 index 05b5c3e2..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -from .hangup import Hangup -from .send_dtmf import SendDtmf -from .gather import Gather -from .pause import Pause -from .phone_number import PhoneNumber -from .redirect import Redirect -from .speak_sentence import SpeakSentence -from .transfer import Transfer -from .play_audio import PlayAudio -from .forward import Forward -from .record import Record -from .pause_recording import PauseRecording -from .resume_recording import ResumeRecording -from .stop_recording import StopRecording -from .start_recording import StartRecording -from .conference import Conference -from .bridge import Bridge -from .ring import Ring -from .stop_gather import StopGather -from .start_gather import StartGather diff --git a/build/lib/bandwidth/voice/bxml/verbs/base_verb.py b/build/lib/bandwidth/voice/bxml/verbs/base_verb.py deleted file mode 100644 index 37879636..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/base_verb.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -base_verb.py - -Defines the abstract class for all BXML verbs - -@copyright Bandwidth INC -""" - -from abc import ABC, abstractmethod - - -class AbstractBxmlVerb(ABC): - - @abstractmethod - def to_bxml(self): - """ - Converts the class into its xml representation - - :return str: The string xml representation - """ - pass diff --git a/build/lib/bandwidth/voice/bxml/verbs/bridge.py b/build/lib/bandwidth/voice/bxml/verbs/bridge.py deleted file mode 100644 index c65bbbbb..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/bridge.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -bridge.py - -Representation of Bandwidth's speak sentence BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -import re - -BRIDGE_TAG = "Bridge" - -class Bridge(AbstractBxmlVerb): - - def __init__(self, call_id, bridge_complete_url=None, bridge_complete_method=None, - bridge_target_complete_url=None, bridge_target_complete_method=None, - username=None, password=None, tag=None, bridge_complete_fallback_url=None, - bridge_complete_fallback_method=None, bridge_target_complete_fallback_url=None, - bridge_target_complete_fallback_method=None, fallback_username=None, - fallback_password=None): - """ - Initializes the Bridge class with the following parameters - - :param str call_id: The call to bridge - :param str bridge_complete_url: URL to send the bridge complete event to - :param str bridge_complete_method: HTTP method to send the bridge complete event - :param str bridge_target_complete_url: URL to send the bridge target complete event to - :param str bridge_target_complete_method: HTTP method to send the bridge target complete event - :param str username: HTTP basic auth username for events - :param str password: HTTP basic auth password for events - :param str tag: Custom tag to include in callbacks - :param str bridge_complete_fallback_url: Fallback url for bridge complete events - :param str bridge_complete_fallback_method: HTTP method for bridge complete fallback - :param str bridge_target_complete_fallback_url: Fallback url for bridge target complete events - :param str bridge_target_complete_fallback_method: HTTP method for bridge target complete fallback - :param str fallback_username: Basic auth username for fallback events - :param str fallback_password: Basic auth password for fallback events - """ - self.call_id = call_id - self.bridge_complete_url = bridge_complete_url - self.bridge_complete_method = bridge_complete_method - self.bridge_target_complete_url = bridge_target_complete_url - self.bridge_target_complete_method = bridge_target_complete_method - self.username = username - self.password = password - self.tag = tag - self.bridge_complete_fallback_url = bridge_complete_fallback_url - self.bridge_complete_fallback_method = bridge_complete_fallback_method - self.bridge_target_complete_fallback_url = bridge_target_complete_fallback_url - self.bridge_target_complete_fallback_method = bridge_target_complete_fallback_method - self.fallback_username = fallback_username - self.fallback_password = fallback_password - - def to_bxml(self): - root = etree.Element(BRIDGE_TAG) - root.text = self.call_id - if self.bridge_complete_url is not None: - root.set("bridgeCompleteUrl", self.bridge_complete_url) - if self.bridge_complete_method is not None: - root.set("bridgeCompleteMethod", self.bridge_complete_method) - if self.bridge_target_complete_url is not None: - root.set("bridgeTargetCompleteUrl", self.bridge_target_complete_url) - if self.bridge_target_complete_method is not None: - root.set("bridgeTargetCompleteMethod", self.bridge_target_complete_method) - if self.username is not None: - root.set("username", self.username) - if self.password is not None: - root.set("password", self.password) - if self.tag is not None: - root.set("tag", self.tag) - if self.bridge_complete_fallback_url is not None: - root.set("bridgeCompleteFallbackUrl", self.bridge_complete_fallback_url) - if self.bridge_complete_fallback_method is not None: - root.set("bridgeCompleteFallbackMethod", self.bridge_complete_fallback_method) - if self.bridge_target_complete_fallback_url is not None: - root.set("bridgeTargetCompleteFallbackUrl", self.bridge_target_complete_fallback_url) - if self.bridge_target_complete_fallback_method is not None: - root.set("bridgeTargetCompleteFallbackMethod", self.bridge_target_complete_fallback_method) - if self.fallback_username is not None: - root.set("fallbackUsername", self.fallback_username) - if self.fallback_password is not None: - root.set("fallbackPassword", self.fallback_password) - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/conference.py b/build/lib/bandwidth/voice/bxml/verbs/conference.py deleted file mode 100644 index 7a36c9eb..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/conference.py +++ /dev/null @@ -1,90 +0,0 @@ -""" -conference.py - -Representation of Bandwidth's conference BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -CONFERENCE_TAG = "Conference" - - -class Conference(AbstractBxmlVerb): - - def __init__(self, conference_name, mute=None, hold=None, call_ids_to_coach=None, - conference_event_url=None, conference_event_method=None, - username=None, password=None, tag=None, conference_event_fallback_url=None, - conference_event_fallback_method=None, fallback_username=None, - fallback_password=None): - """ - Init for Conference - - :param str conference_name: The name of the conference - :param boolean mute: Determines if conference members should be on mute - :param boolean hold: Determines if conference members should be on hold - :param string|list call_ids_to_coach: A string of comma separated call IDs to coach, or an array of call IDs to coach - :param string conference_event_url: The url to receive conference events - :param string conference_event_method: The HTTP method to send conference events - :param string username: Basic auth username for events - :param string password: Basic auth password for events - :param string tag: Custom tag to be included in events - :param string conference_event_fallback_url: Fallback URL for conference events - :param string conference_event_fallback_method: HTTP method for fallback URL requests - :param string fallback_username: Basic auth username for fallback requests - :param string fallback_password: Basic auth password for fallback requests - """ - self.conference_name = conference_name - self.mute = mute - self.hold = hold - self.call_ids_to_coach = call_ids_to_coach - self.conference_event_url = conference_event_url - self.conference_event_method = conference_event_method - self.username = username - self.password = password - self.tag = tag - self.conference_event_fallback_url = conference_event_fallback_url - self.conference_event_fallback_method = conference_event_fallback_method - self.fallback_username = fallback_username - self.fallback_password = fallback_password - - def to_bxml(self): - root = etree.Element(CONFERENCE_TAG) - root.text = self.conference_name - - if self.mute is not None: - strn = "true" if self.mute else "false" - root.set("mute", strn) - if self.hold is not None: - strn = "true" if self.hold else "false" - root.set("hold", strn) - if self.call_ids_to_coach is not None: - strn = None - if isinstance(self.call_ids_to_coach, str): - strn = self.call_ids_to_coach - else: - strn = ",".join(self.call_ids_to_coach) - root.set("callIdsToCoach", strn) - if self.conference_event_url is not None: - root.set("conferenceEventUrl", self.conference_event_url) - if self.conference_event_method is not None: - root.set("conferenceEventMethod", self.conference_event_method) - if self.tag is not None: - root.set("tag", self.tag) - if self.username is not None: - root.set("username", self.username) - if self.password is not None: - root.set("password", self.password) - if self.conference_event_fallback_url is not None: - root.set("conferenceEventFallbackUrl", self.conference_event_fallback_url) - if self.conference_event_fallback_method is not None: - root.set("conferenceEventFallbackMethod", self.conference_event_fallback_method) - if self.fallback_username is not None: - root.set("fallbackUsername", self.fallback_username) - if self.fallback_password is not None: - root.set("fallbackPassword", self.fallback_password) - - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/forward.py b/build/lib/bandwidth/voice/bxml/verbs/forward.py deleted file mode 100644 index 1ea510c6..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/forward.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -forward.py - -Representation of Bandwidth's forward BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -FORWARD_TAG = "Forward" - - -class Forward(AbstractBxmlVerb): - - def __init__(self, to=None, from_=None, call_timeout=None, diversion_treatment=None, diversion_reason=None): - """ - Initializes the Forward class with the following parameters - - :param str to: The phone number destination of the call - :param str from_: The phone number that the recipient will receive the call from - :param int call_timeout: The number of seconds to wait before timing out the call - :param str diversion_treatment: The diversion treatment for the call - :param str diversion_reason: The diversion reason for the call - """ - self.to = to - self.from_ = from_ - self.call_timeout = call_timeout - self.diversion_treatment = diversion_treatment - self.diversion_reason = diversion_reason - - def to_bxml(self): - root = etree.Element(FORWARD_TAG) - if self.to is not None: - root.set("to", self.to) - if self.call_timeout is not None: - root.set("callTimeout", str(self.call_timeout)) - if self.from_ is not None: - root.set("from", self.from_) - if self.diversion_treatment is not None: - root.set("diversionTreatment", self.diversion_treatment) - if self.diversion_reason is not None: - root.set("diversionReason", self.diversion_reason) - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/gather.py b/build/lib/bandwidth/voice/bxml/verbs/gather.py deleted file mode 100644 index b6aecde8..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/gather.py +++ /dev/null @@ -1,100 +0,0 @@ -""" -gather.py - -Representation of Bandwidth's gather BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -GATHER_TAG = "Gather" - - -class Gather(AbstractBxmlVerb): - - def __init__(self, gather_url=None, gather_method=None, terminating_digits=None, tag=None, max_digits=None, - inter_digit_timeout=None, username=None, password=None, first_digit_timeout=None, - play_audio=None, speak_sentence=None, repeat_count=None, nested_verbs=None, - gather_fallback_url=None, gather_fallback_method=None, fallback_username=None, - fallback_password=None): - """ - Initializes the Gather class with the following parameters - - :param str gather_url: The url to receive the gather callback - :param str gather_method: The HTTP method used to send the gather callback - :param str terminating_digits: The digits used to terminate the gather - :param str tag: Custom string included in callbacks - :param int max_digits: Max digits to press in the gather - :param int inter_digit_timeout: Seconds allowed between digit presses before terminating the gather - :param str username: The username for callback http authentication - :param str password: The password for callback http authentication - :param int first_digit_timeout: Seconds allowed before the first digit press before terminating the gather - :param PlayAudio play_audio: The PlayAudio tag to include in the gather - :param SpeakSentence speak_sentence: The SpeakSentence tag to include in the gather - :param int repeat_count: The number of times to repeat the audio prompt - :param list nested_verbs: The list of verbs to nest in the gather - :param str gather_fallback_url: Fallback url for gather events - :param str gather_fallback_method: HTTP method for fallback requests - :param str fallback_username: Basic auth username for fallback requests - :param str fallback_password: Basic auth password for fallback requests - """ - - self.gather_url = gather_url - self.gather_method = gather_method - self.terminating_digits = terminating_digits - self.tag = tag - self.max_digits = max_digits - self.inter_digit_timeout = inter_digit_timeout - self.username = username - self.password = password - self.first_digit_timeout = first_digit_timeout - self.play_audio = play_audio - self.speak_sentence = speak_sentence - self.repeat_count = repeat_count - self.nested_verbs = nested_verbs - self.gather_fallback_url = gather_fallback_url - self.gather_fallback_method = gather_fallback_method - self.fallback_username = fallback_username - self.fallback_password = fallback_password - - def to_bxml(self): - root = etree.Element(GATHER_TAG) - if self.gather_url is not None: - root.set("gatherUrl", self.gather_url) - if self.gather_method is not None: - root.set("gatherMethod", self.gather_method) - if self.terminating_digits is not None: - root.set("terminatingDigits", self.terminating_digits) - if self.tag is not None: - root.set("tag", self.tag) - if self.max_digits is not None: - root.set("maxDigits", str(self.max_digits)) - if self.inter_digit_timeout is not None: - root.set("interDigitTimeout", str(self.inter_digit_timeout)) - if self.username is not None: - root.set("username", self.username) - if self.password is not None: - root.set("password", self.password) - if self.first_digit_timeout is not None: - root.set("firstDigitTimeout", str(self.first_digit_timeout)) - if self.repeat_count is not None: - root.set("repeatCount", str(self.repeat_count)) - if self.gather_fallback_url is not None: - root.set("gatherFallbackUrl", self.gather_fallback_url) - if self.gather_fallback_method is not None: - root.set("gatherFallbackMethod", self.gather_fallback_method) - if self.fallback_username is not None: - root.set("fallbackUsername", self.fallback_username) - if self.fallback_password is not None: - root.set("fallbackPassword", self.fallback_password) - if self.play_audio is not None: - root.append(self.play_audio.to_etree_element()) - if self.speak_sentence is not None: - root.append(self.speak_sentence.to_etree_element()) - if self.nested_verbs is not None: - for verb in self.nested_verbs: - root.append(verb.to_etree_element()) - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/hangup.py b/build/lib/bandwidth/voice/bxml/verbs/hangup.py deleted file mode 100644 index 99e2e203..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/hangup.py +++ /dev/null @@ -1,15 +0,0 @@ -""" -hangup.py - -Representation of Bandwidth's hangup BXML verb - -@copyright Bandwidth INC -""" - -from .base_verb import AbstractBxmlVerb - - -class Hangup(AbstractBxmlVerb): - - def to_bxml(self): - return "" diff --git a/build/lib/bandwidth/voice/bxml/verbs/pause.py b/build/lib/bandwidth/voice/bxml/verbs/pause.py deleted file mode 100644 index 827358e2..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/pause.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -pause.py - -Representation of Bandwidth's pause BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -PAUSE_TAG = "Pause" - - -class Pause(AbstractBxmlVerb): - - def __init__(self, duration): - """ - Initializes the Pause class with the duration parameter - - :param float duration: The time in seconds to pause - """ - self.duration = duration - - def to_bxml(self): - root = etree.Element(PAUSE_TAG) - if self.duration is not None: - root.set("duration", str(self.duration)) - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/pause_recording.py b/build/lib/bandwidth/voice/bxml/verbs/pause_recording.py deleted file mode 100644 index 8aacf4a2..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/pause_recording.py +++ /dev/null @@ -1,15 +0,0 @@ -""" -pause_recording.py - -Representation of Bandwidth's PauseRecording BXML verb - -@copyright Bandwidth INC -""" - -from .base_verb import AbstractBxmlVerb - - -class PauseRecording(AbstractBxmlVerb): - - def to_bxml(self): - return "" diff --git a/build/lib/bandwidth/voice/bxml/verbs/play_audio.py b/build/lib/bandwidth/voice/bxml/verbs/play_audio.py deleted file mode 100644 index b5d19227..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/play_audio.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -play_audio.py - -Representation of Bandwidth's play audio BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -PLAY_AUDIO_TAG = "PlayAudio" - - -class PlayAudio(AbstractBxmlVerb): - - def __init__(self, url=None, username=None, password=None): - """ - Initializes the PlayAudio class with the following parameters - - :param str url: The url of the audio to play - :param str username: The username to authenticate on the url - :param str password: The password to authenticate on the url - """ - self.url = url - self.username = username - self.password = password - - def to_etree_element(self): - """ - Converts the class into an etree element. Used for other verb classes to build xml - - :return etree.Element: The etree Element representing this class - """ - root = etree.Element(PLAY_AUDIO_TAG) - if self.url is not None: - root.text = self.url - if self.username is not None: - root.set("username", self.username) - if self.password is not None: - root.set("password", self.password) - return root - - def to_bxml(self): - return etree.tostring(self.to_etree_element()).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/record.py b/build/lib/bandwidth/voice/bxml/verbs/record.py deleted file mode 100644 index d38b3a67..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/record.py +++ /dev/null @@ -1,104 +0,0 @@ -""" -record.py - -Representation of Bandwidth's redirect BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -RECORD_TAG = "Record" - - -class Record(AbstractBxmlVerb): - - def __init__(self, tag=None, username=None, password=None, record_complete_url=None, record_complete_method=None, - recording_available_url=None, recording_available_method=None, terminating_digits=None, max_duration=None, - file_format=None, transcribe=None, transcription_available_url=None, transcription_available_method=None, - silence_timeout=None, record_complete_fallback_url=None, record_complete_fallback_method=None, - fallback_username=None, fallback_password=None): - """ - Initializes the Record class with the following parameters - - :param str tag: Optional tag to include in the callback - :param str username: Username for http authentication on the redirect url - :param str password: Password for http authentication on the redirect url - :param str record_complete_url: URL for record complete callback - :param str record_complete_method: HTTP method for record complete callback - :param str recording_available_url: URL for record available callback - :param str recording_available_method: HTTP method for record available callback - :param str terminating_digits: Digits to terminate the recording - :param int max_duration: Max duration to record in seconds - :param str file_format: The file format to save the recording in - :param bool transcribe: True to transcribe the recording on completion, False otherwise - :param str transcription_available_url: URL to send the transcriptionAvailable event to. - :param str transcription_available_method: The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST - :param int silence_timeout: Number of seconds of silence that ends the recording - :param str record_complete_fallback_url: URL for fallback events - :param str record_complete_fallback_method: HTTP method for fallback events - :param str fallback_username: Basic auth username for fallback events - :param str fallback_password: Basic auth password for fallback events - """ - self.tag = tag - self.username = username - self.password = password - self.record_complete_url = record_complete_url - self.record_complete_method = record_complete_method - self.recording_available_url = recording_available_url - self.recording_available_method = recording_available_method - self.terminating_digits = terminating_digits - self.max_duration = max_duration - self.file_format = file_format - self.transcribe = transcribe - self.transcription_available_url = transcription_available_url - self.transcription_available_method = transcription_available_method - self.silence_timeout = silence_timeout - self.record_complete_fallback_url = record_complete_fallback_url - self.record_complete_fallback_method = record_complete_fallback_method - self.fallback_username = fallback_username - self.fallback_password = fallback_password - - def to_bxml(self): - root = etree.Element(RECORD_TAG) - if self.tag is not None: - root.set("tag", self.tag) - if self.username is not None: - root.set("username", self.username) - if self.password is not None: - root.set("password", self.password) - if self.record_complete_url is not None: - root.set("recordCompleteUrl", self.record_complete_url) - if self.record_complete_method is not None: - root.set("recordCompleteMethod", self.record_complete_method) - if self.recording_available_url is not None: - root.set("recordingAvailableUrl", self.recording_available_url) - if self.recording_available_method is not None: - root.set("recordingAvailableMethod", self.recording_available_method) - if self.terminating_digits is not None: - root.set("terminatingDigits", self.terminating_digits) - if self.max_duration is not None: - root.set("maxDuration", str(self.max_duration)) - if self.file_format is not None: - root.set("fileFormat", self.file_format) - if self.transcribe is not None: - #Convert True to "true", or False to "false" - strn = "true" if self.transcribe else "false" - root.set("transcribe", strn) - if self.transcription_available_url is not None: - root.set("transcriptionAvailableUrl", self.transcription_available_url) - if self.transcription_available_method is not None: - root.set("transcriptionAvailableMethod", self.transcription_available_method) - if self.silence_timeout is not None: - root.set("silenceTimeout", str(self.silence_timeout)) - if self.record_complete_fallback_url is not None: - root.set("recordCompleteFallbackUrl", self.record_complete_fallback_url) - if self.record_complete_fallback_method is not None: - root.set("recordCompleteFallbackMethod", self.record_complete_fallback_method) - if self.fallback_username is not None: - root.set("fallbackUsername", self.fallback_username) - if self.fallback_password is not None: - root.set("fallbackPassword", self.fallback_password) - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/redirect.py b/build/lib/bandwidth/voice/bxml/verbs/redirect.py deleted file mode 100644 index 51047009..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/redirect.py +++ /dev/null @@ -1,64 +0,0 @@ -""" -redirect.py - -Representation of Bandwidth's redirect BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -REDIRECT_TAG = "Redirect" - - -class Redirect(AbstractBxmlVerb): - - def __init__(self, redirect_url=None, redirect_method=None, tag=None, username=None, password=None, - redirect_fallback_url=None, redirect_fallback_method=None, - fallback_username=None, fallback_password=None): - """ - Initializes the Redirect class with the following parameters - - :param str redirect_url: The url to retrieve the next BXML - :param str redirect_method: The HTTP method used to retrieve the next url - :param str tag: Optional tag to include in the callback - :param str username: Username for http authentication on the redirect url - :param str password: Password for http authentication on the redirect url - :param str redirect_fallback_url: URL for fallback events - :param str redirect_fallback_method: HTTP method for fallback events - :param str fallback_username: Basic auth username for fallback events - :param str fallback_password: Basic auth password for fallback events - """ - self.redirect_url = redirect_url - self.redirect_method = redirect_method - self.tag = tag - self.username = username - self.password = password - self.redirect_fallback_url = redirect_fallback_url - self.redirect_fallback_method = redirect_fallback_method - self.fallback_username = fallback_username - self.fallback_password = fallback_password - - def to_bxml(self): - root = etree.Element(REDIRECT_TAG) - if self.redirect_url is not None: - root.set("redirectUrl", self.redirect_url) - if self.redirect_method is not None: - root.set("redirectMethod", self.redirect_method) - if self.tag is not None: - root.set("tag", self.tag) - if self.username is not None: - root.set("username", self.username) - if self.password is not None: - root.set("password", self.password) - if self.redirect_fallback_url is not None: - root.set("redirectFallbackUrl", self.redirect_fallback_url) - if self.redirect_fallback_method is not None: - root.set("redirectFallbackMethod", self.redirect_fallback_method) - if self.fallback_username is not None: - root.set("fallbackUsername", self.fallback_username) - if self.fallback_password is not None: - root.set("fallbackPassword", self.fallback_password) - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/resume_recording.py b/build/lib/bandwidth/voice/bxml/verbs/resume_recording.py deleted file mode 100644 index c445648b..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/resume_recording.py +++ /dev/null @@ -1,15 +0,0 @@ -""" -resume_recording.py - -Representation of Bandwidth's ResumeRecording BXML verb - -@copyright Bandwidth INC -""" - -from .base_verb import AbstractBxmlVerb - - -class ResumeRecording(AbstractBxmlVerb): - - def to_bxml(self): - return "" diff --git a/build/lib/bandwidth/voice/bxml/verbs/ring.py b/build/lib/bandwidth/voice/bxml/verbs/ring.py deleted file mode 100644 index a83e2e59..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/ring.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -ring.py - -Representation of Bandwidth's ring BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -RING_TAG = "Ring" - - -class Ring(AbstractBxmlVerb): - - def __init__(self, duration): - """ - Initializes the Ring class with the duration parameter - - :param float duration: The time in seconds to ring - """ - self.duration = duration - - def to_bxml(self): - root = etree.Element(RING_TAG) - if self.duration is not None: - root.set("duration", str(self.duration)) - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/send_dtmf.py b/build/lib/bandwidth/voice/bxml/verbs/send_dtmf.py deleted file mode 100644 index fafa197d..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/send_dtmf.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -send_dtmf.py - -Representation of Bandwidth's send dtmf BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -SEND_DTMF_TAG = "SendDtmf" - - -class SendDtmf(AbstractBxmlVerb): - - def __init__(self, dtmf, tone_duration=None, tone_interval=None): - """ - Initializes the SendDtmf class with the dtmf parameter - - :param str dtmf: The dtmf to build the SendDtmf verb - :param double tone_duration: The length in milliseconds of each DTMF tone - :param double tone_interval: The duration of silence in milliseconds following each DTMF tone - """ - self.dtmf = dtmf - self.tone_duration = tone_duration - self.tone_interval = tone_interval - - def to_bxml(self): - root = etree.Element(SEND_DTMF_TAG) - root.text = self.dtmf - if self.tone_duration is not None: - root.set("toneDuration", str(self.tone_duration)) - if self.tone_interval is not None: - root.set("toneInterval", str(self.tone_interval)) - - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/speak_sentence.py b/build/lib/bandwidth/voice/bxml/verbs/speak_sentence.py deleted file mode 100644 index 36d3a7f0..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/speak_sentence.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -speak_sentence.py - -Representation of Bandwidth's speak sentence BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -import re - -SPEAK_SENTENCE_TAG = "SpeakSentence" -SSML_REGEX = r"<([a-zA-Z//].*?)>" - -class SpeakSentence(AbstractBxmlVerb): - - def __init__(self, sentence=None, voice=None, locale=None, gender=None): - """ - Initializes the SpeakSentence class with the following parameters - - :param str sentence: The sentence to speak - :param str voice: The voice to speak the sentence - :param str locale: The locale of the voice - :param str gender: The gender of the voice - """ - self.sentence = sentence - self.voice = voice - self.locale = locale - self.gender = gender - - def to_etree_element(self): - """ - Converts the class into an etree element. Used for other verb classes to build xml - - :return etree.Element: The etree Element representing this class - """ - root = etree.Element(SPEAK_SENTENCE_TAG) - if self.sentence is not None: - root.text = self.sentence - if self.voice is not None: - root.set("voice", self.voice) - if self.locale is not None: - root.set("locale", self.locale) - if self.gender is not None: - root.set("gender", self.gender) - return root - - def to_bxml(self): - return re.sub(SSML_REGEX, r"<\1>", etree.tostring(self.to_etree_element()).decode()) diff --git a/build/lib/bandwidth/voice/bxml/verbs/start_gather.py b/build/lib/bandwidth/voice/bxml/verbs/start_gather.py deleted file mode 100644 index 68efa542..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/start_gather.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -startGather.py - -Representation of Bandwidth's startGather BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -START_GATHER_TAG = "StartGather" - - -class StartGather(AbstractBxmlVerb): - - def __init__(self, dtmfUrl=None, dtmfMethod=None, username=None, password=None, tag=None): - """ - Initializes the Gather class with the following parameters - - :param str dtmfUrl: The url to receive the dtmf event - :param str dtmfMethod: The HTTP method used to send the gather dtmfUrl event - :param str username: The username for callback http authentication - :param str password: The password for callback http authentication - :param str tag: - """ - - self.dtmfUrl = dtmfUrl - self.dtmfMethod = dtmfMethod - self.username = username - self.password = password - self.tag = tag - - def to_bxml(self): - root = etree.Element(START_GATHER_TAG) - if self.dtmfUrl is not None: - root.set("dtmfUrl", self.dtmfUrl) - if self.dtmfMethod is not None: - root.set("dtmfMethod", self.dtmfMethod) - if self.username is not None: - root.set("username", self.username) - if self.password is not None: - root.set("password", self.password) - if self.tag is not None: - root.set("tag", self.tag) - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/start_recording.py b/build/lib/bandwidth/voice/bxml/verbs/start_recording.py deleted file mode 100644 index 887eef99..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/start_recording.py +++ /dev/null @@ -1,71 +0,0 @@ -""" -start_recording.py - -Representation of Bandwidth's StartRecording BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -START_RECORDING_TAG = "StartRecording" - - -class StartRecording(AbstractBxmlVerb): - - def __init__(self, tag=None, username=None, password=None, recording_available_url=None, recording_available_method=None, - file_format=None, multi_channel=None, transcribe=None, transcription_available_url=None, transcription_available_method=None): - """ - Initializes the Record class with the following parameters - - :param str tag: Optional tag to include in the callback - :param str username: Username for http authentication on the redirect url - :param str password: Password for http authentication on the redirect url - :param str recording_available_url: URL for record available callback - :param str recording_available_method: HTTP method for record available callback - :param str file_format: The file format to save the recording in - :param bool multi_channel: Whether or not to record the channels separately (default is false, 1 recording) - :param bool transcribe: True to transcribe the recording on completion, False otherwise - :param str transcription_available_url: URL to send the transcriptionAvailable event to. - :param str transcription_available_method: The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST - """ - self.tag = tag - self.username = username - self.password = password - self.recording_available_url = recording_available_url - self.recording_available_method = recording_available_method - self.file_format = file_format - self.multi_channel = multi_channel - self.transcribe = transcribe - self.transcription_available_url = transcription_available_url - self.transcription_available_method = transcription_available_method - - def to_bxml(self): - root = etree.Element(START_RECORDING_TAG) - if self.tag is not None: - root.set("tag", self.tag) - if self.username is not None: - root.set("username", self.username) - if self.password is not None: - root.set("password", self.password) - if self.recording_available_url is not None: - root.set("recordingAvailableUrl", self.recording_available_url) - if self.recording_available_method is not None: - root.set("recordingAvailableMethod", self.recording_available_method) - if self.file_format is not None: - root.set("fileFormat", self.file_format) - if self.multi_channel is not None: - #Convert True to "true", or False to "false" - strn = "true" if self.multi_channel else "false" - root.set("multiChannel", strn) - if self.transcribe is not None: - #Convert True to "true", or False to "false" - strn = "true" if self.transcribe else "false" - root.set("transcribe", strn) - if self.transcription_available_url is not None: - root.set("transcriptionAvailableUrl", self.transcription_available_url) - if self.transcription_available_method is not None: - root.set("transcriptionAvailableMethod", self.transcription_available_method) - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/bxml/verbs/stop_gather.py b/build/lib/bandwidth/voice/bxml/verbs/stop_gather.py deleted file mode 100644 index 6ad39862..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/stop_gather.py +++ /dev/null @@ -1,15 +0,0 @@ -""" -stopGather.py - -Representation of Bandwidth's stopGather BXML verb - -@copyright Bandwidth INC -""" - -from .base_verb import AbstractBxmlVerb - - -class StopGather(AbstractBxmlVerb): - - def to_bxml(self): - return "" diff --git a/build/lib/bandwidth/voice/bxml/verbs/stop_recording.py b/build/lib/bandwidth/voice/bxml/verbs/stop_recording.py deleted file mode 100644 index 0231eae1..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/stop_recording.py +++ /dev/null @@ -1,15 +0,0 @@ -""" -stop_recording.py - -Representation of Bandwidth's StopRecording BXML verb - -@copyright Bandwidth INC -""" - -from .base_verb import AbstractBxmlVerb - - -class StopRecording(AbstractBxmlVerb): - - def to_bxml(self): - return "" diff --git a/build/lib/bandwidth/voice/bxml/verbs/transfer.py b/build/lib/bandwidth/voice/bxml/verbs/transfer.py deleted file mode 100644 index be71c450..00000000 --- a/build/lib/bandwidth/voice/bxml/verbs/transfer.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -transfer.py - -Representation of Bandwidth's transfer BXML verb - -@copyright Bandwidth INC -""" - -from lxml import etree - -from .base_verb import AbstractBxmlVerb - -TRANSFER_TAG = "Transfer" - - -class Transfer(AbstractBxmlVerb): - - def __init__(self, transfer_caller_id=None, call_timeout=None, tag=None, transfer_complete_url=None, - transfer_complete_method=None, username=None, password=None, diversion_treatment=None, - diversion_reason=None, phone_numbers=None, - transfer_complete_fallback_url=None, transfer_complete_fallback_method=None, - fallback_username=None, fallback_password=None): - """ - Initializes the Transfer class with the following parameters - - :param str transfer_caller_id: The phone number to make the transfer - :param int call_timeout: The number of seconds to wait before timing out the transfer - :param str tag: Custom tag to be included in callbacks - :param str transfer_complete_url: The url to receive the transfer complete callback - :param str transfer_complete_method: The HTTP method used to send the transfer complete callback - :param str username: The username to authenticate on the transfer complete url - :param str password: The password to authenticate on the transfer complete url - :param str diversion_treatment: The diversion treatment for the call - :param str diversion_reason: The diversion reason for the call - :param list phone_numbers: The numbers to receive the transferred call - :param str transfer_complete_fallback_url: URL for fallback events - :param str transfer_complete_fallback_method: HTTP method for fallback events - :param str fallback_username: Basic auth username for fallback events - :param str fallback_password: Basic auth password for fallback events - """ - self.transfer_caller_id = transfer_caller_id - self.call_timeout = call_timeout - self.tag = tag - self.transfer_complete_url = transfer_complete_url - self.transfer_complete_method = transfer_complete_method - self.username = username - self.password = password - self.diversion_treatment = diversion_treatment - self.diversion_reason = diversion_reason - self.phone_numbers = phone_numbers - self.transfer_complete_fallback_url = transfer_complete_fallback_url - self.transfer_complete_fallback_method = transfer_complete_fallback_method - self.fallback_username = fallback_username - self.fallback_password = fallback_password - - def to_bxml(self): - root = etree.Element(TRANSFER_TAG) - if self.transfer_caller_id is not None: - root.set("transferCallerId", self.transfer_caller_id) - if self.call_timeout is not None: - root.set("callTimeout", str(self.call_timeout)) - if self.tag is not None: - root.set("tag", self.tag) - if self.transfer_complete_url is not None: - root.set("transferCompleteUrl", self.transfer_complete_url) - if self.transfer_complete_method is not None: - root.set("transferCompleteMethod", self.transfer_complete_method) - if self.username is not None: - root.set("username", self.username) - if self.password is not None: - root.set("password", self.password) - if self.diversion_treatment is not None: - root.set("diversionTreatment", self.diversion_treatment) - if self.diversion_reason is not None: - root.set("diversionReason", self.diversion_reason) - if self.transfer_complete_fallback_url is not None: - root.set("transferCompleteFallbackUrl", self.transfer_complete_fallback_url) - if self.transfer_complete_fallback_method is not None: - root.set("transferCompleteFallbackMethod", self.transfer_complete_fallback_method) - if self.fallback_username is not None: - root.set("fallbackUsername", self.fallback_username) - if self.fallback_password is not None: - root.set("fallbackPassword", self.fallback_password) - if self.phone_numbers is not None: - for phone_number in self.phone_numbers: - root.append(phone_number.to_etree_element()) - return etree.tostring(root).decode() diff --git a/build/lib/bandwidth/voice/controllers/__init__.py b/build/lib/bandwidth/voice/controllers/__init__.py deleted file mode 100644 index c1660224..00000000 --- a/build/lib/bandwidth/voice/controllers/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -__all__ = [ - 'base_controller', - 'api_controller', -] diff --git a/build/lib/bandwidth/voice/controllers/api_controller.py b/build/lib/bandwidth/voice/controllers/api_controller.py deleted file mode 100644 index 472cb35f..00000000 --- a/build/lib/bandwidth/voice/controllers/api_controller.py +++ /dev/null @@ -1,1445 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -from bandwidth.configuration import Server -from bandwidth.http.api_response import ApiResponse -from bandwidth.voice.controllers.base_controller import BaseController -from bandwidth.http.auth.voice_basic_auth import VoiceBasicAuth -from bandwidth.voice.models.api_call_response import ApiCallResponse -from bandwidth.voice.models.api_call_state_response import ApiCallStateResponse -from bandwidth.voice.models.recording_metadata_response import RecordingMetadataResponse -from bandwidth.voice.models.transcription_response import TranscriptionResponse -from bandwidth.voice.models.conference_detail import ConferenceDetail -from bandwidth.voice.models.conference_member_detail import ConferenceMemberDetail -from bandwidth.voice.models.conference_recording_metadata_response import ConferenceRecordingMetadataResponse -from bandwidth.voice.exceptions.api_error_response_exception import ApiErrorResponseException -from bandwidth.exceptions.api_exception import APIException - - -class APIController(BaseController): - - """A Controller to access Endpoints in the bandwidth API.""" - - def __init__(self, config, call_back=None): - super(APIController, self).__init__(config, call_back) - - def create_call(self, - account_id, - body=None): - """Does a POST request to /api/v2/accounts/{accountId}/calls. - - Creates an outbound call - - Args: - account_id (string): TODO: type description here. - body (ApiCreateCallRequest, optional): TODO: type description - here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json', - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, ApiCallResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def get_call_state(self, - account_id, - call_id): - """Does a GET request to /api/v2/accounts/{accountId}/calls/{callId}. - - Returns near-realtime metadata about the specified call - - Args: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls/{callId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, ApiCallStateResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def modify_call(self, - account_id, - call_id, - body=None): - """Does a POST request to /api/v2/accounts/{accountId}/calls/{callId}. - - Interrupts and replaces an active call's BXML document - - Args: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - body (ApiModifyCallRequest, optional): TODO: type description - here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls/{callId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def modify_call_recording_state(self, - account_id, - call_id, - body=None): - """Does a PUT request to /api/v2/accounts/{accountId}/calls/{callId}/recording. - - Pauses or resumes a recording - - Args: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - body (ModifyCallRecordingState, optional): TODO: type description - here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls/{callId}/recording' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def get_query_metadata_for_account_and_call(self, - account_id, - call_id): - """Does a GET request to /api/v2/accounts/{accountId}/calls/{callId}/recordings. - - Returns a (potentially empty) list of metadata for the recordings that - took place during the specified call - - Args: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls/{callId}/recordings' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, RecordingMetadataResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def get_metadata_for_recording(self, - account_id, - call_id, - recording_id): - """Does a GET request to /api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}. - - Returns metadata for the specified recording - - Args: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - recording_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True}, - 'recordingId': {'value': recording_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, RecordingMetadataResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def delete_recording(self, - account_id, - call_id, - recording_id): - """Does a DELETE request to /api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}. - - Deletes the specified recording - - Args: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - recording_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True}, - 'recordingId': {'value': recording_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare and execute request - _request = self.config.http_client.delete(_query_url) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def get_stream_recording_media(self, - account_id, - call_id, - recording_id): - """Does a GET request to /api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media. - - Downloads the specified recording - - Args: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - recording_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True}, - 'recordingId': {'value': recording_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare and execute request - _request = self.config.http_client.get(_query_url) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request, binary=True) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = _response.text - _result = ApiResponse(_response, body=decoded) - return _result - - def delete_recording_media(self, - account_id, - call_id, - recording_id): - """Does a DELETE request to /api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media. - - Deletes the specified recording's media - - Args: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - recording_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True}, - 'recordingId': {'value': recording_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare and execute request - _request = self.config.http_client.delete(_query_url) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def get_recording_transcription(self, - account_id, - call_id, - recording_id): - """Does a GET request to /api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription. - - Downloads the specified transcription - - Args: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - recording_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True}, - 'recordingId': {'value': recording_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, TranscriptionResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def create_transcribe_recording(self, - account_id, - call_id, - recording_id, - body=None): - """Does a POST request to /api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription. - - Requests that the specified recording be transcribed - - Args: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - recording_id (string): TODO: type description here. - body (ApiTranscribeRecordingRequest, optional): TODO: type - description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True}, - 'recordingId': {'value': recording_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 410: - raise ApiErrorResponseException('The media for this recording has been deleted, so we can\'t transcribe it', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def delete_recording_transcription(self, - account_id, - call_id, - recording_id): - """Does a DELETE request to /api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription. - - Deletes the specified recording's transcription - - Args: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - recording_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True}, - 'recordingId': {'value': recording_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare and execute request - _request = self.config.http_client.delete(_query_url) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def get_conferences_by_account(self, - account_id, - page_size=1000, - page_token=None, - name=None, - min_created_time=None, - max_created_time=None): - """Does a GET request to /api/v2/accounts/{accountId}/conferences. - - Returns information about the conferences in the account - - Args: - account_id (string): TODO: type description here. - page_size (int, optional): TODO: type description here. Example: - 1000 - page_token (string, optional): TODO: type description here. - name (string, optional): TODO: type description here. - min_created_time (string, optional): TODO: type description here. - max_created_time (string, optional): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/conferences' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_parameters = { - 'pageSize': page_size, - 'pageToken': page_token, - 'name': name, - 'minCreatedTime': min_created_time, - 'maxCreatedTime': max_created_time - } - _query_builder = APIHelper.append_url_with_query_parameters( - _query_builder, - _query_parameters - ) - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, ConferenceDetail.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def get_conference_by_id(self, - account_id, - conference_id): - """Does a GET request to /api/v2/accounts/{accountId}/conferences/{conferenceId}. - - Returns information about the specified conference - - Args: - account_id (string): TODO: type description here. - conference_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'conferenceId': {'value': conference_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, ConferenceDetail.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def modify_conference(self, - account_id, - conference_id, - body=None): - """Does a POST request to /api/v2/accounts/{accountId}/conferences/{conferenceId}. - - Modify the conference state - - Args: - account_id (string): TODO: type description here. - conference_id (string): TODO: type description here. - body (CallEngineModifyConferenceRequest, optional): TODO: type - description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'conferenceId': {'value': conference_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def modify_conference_member(self, - account_id, - conference_id, - call_id, - body=None): - """Does a PUT request to /api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{callId}. - - Updates settings for a particular conference member - - Args: - account_id (string): TODO: type description here. - conference_id (string): TODO: type description here. - call_id (string): TODO: type description here. - body (ConferenceMemberDetail, optional): TODO: type description - here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{callId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'conferenceId': {'value': conference_id, 'encode': True}, - 'callId': {'value': call_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def get_conference_member(self, - account_id, - conference_id, - member_id): - """Does a GET request to /api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}. - - Returns information about the specified conference member - - Args: - account_id (string): TODO: type description here. - conference_id (string): TODO: type description here. - member_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'conferenceId': {'value': conference_id, 'encode': True}, - 'memberId': {'value': member_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, ConferenceMemberDetail.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def get_query_metadata_for_account_and_conference(self, - account_id, - conference_id): - """Does a GET request to /api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings. - - Returns a (potentially empty) list of metadata for the recordings that - took place during the specified conference - - Args: - account_id (string): TODO: type description here. - conference_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'conferenceId': {'value': conference_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, ConferenceRecordingMetadataResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def get_metadata_for_conference_recording(self, - account_id, - conference_id, - recording_id): - """Does a GET request to /api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}. - - Returns metadata for the specified recording - - Args: - account_id (string): TODO: type description here. - conference_id (string): TODO: type description here. - recording_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'conferenceId': {'value': conference_id, 'encode': True}, - 'recordingId': {'value': recording_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, RecordingMetadataResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def get_stream_conference_recording_media(self, - account_id, - conference_id, - recording_id): - """Does a GET request to /api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media. - - Downloads the specified recording - - Args: - account_id (string): TODO: type description here. - conference_id (string): TODO: type description here. - recording_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'conferenceId': {'value': conference_id, 'encode': True}, - 'recordingId': {'value': recording_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare and execute request - _request = self.config.http_client.get(_query_url) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request, binary=True) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = _response.text - _result = ApiResponse(_response, body=decoded) - return _result - - def get_query_metadata_for_account(self, - account_id, - mfrom=None, - to=None, - min_start_time=None, - max_start_time=None): - """Does a GET request to /api/v2/accounts/{accountId}/recordings. - - Returns a list of metadata for the recordings associated with the - specified account. The list can be filtered by the optional from, to, - minStartTime, and maxStartTime arguments. The list is capped at 1000 - entries and may be empty if no recordings match the specified - criteria. - - Args: - account_id (string): TODO: type description here. - mfrom (string, optional): TODO: type description here. - to (string, optional): TODO: type description here. - min_start_time (string, optional): TODO: type description here. - max_start_time (string, optional): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. - successful operation - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/api/v2/accounts/{accountId}/recordings' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.VOICEDEFAULT) - _query_builder += _url_path - _query_parameters = { - 'from': mfrom, - 'to': to, - 'minStartTime': min_start_time, - 'maxStartTime': max_start_time - } - _query_builder = APIHelper.append_url_with_query_parameters( - _query_builder, - _query_parameters - ) - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - VoiceBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise ApiErrorResponseException('Something\'s not quite right... Your request is invalid. Please fix it before trying again.', _response) - elif _response.status_code == 401: - raise APIException('Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.', _response) - elif _response.status_code == 403: - raise ApiErrorResponseException('User unauthorized to perform this action.', _response) - elif _response.status_code == 404: - raise ApiErrorResponseException('The resource specified cannot be found or does not belong to you.', _response) - elif _response.status_code == 415: - raise ApiErrorResponseException('We don\'t support that media type. If a request body is required, please send it to us as `application/json`.', _response) - elif _response.status_code == 429: - raise ApiErrorResponseException('You\'re sending requests to this endpoint too frequently. Please slow your request rate down and try again.', _response) - elif _response.status_code == 500: - raise ApiErrorResponseException('Something unexpected happened. Please try again.', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, RecordingMetadataResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result diff --git a/build/lib/bandwidth/voice/controllers/base_controller.py b/build/lib/bandwidth/voice/controllers/base_controller.py deleted file mode 100644 index 3f7583fb..00000000 --- a/build/lib/bandwidth/voice/controllers/base_controller.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -from bandwidth.exceptions.api_exception import APIException - - -class BaseController(object): - - """All controllers inherit from this base class. - - Attributes: - config (Configuration): The HttpClient which a specific controller - instance will use. By default all the controller objects share - the same HttpClient. A user can use his own custom HttpClient - as well. - http_call_back (HttpCallBack): An object which holds call back - methods to be called before and after the execution of an HttpRequest. - global_headers (dict): The global headers of the API which are sent with - every request. - - """ - - def global_headers(self): - return { - 'user-agent': 'python-sdk-refs/tags/python6.13.2' - } - - def __init__(self, config, call_back=None): - self._config = config - self._http_call_back = call_back - - @property - def config(self): - return self._config - - @property - def http_call_back(self): - return self._http_call_back - - def validate_parameters(self, **kwargs): - """Validates required parameters of an endpoint. - - Args: - kwargs (dict): A dictionary of the required parameters. - - """ - for name, value in kwargs.items(): - if value is None: - raise ValueError("Required parameter {} cannot be None.".format(name)) - - def execute_request(self, request, binary=False): - """Executes an HttpRequest. - - Args: - request (HttpRequest): The HttpRequest to execute. - binary (bool): A flag which should be set to True if - a binary response is expected. - - Returns: - HttpResponse: The HttpResponse received. - - """ - # Invoke the on before request HttpCallBack if specified - if self.http_call_back is not None: - self.http_call_back.on_before_request(request) - - # Add global headers to request - request.headers = APIHelper.merge_dicts(self.global_headers(), request.headers) - - # Invoke the API call to fetch the response. - func = self.config.http_client.execute_as_binary if binary else self.config.http_client.execute_as_string - response = func(request) - - # Invoke the on after response HttpCallBack if specified - if self.http_call_back is not None: - self.http_call_back.on_after_response(response) - - return response - - def validate_response(self, response): - """Validates an HTTP response by checking for global errors. - - Args: - response (HttpResponse): The HttpResponse of the API call. - - """ - if (response.status_code < 200) or (response.status_code > 208): # [200,208] = HTTP OK - raise APIException('HTTP response not OK.', response) diff --git a/build/lib/bandwidth/voice/exceptions/__init__.py b/build/lib/bandwidth/voice/exceptions/__init__.py deleted file mode 100644 index ab7800b4..00000000 --- a/build/lib/bandwidth/voice/exceptions/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -__all__ = [ - 'api_error_response_exception', -] diff --git a/build/lib/bandwidth/voice/exceptions/api_error_response_exception.py b/build/lib/bandwidth/voice/exceptions/api_error_response_exception.py deleted file mode 100644 index 470d35f9..00000000 --- a/build/lib/bandwidth/voice/exceptions/api_error_response_exception.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -import bandwidth.exceptions.api_exception - - -class ApiErrorResponseException(bandwidth.exceptions.api_exception.APIException): - def __init__(self, reason, response): - """Constructor for the ApiErrorResponseException class - - Args: - reason (string): The reason (or error message) for the Exception - to be raised. - response (HttpResponse): The HttpResponse of the API call. - - """ - super(ApiErrorResponseException, self).__init__(reason, response) - dictionary = APIHelper.json_deserialize(self.response.text) - if isinstance(dictionary, dict): - self.unbox(dictionary) - - def unbox(self, dictionary): - """Populates the properties of this object by extracting them from a dictionary. - - Args: - dictionary (dictionary): A dictionary representation of the object as - obtained from the deserialization of the server's response. The keys - MUST match property names in the API description. - - """ - self.mtype = dictionary.get('type') - self.description = dictionary.get('description') - self.id = dictionary.get('id') diff --git a/build/lib/bandwidth/voice/models/__init__.py b/build/lib/bandwidth/voice/models/__init__.py deleted file mode 100644 index 1b9d7f05..00000000 --- a/build/lib/bandwidth/voice/models/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -__all__ = [ - 'api_call_response', - 'api_call_state_response', - 'api_create_call_request', - 'api_modify_call_request', - 'call_engine_modify_conference_request', - 'api_transcribe_recording_request', - 'conference_detail', - 'conference_member_detail', - 'conference_recording_metadata_response', - 'modify_call_recording_state', - 'recording_metadata_response', - 'transcript', - 'transcription', - 'transcription_response', - 'answer_fallback_method_enum', - 'answer_method_enum', - 'callback_method_enum', - 'conference_event_method_enum', - 'direction_enum', - 'disconnect_cause_enum', - 'disconnect_method_enum', - 'file_format_enum', - 'redirect_fallback_method_enum', - 'redirect_method_enum', - 'state_enum', - 'state_1_enum', - 'state_2_enum', - 'status_enum', - 'status_1_enum', - 'status_3_enum', -] diff --git a/build/lib/bandwidth/voice/models/answer_fallback_method_enum.py b/build/lib/bandwidth/voice/models/answer_fallback_method_enum.py deleted file mode 100644 index 733c621d..00000000 --- a/build/lib/bandwidth/voice/models/answer_fallback_method_enum.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class AnswerFallbackMethodEnum(object): - - """Implementation of the 'AnswerFallbackMethod' enum. - - TODO: type enum description here. - - Attributes: - POST: TODO: type description here. - GET: TODO: type description here. - - """ - - POST = 'POST' - - GET = 'GET' diff --git a/build/lib/bandwidth/voice/models/answer_method_enum.py b/build/lib/bandwidth/voice/models/answer_method_enum.py deleted file mode 100644 index 8d174748..00000000 --- a/build/lib/bandwidth/voice/models/answer_method_enum.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class AnswerMethodEnum(object): - - """Implementation of the 'AnswerMethod' enum. - - TODO: type enum description here. - - Attributes: - POST: TODO: type description here. - GET: TODO: type description here. - - """ - - POST = 'POST' - - GET = 'GET' diff --git a/build/lib/bandwidth/voice/models/api_call_response.py b/build/lib/bandwidth/voice/models/api_call_response.py deleted file mode 100644 index 39467f60..00000000 --- a/build/lib/bandwidth/voice/models/api_call_response.py +++ /dev/null @@ -1,171 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" -from bandwidth.api_helper import APIHelper - - -class ApiCallResponse(object): - - """Implementation of the 'ApiCallResponse' model. - - TODO: type model description here. - - Attributes: - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - application_id (string): TODO: type description here. - to (string): TODO: type description here. - mfrom (string): TODO: type description here. - start_time (datetime): TODO: type description here. - call_url (string): TODO: type description here. - call_timeout (float): TODO: type description here. - callback_timeout (float): TODO: type description here. - answer_url (string): TODO: type description here. - answer_method (AnswerMethodEnum): TODO: type description here. - answer_fallback_url (string): TODO: type description here. - answer_fallback_method (AnswerFallbackMethodEnum): TODO: type - description here. - disconnect_url (string): TODO: type description here. - disconnect_method (DisconnectMethodEnum): TODO: type description - here. - username (string): TODO: type description here. - password (string): TODO: type description here. - fallback_username (string): TODO: type description here. - fallback_password (string): TODO: type description here. - tag (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "account_id": 'accountId', - "call_id": 'callId', - "application_id": 'applicationId', - "to": 'to', - "mfrom": 'from', - "call_url": 'callUrl', - "answer_url": 'answerUrl', - "answer_method": 'answerMethod', - "disconnect_method": 'disconnectMethod', - "start_time": 'startTime', - "call_timeout": 'callTimeout', - "callback_timeout": 'callbackTimeout', - "answer_fallback_url": 'answerFallbackUrl', - "answer_fallback_method": 'answerFallbackMethod', - "disconnect_url": 'disconnectUrl', - "username": 'username', - "password": 'password', - "fallback_username": 'fallbackUsername', - "fallback_password": 'fallbackPassword', - "tag": 'tag' - } - - def __init__(self, - account_id=None, - call_id=None, - application_id=None, - to=None, - mfrom=None, - call_url=None, - answer_url=None, - answer_method=None, - disconnect_method=None, - start_time=None, - call_timeout=None, - callback_timeout=None, - answer_fallback_url=None, - answer_fallback_method=None, - disconnect_url=None, - username=None, - password=None, - fallback_username=None, - fallback_password=None, - tag=None): - """Constructor for the ApiCallResponse class""" - - # Initialize members of the class - self.account_id = account_id - self.call_id = call_id - self.application_id = application_id - self.to = to - self.mfrom = mfrom - self.start_time = APIHelper.RFC3339DateTime(start_time) if start_time else None - self.call_url = call_url - self.call_timeout = call_timeout - self.callback_timeout = callback_timeout - self.answer_url = answer_url - self.answer_method = answer_method - self.answer_fallback_url = answer_fallback_url - self.answer_fallback_method = answer_fallback_method - self.disconnect_url = disconnect_url - self.disconnect_method = disconnect_method - self.username = username - self.password = password - self.fallback_username = fallback_username - self.fallback_password = fallback_password - self.tag = tag - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - account_id = dictionary.get('accountId') - call_id = dictionary.get('callId') - application_id = dictionary.get('applicationId') - to = dictionary.get('to') - mfrom = dictionary.get('from') - call_url = dictionary.get('callUrl') - answer_url = dictionary.get('answerUrl') - answer_method = dictionary.get('answerMethod') - disconnect_method = dictionary.get('disconnectMethod') - start_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("startTime")).datetime if dictionary.get("startTime") else None - call_timeout = dictionary.get('callTimeout') - callback_timeout = dictionary.get('callbackTimeout') - answer_fallback_url = dictionary.get('answerFallbackUrl') - answer_fallback_method = dictionary.get('answerFallbackMethod') - disconnect_url = dictionary.get('disconnectUrl') - username = dictionary.get('username') - password = dictionary.get('password') - fallback_username = dictionary.get('fallbackUsername') - fallback_password = dictionary.get('fallbackPassword') - tag = dictionary.get('tag') - - # Return an object of this model - return cls(account_id, - call_id, - application_id, - to, - mfrom, - call_url, - answer_url, - answer_method, - disconnect_method, - start_time, - call_timeout, - callback_timeout, - answer_fallback_url, - answer_fallback_method, - disconnect_url, - username, - password, - fallback_username, - fallback_password, - tag) diff --git a/build/lib/bandwidth/voice/models/api_call_state_response.py b/build/lib/bandwidth/voice/models/api_call_state_response.py deleted file mode 100644 index 44e740d7..00000000 --- a/build/lib/bandwidth/voice/models/api_call_state_response.py +++ /dev/null @@ -1,139 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" -from bandwidth.api_helper import APIHelper - - -class ApiCallStateResponse(object): - - """Implementation of the 'ApiCallStateResponse' model. - - TODO: type model description here. - - Attributes: - call_id (string): TODO: type description here. - parent_call_id (string): TODO: type description here. - application_id (string): TODO: type description here. - account_id (string): TODO: type description here. - to (string): TODO: type description here. - mfrom (string): TODO: type description here. - direction (string): TODO: type description here. - state (StateEnum): TODO: type description here. - start_time (datetime): TODO: type description here. - answer_time (datetime): TODO: type description here. - end_time (datetime): TODO: type description here. - disconnect_cause (DisconnectCauseEnum): TODO: type description here. - error_message (string): TODO: type description here. - error_id (string): TODO: type description here. - last_update (datetime): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "call_id": 'callId', - "parent_call_id": 'parentCallId', - "application_id": 'applicationId', - "account_id": 'accountId', - "to": 'to', - "mfrom": 'from', - "direction": 'direction', - "state": 'state', - "start_time": 'startTime', - "answer_time": 'answerTime', - "end_time": 'endTime', - "disconnect_cause": 'disconnectCause', - "error_message": 'errorMessage', - "error_id": 'errorId', - "last_update": 'lastUpdate' - } - - def __init__(self, - call_id=None, - parent_call_id=None, - application_id=None, - account_id=None, - to=None, - mfrom=None, - direction=None, - state=None, - start_time=None, - answer_time=None, - end_time=None, - disconnect_cause=None, - error_message=None, - error_id=None, - last_update=None): - """Constructor for the ApiCallStateResponse class""" - - # Initialize members of the class - self.call_id = call_id - self.parent_call_id = parent_call_id - self.application_id = application_id - self.account_id = account_id - self.to = to - self.mfrom = mfrom - self.direction = direction - self.state = state - self.start_time = APIHelper.RFC3339DateTime(start_time) if start_time else None - self.answer_time = APIHelper.RFC3339DateTime(answer_time) if answer_time else None - self.end_time = APIHelper.RFC3339DateTime(end_time) if end_time else None - self.disconnect_cause = disconnect_cause - self.error_message = error_message - self.error_id = error_id - self.last_update = APIHelper.RFC3339DateTime(last_update) if last_update else None - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - call_id = dictionary.get('callId') - parent_call_id = dictionary.get('parentCallId') - application_id = dictionary.get('applicationId') - account_id = dictionary.get('accountId') - to = dictionary.get('to') - mfrom = dictionary.get('from') - direction = dictionary.get('direction') - state = dictionary.get('state') - start_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("startTime")).datetime if dictionary.get("startTime") else None - answer_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("answerTime")).datetime if dictionary.get("answerTime") else None - end_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("endTime")).datetime if dictionary.get("endTime") else None - disconnect_cause = dictionary.get('disconnectCause') - error_message = dictionary.get('errorMessage') - error_id = dictionary.get('errorId') - last_update = APIHelper.RFC3339DateTime.from_value(dictionary.get("lastUpdate")).datetime if dictionary.get("lastUpdate") else None - - # Return an object of this model - return cls(call_id, - parent_call_id, - application_id, - account_id, - to, - mfrom, - direction, - state, - start_time, - answer_time, - end_time, - disconnect_cause, - error_message, - error_id, - last_update) diff --git a/build/lib/bandwidth/voice/models/api_create_call_request.py b/build/lib/bandwidth/voice/models/api_create_call_request.py deleted file mode 100644 index 7351a3f8..00000000 --- a/build/lib/bandwidth/voice/models/api_create_call_request.py +++ /dev/null @@ -1,158 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class ApiCreateCallRequest(object): - - """Implementation of the 'ApiCreateCallRequest' model. - - TODO: type model description here. - - Attributes: - mfrom (string): Format is E164 - to (string): Format is E164 - call_timeout (float): TODO: type description here. - callback_timeout (float): TODO: type description here. - answer_url (string): TODO: type description here. - answer_fallback_url (string): TODO: type description here. - username (string): TODO: type description here. - password (string): TODO: type description here. - fallback_username (string): TODO: type description here. - fallback_password (string): TODO: type description here. - answer_method (AnswerMethodEnum): TODO: type description here. - answer_fallback_method (AnswerFallbackMethodEnum): TODO: type - description here. - disconnect_url (string): TODO: type description here. - disconnect_method (DisconnectMethodEnum): TODO: type description - here. - tag (string): TODO: type description here. - application_id (string): TODO: type description here. - obfuscated_to (string): TODO: type description here. - obfuscated_from (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "mfrom": 'from', - "to": 'to', - "answer_url": 'answerUrl', - "application_id": 'applicationId', - "call_timeout": 'callTimeout', - "callback_timeout": 'callbackTimeout', - "answer_fallback_url": 'answerFallbackUrl', - "username": 'username', - "password": 'password', - "fallback_username": 'fallbackUsername', - "fallback_password": 'fallbackPassword', - "answer_method": 'answerMethod', - "answer_fallback_method": 'answerFallbackMethod', - "disconnect_url": 'disconnectUrl', - "disconnect_method": 'disconnectMethod', - "tag": 'tag', - "obfuscated_to": 'obfuscatedTo', - "obfuscated_from": 'obfuscatedFrom' - } - - def __init__(self, - mfrom=None, - to=None, - answer_url=None, - application_id=None, - call_timeout=None, - callback_timeout=None, - answer_fallback_url=None, - username=None, - password=None, - fallback_username=None, - fallback_password=None, - answer_method=None, - answer_fallback_method=None, - disconnect_url=None, - disconnect_method=None, - tag=None, - obfuscated_to=None, - obfuscated_from=None): - """Constructor for the ApiCreateCallRequest class""" - - # Initialize members of the class - self.mfrom = mfrom - self.to = to - self.call_timeout = call_timeout - self.callback_timeout = callback_timeout - self.answer_url = answer_url - self.answer_fallback_url = answer_fallback_url - self.username = username - self.password = password - self.fallback_username = fallback_username - self.fallback_password = fallback_password - self.answer_method = answer_method - self.answer_fallback_method = answer_fallback_method - self.disconnect_url = disconnect_url - self.disconnect_method = disconnect_method - self.tag = tag - self.application_id = application_id - self.obfuscated_to = obfuscated_to - self.obfuscated_from = obfuscated_from - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - mfrom = dictionary.get('from') - to = dictionary.get('to') - answer_url = dictionary.get('answerUrl') - application_id = dictionary.get('applicationId') - call_timeout = dictionary.get('callTimeout') - callback_timeout = dictionary.get('callbackTimeout') - answer_fallback_url = dictionary.get('answerFallbackUrl') - username = dictionary.get('username') - password = dictionary.get('password') - fallback_username = dictionary.get('fallbackUsername') - fallback_password = dictionary.get('fallbackPassword') - answer_method = dictionary.get('answerMethod') - answer_fallback_method = dictionary.get('answerFallbackMethod') - disconnect_url = dictionary.get('disconnectUrl') - disconnect_method = dictionary.get('disconnectMethod') - tag = dictionary.get('tag') - obfuscated_to = dictionary.get('obfuscatedTo') - obfuscated_from = dictionary.get('obfuscatedFrom') - - # Return an object of this model - return cls(mfrom, - to, - answer_url, - application_id, - call_timeout, - callback_timeout, - answer_fallback_url, - username, - password, - fallback_username, - fallback_password, - answer_method, - answer_fallback_method, - disconnect_url, - disconnect_method, - tag, - obfuscated_to, - obfuscated_from) diff --git a/build/lib/bandwidth/voice/models/api_modify_call_request.py b/build/lib/bandwidth/voice/models/api_modify_call_request.py deleted file mode 100644 index 0b6872a8..00000000 --- a/build/lib/bandwidth/voice/models/api_modify_call_request.py +++ /dev/null @@ -1,109 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class ApiModifyCallRequest(object): - - """Implementation of the 'ApiModifyCallRequest' model. - - TODO: type model description here. - - Attributes: - state (State1Enum): TODO: type description here. - redirect_url (string): TODO: type description here. - redirect_fallback_url (string): TODO: type description here. - redirect_method (RedirectMethodEnum): TODO: type description here. - redirect_fallback_method (RedirectFallbackMethodEnum): TODO: type - description here. - username (string): TODO: type description here. - password (string): TODO: type description here. - fallback_username (string): TODO: type description here. - fallback_password (string): TODO: type description here. - tag (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "redirect_url": 'redirectUrl', - "state": 'state', - "redirect_fallback_url": 'redirectFallbackUrl', - "redirect_method": 'redirectMethod', - "redirect_fallback_method": 'redirectFallbackMethod', - "username": 'username', - "password": 'password', - "fallback_username": 'fallbackUsername', - "fallback_password": 'fallbackPassword', - "tag": 'tag' - } - - def __init__(self, - redirect_url=None, - state=None, - redirect_fallback_url=None, - redirect_method=None, - redirect_fallback_method=None, - username=None, - password=None, - fallback_username=None, - fallback_password=None, - tag=None): - """Constructor for the ApiModifyCallRequest class""" - - # Initialize members of the class - self.state = state - self.redirect_url = redirect_url - self.redirect_fallback_url = redirect_fallback_url - self.redirect_method = redirect_method - self.redirect_fallback_method = redirect_fallback_method - self.username = username - self.password = password - self.fallback_username = fallback_username - self.fallback_password = fallback_password - self.tag = tag - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - redirect_url = dictionary.get('redirectUrl') - state = dictionary.get('state') - redirect_fallback_url = dictionary.get('redirectFallbackUrl') - redirect_method = dictionary.get('redirectMethod') - redirect_fallback_method = dictionary.get('redirectFallbackMethod') - username = dictionary.get('username') - password = dictionary.get('password') - fallback_username = dictionary.get('fallbackUsername') - fallback_password = dictionary.get('fallbackPassword') - tag = dictionary.get('tag') - - # Return an object of this model - return cls(redirect_url, - state, - redirect_fallback_url, - redirect_method, - redirect_fallback_method, - username, - password, - fallback_username, - fallback_password, - tag) diff --git a/build/lib/bandwidth/voice/models/api_transcribe_recording_request.py b/build/lib/bandwidth/voice/models/api_transcribe_recording_request.py deleted file mode 100644 index 935e8303..00000000 --- a/build/lib/bandwidth/voice/models/api_transcribe_recording_request.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class ApiTranscribeRecordingRequest(object): - - """Implementation of the 'ApiTranscribeRecordingRequest' model. - - TODO: type model description here. - - Attributes: - callback_url (string): TODO: type description here. - callback_method (CallbackMethodEnum): TODO: type description here. - username (string): TODO: type description here. - password (string): TODO: type description here. - tag (string): TODO: type description here. - callback_timeout (float): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "callback_url": 'callbackUrl', - "callback_method": 'callbackMethod', - "username": 'username', - "password": 'password', - "tag": 'tag', - "callback_timeout": 'callbackTimeout' - } - - def __init__(self, - callback_url=None, - callback_method=None, - username=None, - password=None, - tag=None, - callback_timeout=None): - """Constructor for the ApiTranscribeRecordingRequest class""" - - # Initialize members of the class - self.callback_url = callback_url - self.callback_method = callback_method - self.username = username - self.password = password - self.tag = tag - self.callback_timeout = callback_timeout - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - callback_url = dictionary.get('callbackUrl') - callback_method = dictionary.get('callbackMethod') - username = dictionary.get('username') - password = dictionary.get('password') - tag = dictionary.get('tag') - callback_timeout = dictionary.get('callbackTimeout') - - # Return an object of this model - return cls(callback_url, - callback_method, - username, - password, - tag, - callback_timeout) diff --git a/build/lib/bandwidth/voice/models/call_engine_modify_conference_request.py b/build/lib/bandwidth/voice/models/call_engine_modify_conference_request.py deleted file mode 100644 index 8374370d..00000000 --- a/build/lib/bandwidth/voice/models/call_engine_modify_conference_request.py +++ /dev/null @@ -1,103 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class CallEngineModifyConferenceRequest(object): - - """Implementation of the 'CallEngineModifyConferenceRequest' model. - - TODO: type model description here. - - Attributes: - status (StatusEnum): TODO: type description here. - redirect_url (string): TODO: type description here. - redirect_fallback_url (string): TODO: type description here. - redirect_method (RedirectMethodEnum): TODO: type description here. - redirect_fallback_method (RedirectFallbackMethodEnum): TODO: type - description here. - username (string): TODO: type description here. - password (string): TODO: type description here. - fallback_username (string): TODO: type description here. - fallback_password (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "redirect_url": 'redirectUrl', - "status": 'status', - "redirect_fallback_url": 'redirectFallbackUrl', - "redirect_method": 'redirectMethod', - "redirect_fallback_method": 'redirectFallbackMethod', - "username": 'username', - "password": 'password', - "fallback_username": 'fallbackUsername', - "fallback_password": 'fallbackPassword' - } - - def __init__(self, - redirect_url=None, - status=None, - redirect_fallback_url=None, - redirect_method=None, - redirect_fallback_method=None, - username=None, - password=None, - fallback_username=None, - fallback_password=None): - """Constructor for the CallEngineModifyConferenceRequest class""" - - # Initialize members of the class - self.status = status - self.redirect_url = redirect_url - self.redirect_fallback_url = redirect_fallback_url - self.redirect_method = redirect_method - self.redirect_fallback_method = redirect_fallback_method - self.username = username - self.password = password - self.fallback_username = fallback_username - self.fallback_password = fallback_password - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - redirect_url = dictionary.get('redirectUrl') - status = dictionary.get('status') - redirect_fallback_url = dictionary.get('redirectFallbackUrl') - redirect_method = dictionary.get('redirectMethod') - redirect_fallback_method = dictionary.get('redirectFallbackMethod') - username = dictionary.get('username') - password = dictionary.get('password') - fallback_username = dictionary.get('fallbackUsername') - fallback_password = dictionary.get('fallbackPassword') - - # Return an object of this model - return cls(redirect_url, - status, - redirect_fallback_url, - redirect_method, - redirect_fallback_method, - username, - password, - fallback_username, - fallback_password) diff --git a/build/lib/bandwidth/voice/models/callback_method_enum.py b/build/lib/bandwidth/voice/models/callback_method_enum.py deleted file mode 100644 index b796f530..00000000 --- a/build/lib/bandwidth/voice/models/callback_method_enum.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class CallbackMethodEnum(object): - - """Implementation of the 'CallbackMethod' enum. - - TODO: type enum description here. - - Attributes: - GET: TODO: type description here. - HEAD: TODO: type description here. - POST: TODO: type description here. - PUT: TODO: type description here. - PATCH: TODO: type description here. - DELETE: TODO: type description here. - OPTIONS: TODO: type description here. - TRACE: TODO: type description here. - - """ - - GET = 'GET' - - HEAD = 'HEAD' - - POST = 'POST' - - PUT = 'PUT' - - PATCH = 'PATCH' - - DELETE = 'DELETE' - - OPTIONS = 'OPTIONS' - - TRACE = 'TRACE' diff --git a/build/lib/bandwidth/voice/models/conference_detail.py b/build/lib/bandwidth/voice/models/conference_detail.py deleted file mode 100644 index ac5503db..00000000 --- a/build/lib/bandwidth/voice/models/conference_detail.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" -from bandwidth.api_helper import APIHelper -from bandwidth.voice.models.conference_member_detail import ConferenceMemberDetail - - -class ConferenceDetail(object): - - """Implementation of the 'ConferenceDetail' model. - - TODO: type model description here. - - Attributes: - id (string): TODO: type description here. - name (string): TODO: type description here. - created_time (datetime): TODO: type description here. - completed_time (datetime): TODO: type description here. - conference_event_url (string): TODO: type description here. - conference_event_method (ConferenceEventMethodEnum): TODO: type - description here. - tag (string): TODO: type description here. - active_members (list of ConferenceMemberDetail): TODO: type - description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "id": 'id', - "name": 'name', - "created_time": 'createdTime', - "completed_time": 'completedTime', - "conference_event_url": 'conferenceEventUrl', - "conference_event_method": 'conferenceEventMethod', - "tag": 'tag', - "active_members": 'activeMembers' - } - - def __init__(self, - id=None, - name=None, - created_time=None, - completed_time=None, - conference_event_url=None, - conference_event_method=None, - tag=None, - active_members=None): - """Constructor for the ConferenceDetail class""" - - # Initialize members of the class - self.id = id - self.name = name - self.created_time = APIHelper.RFC3339DateTime(created_time) if created_time else None - self.completed_time = APIHelper.RFC3339DateTime(completed_time) if completed_time else None - self.conference_event_url = conference_event_url - self.conference_event_method = conference_event_method - self.tag = tag - self.active_members = active_members - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - id = dictionary.get('id') - name = dictionary.get('name') - created_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("createdTime")).datetime if dictionary.get("createdTime") else None - completed_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("completedTime")).datetime if dictionary.get("completedTime") else None - conference_event_url = dictionary.get('conferenceEventUrl') - conference_event_method = dictionary.get('conferenceEventMethod') - tag = dictionary.get('tag') - active_members = None - if dictionary.get('activeMembers') is not None: - active_members = [ConferenceMemberDetail.from_dictionary(x) for x in dictionary.get('activeMembers')] - - # Return an object of this model - return cls(id, - name, - created_time, - completed_time, - conference_event_url, - conference_event_method, - tag, - active_members) diff --git a/build/lib/bandwidth/voice/models/conference_event_method_enum.py b/build/lib/bandwidth/voice/models/conference_event_method_enum.py deleted file mode 100644 index 9f471b85..00000000 --- a/build/lib/bandwidth/voice/models/conference_event_method_enum.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class ConferenceEventMethodEnum(object): - - """Implementation of the 'ConferenceEventMethod' enum. - - TODO: type enum description here. - - Attributes: - GET: TODO: type description here. - HEAD: TODO: type description here. - POST: TODO: type description here. - PUT: TODO: type description here. - PATCH: TODO: type description here. - DELETE: TODO: type description here. - OPTIONS: TODO: type description here. - TRACE: TODO: type description here. - - """ - - GET = 'GET' - - HEAD = 'HEAD' - - POST = 'POST' - - PUT = 'PUT' - - PATCH = 'PATCH' - - DELETE = 'DELETE' - - OPTIONS = 'OPTIONS' - - TRACE = 'TRACE' diff --git a/build/lib/bandwidth/voice/models/conference_member_detail.py b/build/lib/bandwidth/voice/models/conference_member_detail.py deleted file mode 100644 index c4bc8060..00000000 --- a/build/lib/bandwidth/voice/models/conference_member_detail.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class ConferenceMemberDetail(object): - - """Implementation of the 'ConferenceMemberDetail' model. - - TODO: type model description here. - - Attributes: - call_id (string): TODO: type description here. - conference_id (string): TODO: type description here. - member_url (string): TODO: type description here. - mute (bool): TODO: type description here. - hold (bool): TODO: type description here. - call_ids_to_coach (list of string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "call_id": 'callId', - "conference_id": 'conferenceId', - "member_url": 'memberUrl', - "mute": 'mute', - "hold": 'hold', - "call_ids_to_coach": 'callIdsToCoach' - } - - def __init__(self, - call_id=None, - conference_id=None, - member_url=None, - mute=None, - hold=None, - call_ids_to_coach=None): - """Constructor for the ConferenceMemberDetail class""" - - # Initialize members of the class - self.call_id = call_id - self.conference_id = conference_id - self.member_url = member_url - self.mute = mute - self.hold = hold - self.call_ids_to_coach = call_ids_to_coach - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - call_id = dictionary.get('callId') - conference_id = dictionary.get('conferenceId') - member_url = dictionary.get('memberUrl') - mute = dictionary.get('mute') - hold = dictionary.get('hold') - call_ids_to_coach = dictionary.get('callIdsToCoach') - - # Return an object of this model - return cls(call_id, - conference_id, - member_url, - mute, - hold, - call_ids_to_coach) diff --git a/build/lib/bandwidth/voice/models/conference_recording_metadata_response.py b/build/lib/bandwidth/voice/models/conference_recording_metadata_response.py deleted file mode 100644 index 6a12091c..00000000 --- a/build/lib/bandwidth/voice/models/conference_recording_metadata_response.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" -from bandwidth.api_helper import APIHelper - - -class ConferenceRecordingMetadataResponse(object): - - """Implementation of the 'ConferenceRecordingMetadataResponse' model. - - TODO: type model description here. - - Attributes: - account_id (string): TODO: type description here. - conference_id (string): TODO: type description here. - name (string): TODO: type description here. - recording_id (string): TODO: type description here. - duration (string): Format is ISO-8601 - channels (int): TODO: type description here. - start_time (datetime): TODO: type description here. - end_time (datetime): TODO: type description here. - file_format (FileFormatEnum): TODO: type description here. - status (Status1Enum): TODO: type description here. - media_url (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "account_id": 'accountId', - "conference_id": 'conferenceId', - "name": 'name', - "recording_id": 'recordingId', - "duration": 'duration', - "channels": 'channels', - "start_time": 'startTime', - "end_time": 'endTime', - "file_format": 'fileFormat', - "status": 'status', - "media_url": 'mediaUrl' - } - - def __init__(self, - account_id=None, - conference_id=None, - name=None, - recording_id=None, - duration=None, - channels=None, - start_time=None, - end_time=None, - file_format=None, - status=None, - media_url=None): - """Constructor for the ConferenceRecordingMetadataResponse class""" - - # Initialize members of the class - self.account_id = account_id - self.conference_id = conference_id - self.name = name - self.recording_id = recording_id - self.duration = duration - self.channels = channels - self.start_time = APIHelper.RFC3339DateTime(start_time) if start_time else None - self.end_time = APIHelper.RFC3339DateTime(end_time) if end_time else None - self.file_format = file_format - self.status = status - self.media_url = media_url - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - account_id = dictionary.get('accountId') - conference_id = dictionary.get('conferenceId') - name = dictionary.get('name') - recording_id = dictionary.get('recordingId') - duration = dictionary.get('duration') - channels = dictionary.get('channels') - start_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("startTime")).datetime if dictionary.get("startTime") else None - end_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("endTime")).datetime if dictionary.get("endTime") else None - file_format = dictionary.get('fileFormat') - status = dictionary.get('status') - media_url = dictionary.get('mediaUrl') - - # Return an object of this model - return cls(account_id, - conference_id, - name, - recording_id, - duration, - channels, - start_time, - end_time, - file_format, - status, - media_url) diff --git a/build/lib/bandwidth/voice/models/direction_enum.py b/build/lib/bandwidth/voice/models/direction_enum.py deleted file mode 100644 index 9f9cee3d..00000000 --- a/build/lib/bandwidth/voice/models/direction_enum.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class DirectionEnum(object): - - """Implementation of the 'Direction' enum. - - TODO: type enum description here. - - Attributes: - INBOUND: TODO: type description here. - OUTBOUND: TODO: type description here. - - """ - - INBOUND = 'inbound' - - OUTBOUND = 'outbound' diff --git a/build/lib/bandwidth/voice/models/disconnect_cause_enum.py b/build/lib/bandwidth/voice/models/disconnect_cause_enum.py deleted file mode 100644 index b66b0abc..00000000 --- a/build/lib/bandwidth/voice/models/disconnect_cause_enum.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class DisconnectCauseEnum(object): - - """Implementation of the 'DisconnectCause' enum. - - TODO: type enum description here. - - Attributes: - BUSY: TODO: type description here. - CALLBACKERROR: TODO: type description here. - CANCEL: TODO: type description here. - ERROR: TODO: type description here. - HANGUP: TODO: type description here. - INVALIDBXML: TODO: type description here. - REJECTED: TODO: type description here. - TIMEOUT: TODO: type description here. - ACCOUNTLIMIT: TODO: type description here. - NODECAPACITYEXCEEDED: TODO: type description here. - UNKNOWN: TODO: type description here. - APPLICATIONERROR: TODO: type description here. - - """ - - BUSY = 'busy' - - CALLBACKERROR = 'callback-error' - - CANCEL = 'cancel' - - ERROR = 'error' - - HANGUP = 'hangup' - - INVALIDBXML = 'invalid-bxml' - - REJECTED = 'rejected' - - TIMEOUT = 'timeout' - - ACCOUNTLIMIT = 'account-limit' - - NODECAPACITYEXCEEDED = 'node-capacity-exceeded' - - UNKNOWN = 'unknown' - - APPLICATIONERROR = 'application-error' diff --git a/build/lib/bandwidth/voice/models/disconnect_method_enum.py b/build/lib/bandwidth/voice/models/disconnect_method_enum.py deleted file mode 100644 index 03da0a49..00000000 --- a/build/lib/bandwidth/voice/models/disconnect_method_enum.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class DisconnectMethodEnum(object): - - """Implementation of the 'DisconnectMethod' enum. - - TODO: type enum description here. - - Attributes: - POST: TODO: type description here. - GET: TODO: type description here. - - """ - - POST = 'POST' - - GET = 'GET' diff --git a/build/lib/bandwidth/voice/models/file_format_enum.py b/build/lib/bandwidth/voice/models/file_format_enum.py deleted file mode 100644 index 87a4204e..00000000 --- a/build/lib/bandwidth/voice/models/file_format_enum.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class FileFormatEnum(object): - - """Implementation of the 'FileFormat' enum. - - TODO: type enum description here. - - Attributes: - MP3: TODO: type description here. - WAV: TODO: type description here. - - """ - - MP3 = 'mp3' - - WAV = 'wav' diff --git a/build/lib/bandwidth/voice/models/modify_call_recording_state.py b/build/lib/bandwidth/voice/models/modify_call_recording_state.py deleted file mode 100644 index c31fcafc..00000000 --- a/build/lib/bandwidth/voice/models/modify_call_recording_state.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class ModifyCallRecordingState(object): - - """Implementation of the 'ModifyCallRecordingState' model. - - TODO: type model description here. - - Attributes: - state (State2Enum): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "state": 'state' - } - - def __init__(self, - state=None): - """Constructor for the ModifyCallRecordingState class""" - - # Initialize members of the class - self.state = state - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - state = dictionary.get('state') - - # Return an object of this model - return cls(state) diff --git a/build/lib/bandwidth/voice/models/recording_metadata_response.py b/build/lib/bandwidth/voice/models/recording_metadata_response.py deleted file mode 100644 index 915189a1..00000000 --- a/build/lib/bandwidth/voice/models/recording_metadata_response.py +++ /dev/null @@ -1,158 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" -from bandwidth.api_helper import APIHelper -from bandwidth.voice.models.transcription import Transcription - - -class RecordingMetadataResponse(object): - - """Implementation of the 'RecordingMetadataResponse' model. - - TODO: type model description here. - - Attributes: - application_id (string): TODO: type description here. - account_id (string): TODO: type description here. - call_id (string): TODO: type description here. - parent_call_id (string): TODO: type description here. - recording_id (string): TODO: type description here. - to (string): TODO: type description here. - mfrom (string): TODO: type description here. - transfer_caller_id (string): TODO: type description here. - transfer_to (string): TODO: type description here. - duration (string): Format is ISO-8601 - direction (DirectionEnum): TODO: type description here. - channels (int): TODO: type description here. - start_time (datetime): TODO: type description here. - end_time (datetime): TODO: type description here. - file_format (FileFormatEnum): TODO: type description here. - status (Status1Enum): TODO: type description here. - media_url (string): TODO: type description here. - transcription (Transcription): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "application_id": 'applicationId', - "account_id": 'accountId', - "call_id": 'callId', - "parent_call_id": 'parentCallId', - "recording_id": 'recordingId', - "to": 'to', - "mfrom": 'from', - "transfer_caller_id": 'transferCallerId', - "transfer_to": 'transferTo', - "duration": 'duration', - "direction": 'direction', - "channels": 'channels', - "start_time": 'startTime', - "end_time": 'endTime', - "file_format": 'fileFormat', - "status": 'status', - "media_url": 'mediaUrl', - "transcription": 'transcription' - } - - def __init__(self, - application_id=None, - account_id=None, - call_id=None, - parent_call_id=None, - recording_id=None, - to=None, - mfrom=None, - transfer_caller_id=None, - transfer_to=None, - duration=None, - direction=None, - channels=None, - start_time=None, - end_time=None, - file_format=None, - status=None, - media_url=None, - transcription=None): - """Constructor for the RecordingMetadataResponse class""" - - # Initialize members of the class - self.application_id = application_id - self.account_id = account_id - self.call_id = call_id - self.parent_call_id = parent_call_id - self.recording_id = recording_id - self.to = to - self.mfrom = mfrom - self.transfer_caller_id = transfer_caller_id - self.transfer_to = transfer_to - self.duration = duration - self.direction = direction - self.channels = channels - self.start_time = APIHelper.RFC3339DateTime(start_time) if start_time else None - self.end_time = APIHelper.RFC3339DateTime(end_time) if end_time else None - self.file_format = file_format - self.status = status - self.media_url = media_url - self.transcription = transcription - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - application_id = dictionary.get('applicationId') - account_id = dictionary.get('accountId') - call_id = dictionary.get('callId') - parent_call_id = dictionary.get('parentCallId') - recording_id = dictionary.get('recordingId') - to = dictionary.get('to') - mfrom = dictionary.get('from') - transfer_caller_id = dictionary.get('transferCallerId') - transfer_to = dictionary.get('transferTo') - duration = dictionary.get('duration') - direction = dictionary.get('direction') - channels = dictionary.get('channels') - start_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("startTime")).datetime if dictionary.get("startTime") else None - end_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("endTime")).datetime if dictionary.get("endTime") else None - file_format = dictionary.get('fileFormat') - status = dictionary.get('status') - media_url = dictionary.get('mediaUrl') - transcription = Transcription.from_dictionary(dictionary.get('transcription')) if dictionary.get('transcription') else None - - # Return an object of this model - return cls(application_id, - account_id, - call_id, - parent_call_id, - recording_id, - to, - mfrom, - transfer_caller_id, - transfer_to, - duration, - direction, - channels, - start_time, - end_time, - file_format, - status, - media_url, - transcription) diff --git a/build/lib/bandwidth/voice/models/redirect_fallback_method_enum.py b/build/lib/bandwidth/voice/models/redirect_fallback_method_enum.py deleted file mode 100644 index 5070dc40..00000000 --- a/build/lib/bandwidth/voice/models/redirect_fallback_method_enum.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class RedirectFallbackMethodEnum(object): - - """Implementation of the 'RedirectFallbackMethod' enum. - - TODO: type enum description here. - - Attributes: - POST: TODO: type description here. - GET: TODO: type description here. - - """ - - POST = 'POST' - - GET = 'GET' diff --git a/build/lib/bandwidth/voice/models/redirect_method_enum.py b/build/lib/bandwidth/voice/models/redirect_method_enum.py deleted file mode 100644 index 856752bd..00000000 --- a/build/lib/bandwidth/voice/models/redirect_method_enum.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class RedirectMethodEnum(object): - - """Implementation of the 'RedirectMethod' enum. - - TODO: type enum description here. - - Attributes: - POST: TODO: type description here. - GET: TODO: type description here. - - """ - - POST = 'POST' - - GET = 'GET' diff --git a/build/lib/bandwidth/voice/models/state_1_enum.py b/build/lib/bandwidth/voice/models/state_1_enum.py deleted file mode 100644 index 6e0e9060..00000000 --- a/build/lib/bandwidth/voice/models/state_1_enum.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class State1Enum(object): - - """Implementation of the 'State1' enum. - - TODO: type enum description here. - - Attributes: - ACTIVE: TODO: type description here. - COMPLETED: TODO: type description here. - - """ - - ACTIVE = 'active' - - COMPLETED = 'completed' diff --git a/build/lib/bandwidth/voice/models/state_2_enum.py b/build/lib/bandwidth/voice/models/state_2_enum.py deleted file mode 100644 index 310c3719..00000000 --- a/build/lib/bandwidth/voice/models/state_2_enum.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class State2Enum(object): - - """Implementation of the 'State2' enum. - - TODO: type enum description here. - - Attributes: - NOT_RECORDING: TODO: type description here. - PAUSED: TODO: type description here. - RECORDING: TODO: type description here. - - """ - - NOT_RECORDING = 'NOT_RECORDING' - - PAUSED = 'PAUSED' - - RECORDING = 'RECORDING' diff --git a/build/lib/bandwidth/voice/models/state_enum.py b/build/lib/bandwidth/voice/models/state_enum.py deleted file mode 100644 index 5fb7ff43..00000000 --- a/build/lib/bandwidth/voice/models/state_enum.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class StateEnum(object): - - """Implementation of the 'State' enum. - - TODO: type enum description here. - - Attributes: - DISCONNECTED: TODO: type description here. - ANSWERED: TODO: type description here. - INITIATED: TODO: type description here. - - """ - - DISCONNECTED = 'disconnected' - - ANSWERED = 'answered' - - INITIATED = 'initiated' diff --git a/build/lib/bandwidth/voice/models/status_1_enum.py b/build/lib/bandwidth/voice/models/status_1_enum.py deleted file mode 100644 index 52ef0e04..00000000 --- a/build/lib/bandwidth/voice/models/status_1_enum.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class Status1Enum(object): - - """Implementation of the 'Status1' enum. - - TODO: type enum description here. - - Attributes: - PROCESSING: TODO: type description here. - PARTIAL: TODO: type description here. - COMPLETE: TODO: type description here. - DELETED: TODO: type description here. - ERROR: TODO: type description here. - ALREADYINPROGRESS: TODO: type description here. - - """ - - PROCESSING = 'processing' - - PARTIAL = 'partial' - - COMPLETE = 'complete' - - DELETED = 'deleted' - - ERROR = 'error' - - ALREADYINPROGRESS = 'already-in-progress' diff --git a/build/lib/bandwidth/voice/models/status_3_enum.py b/build/lib/bandwidth/voice/models/status_3_enum.py deleted file mode 100644 index d7150517..00000000 --- a/build/lib/bandwidth/voice/models/status_3_enum.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class Status3Enum(object): - - """Implementation of the 'Status3' enum. - - TODO: type enum description here. - - Attributes: - NONE: TODO: type description here. - PROCESSING: TODO: type description here. - AVAILABLE: TODO: type description here. - ERROR: TODO: type description here. - TIMEOUT: TODO: type description here. - FILESIZETOOBIG: TODO: type description here. - FILESIZETOOSMALL: TODO: type description here. - - """ - - NONE = 'none' - - PROCESSING = 'processing' - - AVAILABLE = 'available' - - ERROR = 'error' - - TIMEOUT = 'timeout' - - FILESIZETOOBIG = 'file-size-too-big' - - FILESIZETOOSMALL = 'file-size-too-small' diff --git a/build/lib/bandwidth/voice/models/status_enum.py b/build/lib/bandwidth/voice/models/status_enum.py deleted file mode 100644 index 2f14dae5..00000000 --- a/build/lib/bandwidth/voice/models/status_enum.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class StatusEnum(object): - - """Implementation of the 'Status' enum. - - TODO: type enum description here. - - Attributes: - ACTIVE: TODO: type description here. - COMPLETED: TODO: type description here. - - """ - - ACTIVE = 'active' - - COMPLETED = 'completed' diff --git a/build/lib/bandwidth/voice/models/transcript.py b/build/lib/bandwidth/voice/models/transcript.py deleted file mode 100644 index dcf4803a..00000000 --- a/build/lib/bandwidth/voice/models/transcript.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class Transcript(object): - - """Implementation of the 'Transcript' model. - - TODO: type model description here. - - Attributes: - text (string): TODO: type description here. - confidence (float): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "text": 'text', - "confidence": 'confidence' - } - - def __init__(self, - text=None, - confidence=None): - """Constructor for the Transcript class""" - - # Initialize members of the class - self.text = text - self.confidence = confidence - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - text = dictionary.get('text') - confidence = dictionary.get('confidence') - - # Return an object of this model - return cls(text, - confidence) diff --git a/build/lib/bandwidth/voice/models/transcription.py b/build/lib/bandwidth/voice/models/transcription.py deleted file mode 100644 index 5e67466e..00000000 --- a/build/lib/bandwidth/voice/models/transcription.py +++ /dev/null @@ -1,72 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class Transcription(object): - - """Implementation of the 'Transcription' model. - - TODO: type model description here. - - Attributes: - id (string): TODO: type description here. - status (Status3Enum): TODO: type description here. - completed_time (string): TODO: type description here. - url (string): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "id": 'id', - "status": 'status', - "completed_time": 'completedTime', - "url": 'url' - } - - def __init__(self, - id=None, - status=None, - completed_time=None, - url=None): - """Constructor for the Transcription class""" - - # Initialize members of the class - self.id = id - self.status = status - self.completed_time = completed_time - self.url = url - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - id = dictionary.get('id') - status = dictionary.get('status') - completed_time = dictionary.get('completedTime') - url = dictionary.get('url') - - # Return an object of this model - return cls(id, - status, - completed_time, - url) diff --git a/build/lib/bandwidth/voice/models/transcription_response.py b/build/lib/bandwidth/voice/models/transcription_response.py deleted file mode 100644 index 0236e11a..00000000 --- a/build/lib/bandwidth/voice/models/transcription_response.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" -from bandwidth.voice.models.transcript import Transcript - - -class TranscriptionResponse(object): - - """Implementation of the 'TranscriptionResponse' model. - - TODO: type model description here. - - Attributes: - transcripts (list of Transcript): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "transcripts": 'transcripts' - } - - def __init__(self, - transcripts=None): - """Constructor for the TranscriptionResponse class""" - - # Initialize members of the class - self.transcripts = transcripts - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - transcripts = None - if dictionary.get('transcripts') is not None: - transcripts = [Transcript.from_dictionary(x) for x in dictionary.get('transcripts')] - - # Return an object of this model - return cls(transcripts) diff --git a/build/lib/bandwidth/voice/voice_client.py b/build/lib/bandwidth/voice/voice_client.py deleted file mode 100644 index 58a049dd..00000000 --- a/build/lib/bandwidth/voice/voice_client.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.decorators import lazy_property -from bandwidth.configuration import Configuration -from bandwidth.configuration import Environment -from bandwidth.voice.controllers.api_controller import APIController - - -class VoiceClient(object): - - @lazy_property - def client(self): - return APIController(self.config) - - def __init__(self, timeout=60, max_retries=3, backoff_factor=0, - environment=Environment.PRODUCTION, - base_url='https://www.example.com', - messaging_basic_auth_user_name='TODO: Replace', - messaging_basic_auth_password='TODO: Replace', - two_factor_auth_basic_auth_user_name='TODO: Replace', - two_factor_auth_basic_auth_password='TODO: Replace', - voice_basic_auth_user_name='TODO: Replace', - voice_basic_auth_password='TODO: Replace', - web_rtc_basic_auth_user_name='TODO: Replace', - web_rtc_basic_auth_password='TODO: Replace', config=None): - if config is None: - self.config = Configuration(timeout=timeout, - max_retries=max_retries, - backoff_factor=backoff_factor, - environment=environment, - base_url=base_url, - messaging_basic_auth_user_name=messaging_basic_auth_user_name, - messaging_basic_auth_password=messaging_basic_auth_password, - two_factor_auth_basic_auth_user_name=two_factor_auth_basic_auth_user_name, - two_factor_auth_basic_auth_password=two_factor_auth_basic_auth_password, - voice_basic_auth_user_name=voice_basic_auth_user_name, - voice_basic_auth_password=voice_basic_auth_password, - web_rtc_basic_auth_user_name=web_rtc_basic_auth_user_name, - web_rtc_basic_auth_password=web_rtc_basic_auth_password) - else: - self.config = config diff --git a/build/lib/bandwidth/webrtc/__init__.py b/build/lib/bandwidth/webrtc/__init__.py deleted file mode 100644 index f601a659..00000000 --- a/build/lib/bandwidth/webrtc/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -__all__ = [ - 'controllers', - 'exceptions', - 'models', - 'web_rtc_client', -] diff --git a/build/lib/bandwidth/webrtc/controllers/__init__.py b/build/lib/bandwidth/webrtc/controllers/__init__.py deleted file mode 100644 index c1660224..00000000 --- a/build/lib/bandwidth/webrtc/controllers/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -__all__ = [ - 'base_controller', - 'api_controller', -] diff --git a/build/lib/bandwidth/webrtc/controllers/api_controller.py b/build/lib/bandwidth/webrtc/controllers/api_controller.py deleted file mode 100644 index cc324876..00000000 --- a/build/lib/bandwidth/webrtc/controllers/api_controller.py +++ /dev/null @@ -1,680 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -from bandwidth.configuration import Server -from bandwidth.http.api_response import ApiResponse -from bandwidth.webrtc.controllers.base_controller import BaseController -from bandwidth.http.auth.web_rtc_basic_auth import WebRtcBasicAuth -from bandwidth.webrtc.models.accounts_participants_response import AccountsParticipantsResponse -from bandwidth.webrtc.models.participant import Participant -from bandwidth.webrtc.models.session import Session -from bandwidth.webrtc.models.subscriptions import Subscriptions -from bandwidth.exceptions.api_exception import APIException -from bandwidth.webrtc.exceptions.error_exception import ErrorException - - -class APIController(BaseController): - - """A Controller to access Endpoints in the bandwidth API.""" - - def __init__(self, config, call_back=None): - super(APIController, self).__init__(config, call_back) - - def create_participant(self, - account_id, - body=None): - """Does a POST request to /accounts/{accountId}/participants. - - Create a new participant under this account - Participants are idempotent, so relevant parameters must be set in - this function if desired - - Args: - account_id (string): Account ID - body (Participant, optional): Participant parameters - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. Success - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/participants' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.WEBRTCDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json', - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - WebRtcBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise APIException('Bad Request', _response) - elif _response.status_code == 401: - raise APIException('Unauthorized', _response) - elif _response.status_code == 403: - raise APIException('Access Denied', _response) - elif (_response.status_code < 200) or (_response.status_code > 208): - raise ErrorException('Unexpected Error', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, AccountsParticipantsResponse.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def get_participant(self, - account_id, - participant_id): - """Does a GET request to /accounts/{accountId}/participants/{participantId}. - - Get participant by ID - - Args: - account_id (string): Account ID - participant_id (string): Participant ID - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. Success - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/participants/{participantId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'participantId': {'value': participant_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.WEBRTCDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - WebRtcBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 401: - raise APIException('Unauthorized', _response) - elif _response.status_code == 403: - raise APIException('Access Denied', _response) - elif _response.status_code == 404: - raise APIException('Not Found', _response) - elif (_response.status_code < 200) or (_response.status_code > 208): - raise ErrorException('Unexpected Error', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, Participant.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def delete_participant(self, - account_id, - participant_id): - """Does a DELETE request to /accounts/{accountId}/participants/{participantId}. - - Delete participant by ID - - Args: - account_id (string): Account ID - participant_id (string): TODO: type description here. - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. No - Content - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/participants/{participantId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'participantId': {'value': participant_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.WEBRTCDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare and execute request - _request = self.config.http_client.delete(_query_url) - WebRtcBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 401: - raise APIException('Unauthorized', _response) - elif _response.status_code == 403: - raise APIException('Access Denied', _response) - elif _response.status_code == 404: - raise APIException('Not Found', _response) - elif (_response.status_code < 200) or (_response.status_code > 208): - raise ErrorException('Unexpected Error', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def create_session(self, - account_id, - body=None): - """Does a POST request to /accounts/{accountId}/sessions. - - Create a new session - Sessions are idempotent, so relevant parameters must be set in this - function if desired - - Args: - account_id (string): Account ID - body (Session, optional): Session parameters - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. Success - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/sessions' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.WEBRTCDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json', - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - WebRtcBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise APIException('Bad Request', _response) - elif _response.status_code == 401: - raise APIException('Unauthorized', _response) - elif _response.status_code == 403: - raise APIException('Access Denied', _response) - elif (_response.status_code < 200) or (_response.status_code > 208): - raise ErrorException('Unexpected Error', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, Session.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def get_session(self, - account_id, - session_id): - """Does a GET request to /accounts/{accountId}/sessions/{sessionId}. - - Get session by ID - - Args: - account_id (string): Account ID - session_id (string): Session ID - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. Success - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/sessions/{sessionId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'sessionId': {'value': session_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.WEBRTCDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - WebRtcBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 401: - raise APIException('Unauthorized', _response) - elif _response.status_code == 403: - raise APIException('Access Denied', _response) - elif _response.status_code == 404: - raise APIException('Not Found', _response) - elif (_response.status_code < 200) or (_response.status_code > 208): - raise ErrorException('Unexpected Error', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, Session.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def delete_session(self, - account_id, - session_id): - """Does a DELETE request to /accounts/{accountId}/sessions/{sessionId}. - - Delete session by ID - - Args: - account_id (string): Account ID - session_id (string): Session ID - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. No - Content - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/sessions/{sessionId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'sessionId': {'value': session_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.WEBRTCDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare and execute request - _request = self.config.http_client.delete(_query_url) - WebRtcBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 401: - raise APIException('Unauthorized', _response) - elif _response.status_code == 403: - raise APIException('Access Denied', _response) - elif _response.status_code == 404: - raise APIException('Not Found', _response) - elif (_response.status_code < 200) or (_response.status_code > 208): - raise ErrorException('Unexpected Error', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def list_session_participants(self, - account_id, - session_id): - """Does a GET request to /accounts/{accountId}/sessions/{sessionId}/participants. - - List participants in a session - - Args: - account_id (string): Account ID - session_id (string): Session ID - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. Success - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/sessions/{sessionId}/participants' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'sessionId': {'value': session_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.WEBRTCDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - WebRtcBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 401: - raise APIException('Unauthorized', _response) - elif _response.status_code == 403: - raise APIException('Access Denied', _response) - elif _response.status_code == 404: - raise APIException('Not Found', _response) - elif (_response.status_code < 200) or (_response.status_code > 208): - raise ErrorException('Unexpected Error', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, Participant.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def add_participant_to_session(self, - account_id, - session_id, - participant_id, - body=None): - """Does a PUT request to /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}. - - Add a participant to a session - Subscriptions can optionally be provided as part of this call - - Args: - account_id (string): Account ID - session_id (string): Session ID - participant_id (string): Participant ID - body (Subscriptions, optional): Subscriptions the participant - should be created with - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. No - Content - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'sessionId': {'value': session_id, 'encode': True}, - 'participantId': {'value': participant_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.WEBRTCDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - WebRtcBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 401: - raise APIException('Unauthorized', _response) - elif _response.status_code == 403: - raise APIException('Access Denied', _response) - elif _response.status_code == 404: - raise APIException('Not Found', _response) - elif (_response.status_code < 200) or (_response.status_code > 208): - raise ErrorException('Unexpected Error', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def remove_participant_from_session(self, - account_id, - participant_id, - session_id): - """Does a DELETE request to /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}. - - Remove a participant from a session - This will automatically remove any subscriptions the participant has - associated with this session - - Args: - account_id (string): Account ID - participant_id (string): Participant ID - session_id (string): Session ID - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. No - Content - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'participantId': {'value': participant_id, 'encode': True}, - 'sessionId': {'value': session_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.WEBRTCDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare and execute request - _request = self.config.http_client.delete(_query_url) - WebRtcBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 401: - raise APIException('Unauthorized', _response) - elif _response.status_code == 403: - raise APIException('Access Denied', _response) - elif _response.status_code == 404: - raise APIException('Not Found', _response) - elif (_response.status_code < 200) or (_response.status_code > 208): - raise ErrorException('Unexpected Error', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) - - def get_participant_subscriptions(self, - account_id, - participant_id, - session_id): - """Does a GET request to /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions. - - Get a participant's subscriptions - - Args: - account_id (string): Account ID - participant_id (string): Participant ID - session_id (string): Session ID - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. Success - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'participantId': {'value': participant_id, 'encode': True}, - 'sessionId': {'value': session_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.WEBRTCDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'accept': 'application/json' - } - - # Prepare and execute request - _request = self.config.http_client.get(_query_url, headers=_headers) - WebRtcBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 401: - raise APIException('Unauthorized', _response) - elif _response.status_code == 403: - raise APIException('Access Denied', _response) - elif _response.status_code == 404: - raise APIException('Not Found', _response) - elif (_response.status_code < 200) or (_response.status_code > 208): - raise ErrorException('Unexpected Error', _response) - self.validate_response(_response) - - decoded = APIHelper.json_deserialize(_response.text, Subscriptions.from_dictionary) - _result = ApiResponse(_response, body=decoded) - return _result - - def update_participant_subscriptions(self, - account_id, - participant_id, - session_id, - body=None): - """Does a PUT request to /accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions. - - Update a participant's subscriptions - This is a full update that will replace the participant's - subscriptions. First call `getParticipantSubscriptions` if you need - the current subscriptions. Call this function with no `Subscriptions` - object to remove all subscriptions - - Args: - account_id (string): Account ID - participant_id (string): Participant ID - session_id (string): Session ID - body (Subscriptions, optional): Initial state - - Returns: - ApiResponse: An object with the response value as well as other - useful information such as status codes and headers. No - Content - - Raises: - APIException: When an error occurs while fetching the data from - the remote API. This exception includes the HTTP Response - code, an error message, and the HTTP body that was received in - the request. - - """ - - # Prepare query URL - _url_path = '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions' - _url_path = APIHelper.append_url_with_template_parameters(_url_path, { - 'accountId': {'value': account_id, 'encode': True}, - 'participantId': {'value': participant_id, 'encode': True}, - 'sessionId': {'value': session_id, 'encode': True} - }) - _query_builder = self.config.get_base_uri(Server.WEBRTCDEFAULT) - _query_builder += _url_path - _query_url = APIHelper.clean_url(_query_builder) - - # Prepare headers - _headers = { - 'content-type': 'application/json; charset=utf-8' - } - - # Prepare and execute request - _request = self.config.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body)) - WebRtcBasicAuth.apply(self.config, _request) - _response = self.execute_request(_request) - - # Endpoint and global error handling using HTTP status codes. - if _response.status_code == 400: - raise APIException('Bad Request', _response) - elif _response.status_code == 401: - raise APIException('Unauthorized', _response) - elif _response.status_code == 403: - raise APIException('Access Denied', _response) - elif _response.status_code == 404: - raise APIException('Not Found', _response) - elif (_response.status_code < 200) or (_response.status_code > 208): - raise ErrorException('Unexpected Error', _response) - self.validate_response(_response) - - # Return appropriate type - return ApiResponse(_response) diff --git a/build/lib/bandwidth/webrtc/controllers/base_controller.py b/build/lib/bandwidth/webrtc/controllers/base_controller.py deleted file mode 100644 index 3f7583fb..00000000 --- a/build/lib/bandwidth/webrtc/controllers/base_controller.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -from bandwidth.exceptions.api_exception import APIException - - -class BaseController(object): - - """All controllers inherit from this base class. - - Attributes: - config (Configuration): The HttpClient which a specific controller - instance will use. By default all the controller objects share - the same HttpClient. A user can use his own custom HttpClient - as well. - http_call_back (HttpCallBack): An object which holds call back - methods to be called before and after the execution of an HttpRequest. - global_headers (dict): The global headers of the API which are sent with - every request. - - """ - - def global_headers(self): - return { - 'user-agent': 'python-sdk-refs/tags/python6.13.2' - } - - def __init__(self, config, call_back=None): - self._config = config - self._http_call_back = call_back - - @property - def config(self): - return self._config - - @property - def http_call_back(self): - return self._http_call_back - - def validate_parameters(self, **kwargs): - """Validates required parameters of an endpoint. - - Args: - kwargs (dict): A dictionary of the required parameters. - - """ - for name, value in kwargs.items(): - if value is None: - raise ValueError("Required parameter {} cannot be None.".format(name)) - - def execute_request(self, request, binary=False): - """Executes an HttpRequest. - - Args: - request (HttpRequest): The HttpRequest to execute. - binary (bool): A flag which should be set to True if - a binary response is expected. - - Returns: - HttpResponse: The HttpResponse received. - - """ - # Invoke the on before request HttpCallBack if specified - if self.http_call_back is not None: - self.http_call_back.on_before_request(request) - - # Add global headers to request - request.headers = APIHelper.merge_dicts(self.global_headers(), request.headers) - - # Invoke the API call to fetch the response. - func = self.config.http_client.execute_as_binary if binary else self.config.http_client.execute_as_string - response = func(request) - - # Invoke the on after response HttpCallBack if specified - if self.http_call_back is not None: - self.http_call_back.on_after_response(response) - - return response - - def validate_response(self, response): - """Validates an HTTP response by checking for global errors. - - Args: - response (HttpResponse): The HttpResponse of the API call. - - """ - if (response.status_code < 200) or (response.status_code > 208): # [200,208] = HTTP OK - raise APIException('HTTP response not OK.', response) diff --git a/build/lib/bandwidth/webrtc/exceptions/__init__.py b/build/lib/bandwidth/webrtc/exceptions/__init__.py deleted file mode 100644 index 4d4907bb..00000000 --- a/build/lib/bandwidth/webrtc/exceptions/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -__all__ = [ - 'error_exception', -] diff --git a/build/lib/bandwidth/webrtc/exceptions/error_exception.py b/build/lib/bandwidth/webrtc/exceptions/error_exception.py deleted file mode 100644 index a3fe4b9d..00000000 --- a/build/lib/bandwidth/webrtc/exceptions/error_exception.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.api_helper import APIHelper -import bandwidth.exceptions.api_exception - - -class ErrorException(bandwidth.exceptions.api_exception.APIException): - def __init__(self, reason, response): - """Constructor for the ErrorException class - - Args: - reason (string): The reason (or error message) for the Exception - to be raised. - response (HttpResponse): The HttpResponse of the API call. - - """ - super(ErrorException, self).__init__(reason, response) - dictionary = APIHelper.json_deserialize(self.response.text) - if isinstance(dictionary, dict): - self.unbox(dictionary) - - def unbox(self, dictionary): - """Populates the properties of this object by extracting them from a dictionary. - - Args: - dictionary (dictionary): A dictionary representation of the object as - obtained from the deserialization of the server's response. The keys - MUST match property names in the API description. - - """ - self.code = dictionary.get('code') - self.message = dictionary.get('message') diff --git a/build/lib/bandwidth/webrtc/models/__init__.py b/build/lib/bandwidth/webrtc/models/__init__.py deleted file mode 100644 index 66181a67..00000000 --- a/build/lib/bandwidth/webrtc/models/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -__all__ = [ - 'session', - 'participant', - 'subscriptions', - 'participant_subscription', - 'accounts_participants_response', - 'publish_permission_enum', -] diff --git a/build/lib/bandwidth/webrtc/models/accounts_participants_response.py b/build/lib/bandwidth/webrtc/models/accounts_participants_response.py deleted file mode 100644 index 73a27d67..00000000 --- a/build/lib/bandwidth/webrtc/models/accounts_participants_response.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" -from bandwidth.webrtc.models.participant import Participant - - -class AccountsParticipantsResponse(object): - - """Implementation of the 'Accounts Participants Response' model. - - TODO: type model description here. - - Attributes: - participant (Participant): A participant object - token (string): Auth token for the returned participant This should - be passed to the participant so that they can connect to the - platform - - """ - - # Create a mapping from Model property names to API property names - _names = { - "participant": 'participant', - "token": 'token' - } - - def __init__(self, - participant=None, - token=None): - """Constructor for the AccountsParticipantsResponse class""" - - # Initialize members of the class - self.participant = participant - self.token = token - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - participant = Participant.from_dictionary(dictionary.get('participant')) if dictionary.get('participant') else None - token = dictionary.get('token') - - # Return an object of this model - return cls(participant, - token) diff --git a/build/lib/bandwidth/webrtc/models/participant.py b/build/lib/bandwidth/webrtc/models/participant.py deleted file mode 100644 index 1341c2ea..00000000 --- a/build/lib/bandwidth/webrtc/models/participant.py +++ /dev/null @@ -1,88 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" -from bandwidth.webrtc.models.subscriptions import Subscriptions - - -class Participant(object): - - """Implementation of the 'Participant' model. - - A participant object - - Attributes: - id (string): Unique id of the participant - callback_url (string): Full callback url to use for notifications - about this participant - publish_permissions (list of PublishPermissionEnum): Defines if this - participant can publish audio or video - sessions (list of string): List of session ids this participant is - associated with Capped to one - subscriptions (Subscriptions): TODO: type description here. - tag (string): User defined tag to associate with the participant - - """ - - # Create a mapping from Model property names to API property names - _names = { - "id": 'id', - "callback_url": 'callbackUrl', - "publish_permissions": 'publishPermissions', - "sessions": 'sessions', - "subscriptions": 'subscriptions', - "tag": 'tag' - } - - def __init__(self, - id=None, - callback_url=None, - publish_permissions=None, - sessions=None, - subscriptions=None, - tag=None): - """Constructor for the Participant class""" - - # Initialize members of the class - self.id = id - self.callback_url = callback_url - self.publish_permissions = publish_permissions - self.sessions = sessions - self.subscriptions = subscriptions - self.tag = tag - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - id = dictionary.get('id') - callback_url = dictionary.get('callbackUrl') - publish_permissions = dictionary.get('publishPermissions') - sessions = dictionary.get('sessions') - subscriptions = Subscriptions.from_dictionary(dictionary.get('subscriptions')) if dictionary.get('subscriptions') else None - tag = dictionary.get('tag') - - # Return an object of this model - return cls(id, - callback_url, - publish_permissions, - sessions, - subscriptions, - tag) diff --git a/build/lib/bandwidth/webrtc/models/participant_subscription.py b/build/lib/bandwidth/webrtc/models/participant_subscription.py deleted file mode 100644 index 602220dc..00000000 --- a/build/lib/bandwidth/webrtc/models/participant_subscription.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class ParticipantSubscription(object): - - """Implementation of the 'ParticipantSubscription' model. - - TODO: type model description here. - - Attributes: - participant_id (string): Participant the subscriber should be - subscribed to - - """ - - # Create a mapping from Model property names to API property names - _names = { - "participant_id": 'participantId' - } - - def __init__(self, - participant_id=None): - """Constructor for the ParticipantSubscription class""" - - # Initialize members of the class - self.participant_id = participant_id - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - participant_id = dictionary.get('participantId') - - # Return an object of this model - return cls(participant_id) diff --git a/build/lib/bandwidth/webrtc/models/publish_permission_enum.py b/build/lib/bandwidth/webrtc/models/publish_permission_enum.py deleted file mode 100644 index b49328a9..00000000 --- a/build/lib/bandwidth/webrtc/models/publish_permission_enum.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class PublishPermissionEnum(object): - - """Implementation of the 'PublishPermission' enum. - - TODO: type enum description here. - - Attributes: - AUDIO: TODO: type description here. - VIDEO: TODO: type description here. - - """ - - AUDIO = 'AUDIO' - - VIDEO = 'VIDEO' diff --git a/build/lib/bandwidth/webrtc/models/session.py b/build/lib/bandwidth/webrtc/models/session.py deleted file mode 100644 index 4dde2445..00000000 --- a/build/lib/bandwidth/webrtc/models/session.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - - -class Session(object): - - """Implementation of the 'Session' model. - - A session object - - Attributes: - id (string): Unique id of the session - tag (string): User defined tag to associate with the session - - """ - - # Create a mapping from Model property names to API property names - _names = { - "id": 'id', - "tag": 'tag' - } - - def __init__(self, - id=None, - tag=None): - """Constructor for the Session class""" - - # Initialize members of the class - self.id = id - self.tag = tag - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - id = dictionary.get('id') - tag = dictionary.get('tag') - - # Return an object of this model - return cls(id, - tag) diff --git a/build/lib/bandwidth/webrtc/models/subscriptions.py b/build/lib/bandwidth/webrtc/models/subscriptions.py deleted file mode 100644 index bde709ff..00000000 --- a/build/lib/bandwidth/webrtc/models/subscriptions.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" -from bandwidth.webrtc.models.participant_subscription import ParticipantSubscription - - -class Subscriptions(object): - - """Implementation of the 'Subscriptions' model. - - TODO: type model description here. - - Attributes: - session_id (string): 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) - participants (list of ParticipantSubscription): Subset of participants - to subscribe to in the session. Optional. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "session_id": 'sessionId', - "participants": 'participants' - } - - def __init__(self, - session_id=None, - participants=None): - """Constructor for the Subscriptions class""" - - # Initialize members of the class - self.session_id = session_id - self.participants = participants - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - if dictionary is None: - return None - - # Extract variables from the dictionary - session_id = dictionary.get('sessionId') - participants = None - if dictionary.get('participants') is not None: - participants = [ParticipantSubscription.from_dictionary(x) for x in dictionary.get('participants')] - - # Return an object of this model - return cls(session_id, - participants) diff --git a/build/lib/bandwidth/webrtc/utils/__init__.py b/build/lib/bandwidth/webrtc/utils/__init__.py deleted file mode 100644 index eb601abb..00000000 --- a/build/lib/bandwidth/webrtc/utils/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .transfer_util import generate_transfer_bxml diff --git a/build/lib/bandwidth/webrtc/utils/transfer_util.py b/build/lib/bandwidth/webrtc/utils/transfer_util.py deleted file mode 100644 index de7e6075..00000000 --- a/build/lib/bandwidth/webrtc/utils/transfer_util.py +++ /dev/null @@ -1,18 +0,0 @@ -""" -transfer_util.py - -Method to generate the transfer BXML to connect WebRTC <-> phones - -@copyright Bandwidth INC -""" - -def generate_transfer_bxml(deviceToken, sip_uri='sip:sipx.webrtc.bandwidth.com:5060'): - """ - Returns BXML string with WebRTC a device token to perform a SIP transfer - """ - return f''' - - - {sip_uri} - -''' diff --git a/build/lib/bandwidth/webrtc/web_rtc_client.py b/build/lib/bandwidth/webrtc/web_rtc_client.py deleted file mode 100644 index 0541581c..00000000 --- a/build/lib/bandwidth/webrtc/web_rtc_client.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -bandwidth - -This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). -""" - -from bandwidth.decorators import lazy_property -from bandwidth.configuration import Configuration -from bandwidth.configuration import Environment -from bandwidth.webrtc.controllers.api_controller import APIController - - -class WebRtcClient(object): - - @lazy_property - def client(self): - return APIController(self.config) - - def __init__(self, timeout=60, max_retries=3, backoff_factor=0, - environment=Environment.PRODUCTION, - base_url='https://www.example.com', - messaging_basic_auth_user_name='TODO: Replace', - messaging_basic_auth_password='TODO: Replace', - two_factor_auth_basic_auth_user_name='TODO: Replace', - two_factor_auth_basic_auth_password='TODO: Replace', - voice_basic_auth_user_name='TODO: Replace', - voice_basic_auth_password='TODO: Replace', - web_rtc_basic_auth_user_name='TODO: Replace', - web_rtc_basic_auth_password='TODO: Replace', config=None): - if config is None: - self.config = Configuration(timeout=timeout, - max_retries=max_retries, - backoff_factor=backoff_factor, - environment=environment, - base_url=base_url, - messaging_basic_auth_user_name=messaging_basic_auth_user_name, - messaging_basic_auth_password=messaging_basic_auth_password, - two_factor_auth_basic_auth_user_name=two_factor_auth_basic_auth_user_name, - two_factor_auth_basic_auth_password=two_factor_auth_basic_auth_password, - voice_basic_auth_user_name=voice_basic_auth_user_name, - voice_basic_auth_password=voice_basic_auth_password, - web_rtc_basic_auth_user_name=web_rtc_basic_auth_user_name, - web_rtc_basic_auth_password=web_rtc_basic_auth_password) - else: - self.config = config diff --git a/dist/bandwidth-sdk-6.13.2.tar.gz b/dist/bandwidth-sdk-6.13.2.tar.gz deleted file mode 100644 index 431b5c18..00000000 Binary files a/dist/bandwidth-sdk-6.13.2.tar.gz and /dev/null differ diff --git a/dist/bandwidth_sdk-6.13.2-py3-none-any.whl b/dist/bandwidth_sdk-6.13.2-py3-none-any.whl deleted file mode 100644 index 1362bd23..00000000 Binary files a/dist/bandwidth_sdk-6.13.2-py3-none-any.whl and /dev/null differ diff --git a/setup.py b/setup.py index 0b82f53c..a518e388 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name='bandwidth-sdk', - version='6.13.3', + version='6.14.0', description='Bandwidth\'s set of APIs', long_description=long_description, long_description_content_type="text/markdown",