From cd623f0730750c8861f1f20c2525f5eff14a5467 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 6 Oct 2018 13:53:15 -0700 Subject: [PATCH] Code Commit This is the inital adding of code that I have already worked out. Inbound reads out messages to a log file. I also made it work with emoji's --- .gitignore | 4 + LICENSE => LICENSE.md | 7 +- README.md | 1 + flowroutenumbersandmessaging/__init__.py | 10 + flowroutenumbersandmessaging/__init__.pyc | Bin 0 -> 376 bytes flowroutenumbersandmessaging/api_helper.py | 405 +++++++++++++++ flowroutenumbersandmessaging/api_helper.pyc | Bin 0 -> 15759 bytes flowroutenumbersandmessaging/configuration.py | 34 ++ .../configuration.pyc | Bin 0 -> 1040 bytes .../controllers/__init__.py | 6 + .../controllers/__init__.pyc | Bin 0 -> 315 bytes .../controllers/base_controller.py | 124 +++++ .../controllers/base_controller.pyc | Bin 0 -> 4894 bytes .../controllers/cnams_controller.py | 203 ++++++++ .../controllers/cnams_controller.pyc | Bin 0 -> 6543 bytes .../controllers/e911s_controller.py | 490 ++++++++++++++++++ .../controllers/e911s_controller.pyc | Bin 0 -> 14127 bytes .../controllers/messages_controller.py | 345 ++++++++++++ .../controllers/messages_controller.pyc | Bin 0 -> 10533 bytes .../controllers/numbers_controller.py | 480 +++++++++++++++++ .../controllers/numbers_controller.pyc | Bin 0 -> 15203 bytes .../controllers/porting_controller.py | 54 ++ .../controllers/porting_controller.pyc | Bin 0 -> 2135 bytes .../controllers/routes_controller.py | 192 +++++++ .../controllers/routes_controller.pyc | Bin 0 -> 7294 bytes flowroutenumbersandmessaging/decorators.py | 22 + flowroutenumbersandmessaging/decorators.pyc | Bin 0 -> 1206 bytes .../exceptions/__init__.py | 4 + .../exceptions/__init__.pyc | Bin 0 -> 253 bytes .../exceptions/api_exception.py | 32 ++ .../exceptions/api_exception.pyc | Bin 0 -> 1464 bytes .../exceptions/error_exception.py | 40 ++ .../exceptions/error_exception.pyc | Bin 0 -> 2387 bytes .../flowroutenumbersandmessaging_client.py | 52 ++ .../flowroutenumbersandmessaging_client.pyc | Bin 0 -> 3105 bytes flowroutenumbersandmessaging/http/__init__.py | 10 + .../http/__init__.pyc | Bin 0 -> 376 bytes .../http/auth/__init__.py | 3 + .../http/auth/__init__.pyc | Bin 0 -> 224 bytes .../http/auth/basic_auth.py | 28 + .../http/auth/basic_auth.pyc | Bin 0 -> 1481 bytes .../http/http_call_back.py | 36 ++ .../http/http_client.py | 177 +++++++ .../http/http_client.pyc | Bin 0 -> 6688 bytes .../http/http_context.py | 34 ++ .../http/http_context.pyc | Bin 0 -> 1488 bytes .../http/http_method_enum.py | 47 ++ .../http/http_method_enum.pyc | Bin 0 -> 1686 bytes .../http/http_request.py | 81 +++ .../http/http_request.pyc | Bin 0 -> 3532 bytes .../http/http_response.py | 37 ++ .../http/http_response.pyc | Bin 0 -> 1579 bytes .../http/requests_client.py | 100 ++++ .../http/requests_client.pyc | Bin 0 -> 3897 bytes .../models/__init__.py | 20 + .../models/__init__.pyc | Bin 0 -> 563 bytes .../models/account_routes.py | 63 +++ .../models/attributes.py | 129 +++++ .../models/attributes.pyc | Bin 0 -> 3884 bytes .../models/attributes_28.py | 87 ++++ .../models/attributes_28.pyc | Bin 0 -> 2519 bytes .../models/attributes_62.py | 69 +++ flowroutenumbersandmessaging/models/data.py | 69 +++ flowroutenumbersandmessaging/models/data.pyc | Bin 0 -> 2241 bytes .../models/data_27.py | 82 +++ .../models/data_27.pyc | Bin 0 -> 2670 bytes .../models/data_61.py | 63 +++ .../models/delivery_receipt.py | 81 +++ .../models/delivery_receipt.pyc | Bin 0 -> 2626 bytes .../models/error_1.py | 75 +++ .../models/error_1.pyc | Bin 0 -> 2149 bytes .../models/error_84.py | 61 +++ flowroutenumbersandmessaging/models/links.py | 56 ++ flowroutenumbersandmessaging/models/links.pyc | Bin 0 -> 1731 bytes flowroutenumbersandmessaging/models/mdr_2.py | 57 ++ flowroutenumbersandmessaging/models/mdr_2.pyc | Bin 0 -> 1915 bytes .../models/message.py | 81 +++ .../models/message_type_enum.py | 24 + .../models/new_route.py | 57 ++ .../models/number_26.py | 63 +++ .../models/number_26.pyc | Bin 0 -> 2105 bytes .../models/number_type_enum.py | 27 + .../models/route_type_enum.py | 30 ++ iptables-rules.txt | 3 + smslisten.py | 71 +++ smssend.py | 34 ++ 86 files changed, 4357 insertions(+), 3 deletions(-) create mode 100644 .gitignore rename LICENSE => LICENSE.md (99%) create mode 100644 README.md create mode 100644 flowroutenumbersandmessaging/__init__.py create mode 100644 flowroutenumbersandmessaging/__init__.pyc create mode 100644 flowroutenumbersandmessaging/api_helper.py create mode 100644 flowroutenumbersandmessaging/api_helper.pyc create mode 100644 flowroutenumbersandmessaging/configuration.py create mode 100644 flowroutenumbersandmessaging/configuration.pyc create mode 100644 flowroutenumbersandmessaging/controllers/__init__.py create mode 100644 flowroutenumbersandmessaging/controllers/__init__.pyc create mode 100644 flowroutenumbersandmessaging/controllers/base_controller.py create mode 100644 flowroutenumbersandmessaging/controllers/base_controller.pyc create mode 100644 flowroutenumbersandmessaging/controllers/cnams_controller.py create mode 100644 flowroutenumbersandmessaging/controllers/cnams_controller.pyc create mode 100644 flowroutenumbersandmessaging/controllers/e911s_controller.py create mode 100644 flowroutenumbersandmessaging/controllers/e911s_controller.pyc create mode 100644 flowroutenumbersandmessaging/controllers/messages_controller.py create mode 100644 flowroutenumbersandmessaging/controllers/messages_controller.pyc create mode 100644 flowroutenumbersandmessaging/controllers/numbers_controller.py create mode 100644 flowroutenumbersandmessaging/controllers/numbers_controller.pyc create mode 100644 flowroutenumbersandmessaging/controllers/porting_controller.py create mode 100644 flowroutenumbersandmessaging/controllers/porting_controller.pyc create mode 100644 flowroutenumbersandmessaging/controllers/routes_controller.py create mode 100644 flowroutenumbersandmessaging/controllers/routes_controller.pyc create mode 100644 flowroutenumbersandmessaging/decorators.py create mode 100644 flowroutenumbersandmessaging/decorators.pyc create mode 100644 flowroutenumbersandmessaging/exceptions/__init__.py create mode 100644 flowroutenumbersandmessaging/exceptions/__init__.pyc create mode 100644 flowroutenumbersandmessaging/exceptions/api_exception.py create mode 100644 flowroutenumbersandmessaging/exceptions/api_exception.pyc create mode 100644 flowroutenumbersandmessaging/exceptions/error_exception.py create mode 100644 flowroutenumbersandmessaging/exceptions/error_exception.pyc create mode 100644 flowroutenumbersandmessaging/flowroutenumbersandmessaging_client.py create mode 100644 flowroutenumbersandmessaging/flowroutenumbersandmessaging_client.pyc create mode 100644 flowroutenumbersandmessaging/http/__init__.py create mode 100644 flowroutenumbersandmessaging/http/__init__.pyc create mode 100644 flowroutenumbersandmessaging/http/auth/__init__.py create mode 100644 flowroutenumbersandmessaging/http/auth/__init__.pyc create mode 100644 flowroutenumbersandmessaging/http/auth/basic_auth.py create mode 100644 flowroutenumbersandmessaging/http/auth/basic_auth.pyc create mode 100644 flowroutenumbersandmessaging/http/http_call_back.py create mode 100644 flowroutenumbersandmessaging/http/http_client.py create mode 100644 flowroutenumbersandmessaging/http/http_client.pyc create mode 100644 flowroutenumbersandmessaging/http/http_context.py create mode 100644 flowroutenumbersandmessaging/http/http_context.pyc create mode 100644 flowroutenumbersandmessaging/http/http_method_enum.py create mode 100644 flowroutenumbersandmessaging/http/http_method_enum.pyc create mode 100644 flowroutenumbersandmessaging/http/http_request.py create mode 100644 flowroutenumbersandmessaging/http/http_request.pyc create mode 100644 flowroutenumbersandmessaging/http/http_response.py create mode 100644 flowroutenumbersandmessaging/http/http_response.pyc create mode 100644 flowroutenumbersandmessaging/http/requests_client.py create mode 100644 flowroutenumbersandmessaging/http/requests_client.pyc create mode 100644 flowroutenumbersandmessaging/models/__init__.py create mode 100644 flowroutenumbersandmessaging/models/__init__.pyc create mode 100644 flowroutenumbersandmessaging/models/account_routes.py create mode 100644 flowroutenumbersandmessaging/models/attributes.py create mode 100644 flowroutenumbersandmessaging/models/attributes.pyc create mode 100644 flowroutenumbersandmessaging/models/attributes_28.py create mode 100644 flowroutenumbersandmessaging/models/attributes_28.pyc create mode 100644 flowroutenumbersandmessaging/models/attributes_62.py create mode 100644 flowroutenumbersandmessaging/models/data.py create mode 100644 flowroutenumbersandmessaging/models/data.pyc create mode 100644 flowroutenumbersandmessaging/models/data_27.py create mode 100644 flowroutenumbersandmessaging/models/data_27.pyc create mode 100644 flowroutenumbersandmessaging/models/data_61.py create mode 100644 flowroutenumbersandmessaging/models/delivery_receipt.py create mode 100644 flowroutenumbersandmessaging/models/delivery_receipt.pyc create mode 100644 flowroutenumbersandmessaging/models/error_1.py create mode 100644 flowroutenumbersandmessaging/models/error_1.pyc create mode 100644 flowroutenumbersandmessaging/models/error_84.py create mode 100644 flowroutenumbersandmessaging/models/links.py create mode 100644 flowroutenumbersandmessaging/models/links.pyc create mode 100644 flowroutenumbersandmessaging/models/mdr_2.py create mode 100644 flowroutenumbersandmessaging/models/mdr_2.pyc create mode 100644 flowroutenumbersandmessaging/models/message.py create mode 100644 flowroutenumbersandmessaging/models/message_type_enum.py create mode 100644 flowroutenumbersandmessaging/models/new_route.py create mode 100644 flowroutenumbersandmessaging/models/number_26.py create mode 100644 flowroutenumbersandmessaging/models/number_26.pyc create mode 100644 flowroutenumbersandmessaging/models/number_type_enum.py create mode 100644 flowroutenumbersandmessaging/models/route_type_enum.py create mode 100644 iptables-rules.txt create mode 100644 smslisten.py create mode 100644 smssend.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..46ead0b --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ + +creds\.sh + +*.komodoproject diff --git a/LICENSE b/LICENSE.md similarity index 99% rename from LICENSE rename to LICENSE.md index 0ad25db..15bc112 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,7 +1,8 @@ + GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -643,7 +644,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -658,4 +659,4 @@ specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see -. +. diff --git a/README.md b/README.md new file mode 100644 index 0000000..4cf85c9 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +sms-sender diff --git a/flowroutenumbersandmessaging/__init__.py b/flowroutenumbersandmessaging/__init__.py new file mode 100644 index 0000000..34404fc --- /dev/null +++ b/flowroutenumbersandmessaging/__init__.py @@ -0,0 +1,10 @@ +__all__ = [ + 'api_helper', + 'configuration', + 'models', + 'controllers', + 'http', + 'exceptions', + 'decorators', + 'flowroute_numbers_and_messaging_client', +] \ No newline at end of file diff --git a/flowroutenumbersandmessaging/__init__.pyc b/flowroutenumbersandmessaging/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2d263192ddfbee063d995e703782355a2be611e1 GIT binary patch literal 376 zcmYjNNlpVX5Ofxj5ELH40nG*c0fdm?%mr~Fht^j z+}%~SM?Z`C_vUNq%)ZUA-eJlGz+()I9~wV0er)`S@e|{xrkR-+gl6WcIz^h!0d*H> z&9UR63s9HSDl~nmHRPldoV3|<6g~S3YRNHj5gmiCRlA)Ce>(2A6|$qAU4}wN+9lFf zF@KcYD^u#*R}@p7Jhd!RHz76TV&J5Y)d0CV1rXIS5>?omBghie`V!t*th3JoCHqz< zPC2oC$gXc8BlaE_w$jR#aPnO2!G7-!^Mkh~3MnYjb+^&&AKu`(edOCA_Hqsw4gU9E D_y}aa literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/api_helper.py b/flowroutenumbersandmessaging/api_helper.py new file mode 100644 index 0000000..316ce54 --- /dev/null +++ b/flowroutenumbersandmessaging/api_helper.py @@ -0,0 +1,405 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.api_helper + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" + +import re +import sys +import datetime +import dateutil.parser +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 serialise. + + 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 Deerialization 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: + 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 is "unindexed": + tuples += [("{0}[]".format(key), element) for element in array] + elif formatting is "indexed": + tuples += [("{0}[{1}]".format(key, index), element) for index, element in enumerate(array)] + elif formatting is "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: + element = parameters[key] + replace_value = "" + + # Load parameter value + if element is None: + replace_value = "" + elif isinstance(element, list): + replace_value = "/".join(quote(str(x), safe='') for x in element) + else: + replace_value = quote(str(element), safe='') + + 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 is "csv": + url += "{0}{1}={2}".format(seperator, key, + ",".join(quote(str(x), safe='') for x in value)) + elif array_serialization is "psv": + url += "{0}{1}={2}".format(seperator, key, + "|".join(quote(str(x), safe='') for x in value)) + elif array_serialization is "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 obj._names: + 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 + + 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 __str__(self): + return 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.""" + + def __str__(self): + return str(self.value) + + @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): + d = dateutil.parser.parse(date_time).isoformat() + return d + + + @classmethod + def from_value(cls, value): + dtime = dateutil.parser.parse(value) + return cls(dtime, value) diff --git a/flowroutenumbersandmessaging/api_helper.pyc b/flowroutenumbersandmessaging/api_helper.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6df819c99c2aea00b542446f12d9b1d33e888dc0 GIT binary patch literal 15759 zcmd^G-ESP%b-y!9F2A{yXv<=3#p7CvSG7&*Bdr}-mLrpPtTtxcp=39d>A`S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W$cH7XIFd z!ri5ZYV0A$23`%EnTiT>#|Czuf4m|}gHL?KIfZObyX&&82ts{Q`R((t=DKladtIPGr$i#k)7WifG z5H>PHPNi~Buo!1SVKvFlE4=$%7B^UYlLd2$E;UbN)8u@_i*{+0U23XJQhFjNcLRWO zYTM(uGzYAX!6}%novK*1FW`EncDhojovqDP@D_JY?b#D^C#Fx#)Q_RE_&4s?dFQYY z;N~22J)Ac>=!#(CSekK$g0>&F=BcMzv{UYk>nEBF`zF4!`6~}*k&3^?G*z)$%KexH gX&*Sp1Zpmu0PPAR3QZwE2!y>#^RH&j$kUAdzwDmd1poj5 literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/configuration.py b/flowroutenumbersandmessaging/configuration.py new file mode 100644 index 0000000..86cc710 --- /dev/null +++ b/flowroutenumbersandmessaging/configuration.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.configuration + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" +from .api_helper import APIHelper + + +class Configuration(object): + + """A class used for configuring the SDK by a user. + + This class need not be instantiated and all properties and methods + are accessible without instance creation. + + """ + + # Set the array parameter serialization method + # (allowed: indexed, unindexed, plain, csv, tsv, psv) + array_serialization = "indexed" + + # The base Uri for API calls + base_uri = 'https://api.flowroute.com' + + # The username to use with basic authentication + # TODO: Set an appropriate value + basic_auth_user_name = "YOUR API KEY" + + # The password to use with basic authentication + # TODO: Set an appropriate value + basic_auth_password = "YOUR SECRET KEY" + diff --git a/flowroutenumbersandmessaging/configuration.pyc b/flowroutenumbersandmessaging/configuration.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3f075738fec8594cfa36666c5a2ad48b178548f3 GIT binary patch literal 1040 zcmcgr&2AGh5O%U@3V{kFxNw^j3J03u)q_JL5 zGZWLjNPXHC!%=rH#{XpKgDNEv)WlWJorfES%of5DVRU>JtCumt_Y&m|=S`kP&a*DS z48d3m(gu?lvuwa3z{ufH1h zxn5&6enCx7c)z1yZ`(C)QAPLpbn@YR7)6J(lLns64nt8`Sz%Fx zPBJQ|>oS@#peVFcynn=d>AhSREQ67y`I<^g`7=pa)ZT>09K?oE1<%2E4FQ})im ziWR?dUUxZO+yZ@OGuPf+BIPPS=XA<1q($p2=EqLe71}`gz-i2>qUVIHhR?U$|1q)o zO+PnEuGYgiF86p*WZT|vx7r!6*84OQ!#Eg82Oi5}nMQBOE)n8C;$|19Lb~C$>a_bW Ur6;jpZQAoXHiuda?Z(6GFD9-aaR2}S literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/controllers/__init__.py b/flowroutenumbersandmessaging/controllers/__init__.py new file mode 100644 index 0000000..b8e2ece --- /dev/null +++ b/flowroutenumbersandmessaging/controllers/__init__.py @@ -0,0 +1,6 @@ +__all__ = [ + 'base_controller', + 'numbers_controller', + 'routes_controller', + 'messages_controller', +] \ No newline at end of file diff --git a/flowroutenumbersandmessaging/controllers/__init__.pyc b/flowroutenumbersandmessaging/controllers/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6266b6c07b9f268e0e63dc0419ae927ebcfbeca8 GIT binary patch literal 315 zcmY+9O-{rx429Ea`4JLAfW#TP0bc+iBv`XSY+zw!8dDV|4vJII+>A?b8ZN*CMj9q@ zp6$9rK1SvqrQ3*&XepHGO^gP5Fu2i+SJA9O zw|SV8Xf?XYLCBJwn`n?i&oRIMZn56bYxuLDbfnEEjF=~#D)Ytbs_w( 208): + raise APIException('HTTP response not OK.', context) + + # Process request and status code and response text + def handle_request_and_response(self, request): + BasicAuth.apply(request) + context = self.execute_request(request) + + # Endpoint and global error handling using HTTP status codes. + if context.response.status_code == 401: + raise ErrorException('Unauthorized – There was an issue with your ' + 'API credentials.', context) + elif context.response.status_code == 403: + raise ErrorException('Forbidden – You don\'t have permission to ' + 'access this resource.', context) + elif context.response.status_code == 404: + raise ErrorException('The specified resource was not found', + context) + elif context.response.status_code == 422: + raise ErrorException('Unprocessable Entity - You tried to enter an' + ' incorrect value.', context) + self.validate_response(context) + + return APIHelper.json_deserialize(context.response.raw_body) diff --git a/flowroutenumbersandmessaging/controllers/base_controller.pyc b/flowroutenumbersandmessaging/controllers/base_controller.pyc new file mode 100644 index 0000000000000000000000000000000000000000..12a04ac43392d1d8a51ccddbeb8ded76807ae2cc GIT binary patch literal 4894 zcmc&&-EJdE6)xL}^E2^e$?~)ONYpNi){A!R5um*oU^JObMl%|bT{&6MhDEJ*cR4Pn z-R9}u77w75NI2Rw;{3t1MUlv&gairH- zb$VbkqfcX}Y3&*YzlH&KJ~7$EltDz}pWwzFm}bs=5Z;EcXFi=8=iN?bO}-%C zEz6?ZJxk2Q+aeG9H-g@4Qa};|<^+QjcSQ$Pj_~1%7AL6phFc^drUdC8gra?y| zeDFSkW+BI?uHHXfp@^S`dWnD|IBP0hlE~B;KXXf^%jzZO8*-^RyVO$Y3g-x3Z@*0w z-M`?Q?JU!m!EoB2W2tVo>5`Ebdtr+bwaGRy)SJafp+&K01Q4u5GCR<-4?gX z{M~!{U}*HEK%Wk6GSsnl6O-71O%@(LS4M?4cRtP&;K9PesWTn@@LZ>65Kl9&feRQ1 zv*te4MSo-x@3b4nrMaSt8(lnJG^3-psk78coO7ai(Bd@L$c`1(b#g2pVuiDB=apI2v4=&LIy@8BbN^fo4?H%0Sm3HJbRP%99s=GBiqdGL zl8y%+_VO&|%p_A{P!|JSx}t@it^gdYbX$n@<5_Cz{YTIA$@e;U-8#hdz?~TB<&y@M z{4!;B@O9tE@Lb?{yr#-GIDf8GR8u+Rb;6YLyPQ*AryRn4$&0-dqr+Mb1k?^ zP$4OC)peIQIFk*06E_4jN$S!Y;^8*rN(P7Lscu@@6XUu`_ahv|bw_b-ay+p6s7R(` zoXd50iqv%7*xhj^PfgkVe=OC#gp=!Dqp8m1+^^!1QDk%LqliX03RG=F{w19A*gW+! zeBCaFv-@<F>guAVF5ooyu&$0*RoPM=^O_np=;Rmj`E^Zw+T!P@*t9Rs zaleJSpTwC>L4{72U@2PyB9piTw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Im+c+7LPD&HGzm_QL?I`>U|d-Nw+YzgC<7 GYy1}+wFHa+ literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/controllers/cnams_controller.py b/flowroutenumbersandmessaging/controllers/cnams_controller.py new file mode 100644 index 0000000..1a9988f --- /dev/null +++ b/flowroutenumbersandmessaging/controllers/cnams_controller.py @@ -0,0 +1,203 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.controllers.cnams_controller + + This file was automatically generated by APIMATIC v2.0 (https://apimatic.io). +""" + +from .base_controller import BaseController +from ..api_helper import APIHelper +from ..configuration import Configuration +from .numbers_controller import NumbersController + + +class CNAMsController(BaseController): + + """A Controller to access Endpoints in the + flowroutenumbersandmessaging API.""" + + def list_cnams(self, + limit=None, + offset=None, + is_approved=None): + """Does a GET request to /v2/cnams. + + Returns a list of all cnams owned by the user. + + Args: + limit (int, optional): Limits the number of items to retrieve. A + maximum of 200 items can be retrieved. + offset (int, optional): Offsets the list of phone numbers by your + specified value. For example, if you have 4 phone numbers and + you entered 1 as your offset value, then only 3 of your phone + numbers will be displayed in the response. + is_approved if set to true or false, will only show matching records + + Returns: + mixed: Response from the API. A JSON object of E911 Records + that satisfy your search criteria. + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/cnams' + _query_parameters = { + 'limit': limit, + 'offset': offset + } + if is_approved is not None: + _query_parameters['is_approved'] = is_approved + + _query_builder = APIHelper.append_url_with_query_parameters( + _query_builder, + _query_parameters, + Configuration.array_serialization) + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare and execute request + _request = self.http_client.get(_query_url) + + return self.handle_request_and_response(_request) + + def get_cnam(self, cnam_id): + """Does a GET request to /v2/cnams/. + + Returns a record detail for the CNAM Record Id specified + + Args: + + Returns: + mixed: Response from the API. A JSON object of of an E911 record + that satisfy your search criteria. + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/cnams/{}'.format(cnam_id) + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare and execute request + _request = self.http_client.get(_query_url) + + return self.handle_request_and_response(_request) + + def create_cnam_record(self, value): + """Does a POST request to /v2/cnams. + + Searches for CNAM Records that match the criteria + + Args: + value (string, required): The text string for the new CNAM record + + Returns: + mixed: Response from the API. A JSON object of of a CNAM record + with the new data + + 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. + + """ + body = { + "value": value + } + + # Prepare query URL + _query_builder = Configuration.base_uri + _query_builder += '/v2/cnams' + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/json' + } + + # Prepare and execute request + _request = self.http_client.post(_query_url, headers=_headers, + parameters=body) + + return self.handle_request_and_response(_request) + + def associate_cnam(self, cnam_id, phone_number): + # first, verify the number belongs to the user + did = NumbersController().list_account_phone_numbers( + contains=phone_number) + + if did is None: + error_string = "Error, this phone number does not belong to you." + return error_string + + did = did['data'][0]['id'] + + # Prepare query URL + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/{}/relationships/cnam/{}'.format(did, + cnam_id) + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/json' + } + + # Prepare and execute request + _request = self.http_client.patch(_query_url, headers=_headers) + + return self.handle_request_and_response(_request) + + def unassociate_cnam(self, phone_number): + # first, verify the number belongs to the user + did = NumbersController().list_account_phone_numbers( + contains=phone_number) + + if did is None: + error_string = "Error, this phone number does not belong to you." + return error_string + + did = did['data'][0]['id'] + + # Prepare query URL + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/{}/relationships/cnam'.format(did) + _query_url = APIHelper.clean_url(_query_builder) + # Prepare headers + _headers = { + 'accept': 'application/json' + } + + # Prepare and execute request + _request = self.http_client.delete(_query_url, headers=_headers) + + return self.handle_request_and_response(_request) + + def remove_cnam(self, cnam_id): + # Prepare query URL + _query_builder = Configuration.base_uri + _query_builder += '/v2/cnams/{}'.format(cnam_id) + _query_url = APIHelper.clean_url(_query_builder) + # Prepare headers + _headers = { + 'accept': 'application/json' + } + + # Prepare and execute request + _request = self.http_client.delete(_query_url, headers=_headers) + + return self.handle_request_and_response(_request) diff --git a/flowroutenumbersandmessaging/controllers/cnams_controller.pyc b/flowroutenumbersandmessaging/controllers/cnams_controller.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ee8df3fd37d59926ed2199328a0e01c22f8b13f3 GIT binary patch literal 6543 zcmeHMU2_~q746xTR=dK+!A>A1d^8`0*Tn4FhDr*TD;33Yh*MZLvjPfH)G(Uq)s8YB zo9SN30{KZP9(d%DDjxX{Jn;|sHT(h2xjoulNiOUnRK*XGqgGE(&+Xf{&pr3vPW#^% z*Z+0+kKZP$`Dx?tyZE)gN0TbGjW$qeOXYzoT57wcg0!vD6_vMDv7)wD{PU{HS5?tb z+Z{Y(en;hNs_3fiE}qwvX{j+ryXsS=j+Oe&c2A`}HR`W(rN5wA*Z3Ld)j?g&oGE9; zj;U>2riHOK-p$J0K~j~juJRn?gQScL8!blG<@2pcX7xDBjXsF2j%ThaVwWXxo*(L6 zQ<^$6GvFJcID$Jy=-Yi3pHhrfd1O~12+BzK9EH#Z*I#n}8XR`BjU z{Mv_T3=RV}MB7p@Y4cy8K5g?9a6+){_Nv0^u+!lgv4feb(&_S4IMP$$sNbd7U!d90 zi-onTbetrxxxQbf(<&>S)mf?C#E6BTcSyACAX$M_is#>Z__cpR&Kj)1LI^>I(t@3Mb{{j8|FCBAQ~J^2_zl(njk+Z4y~4uu{= zIy!i@ruMq(s3Rk5GSX8=YkVB_JJhEO&EBsJFrt5Ue@oZqlbNxOn;-7q9tyYy9#Y(J zXxywWIXTZTs~T${O3N%=9h4qYu#lcvQ!jnDQSaJ2bF)!Wo)wwXeOUE|uBHS=oL|4A zf6ie`BWn+Qu8}!YV61|6uFlN98R(5u!YHtapJc_X;QZS+Z#Lf~ajAFA{JV5;>a%J* zw&od1Jd$y*#mPRWld3$?$e8T9<1sxK+ZR%=g&m;o5`#-&P3zNNM zT7CZGCb82NG-Jp9fS_(%Clj62z)+pVOOOoX%$hTx#CrFiBu3zPNB^3p1%OOlW2aS; z%xbF-CM4CdX*Niprm>4f=W{0K+u9VBGr|U1SlOJc0J|soEQRlJ-iKRTkLM;hCn>2? zn0c;@4+S!kF23HW(nCDK1|)sh-ehuW&=JlUVZi-0j^ep2STZnZm=)eF@zq zNNh^j3K;?%d2R=xA)3M3B)m~JqGO$mbx->;Hc0nP339u9SA3;QDr!87uZZ(M_9wkd0^|`S9)xv2XKN>wZFC0mjMI@thE;%Mc8^V#~ z1LCwNf%vSG&OMEFvB~fK}Mk zi8oJ7j6i86*ex;#f$V}M&QOB{{b^;Lrw772OKtXE3wo`D5uJI{yzcxP9zYt$!W$qFI=>1U0#WMY zuBzW8llZE1L|SR9t0*|Hf-kO;UZm(`St{f~E&X__M%j>cm-T?M*0spV>F-99(EDmrOck)ml~# zwM<^2)<9K)>SrJ)N-xatF-Z~3ncDB;4+Be61R=BxYm*Dm>?E7|lnSHIL}B=Kd>t~u z>@)ohX!*6qemmt0|7{}IDNp=F-KV!t_qsT&g`0WHMt;_8mGSL&P2n|B8oGs0H4DTA!OPqgDdn$lskTP|!67*|H93kf z4@91TXUHG0ca04brk4HmY05s-QFH-oB z-kN(lU-PWW&70&~Qv3uYO2|8*#F3<>oAzvi`@GYXvml2_{u@4nM#3NRtz^F3kv}*x z$V+%!WKZ6Q?E6UePdr+3g=$Ia+nkQSQ}AIpLS1O0NCJKo6;(PzeIH3K5JhQ~M3G1M zYY-B?&PKDj&gM-vH_#BgOU>s|o`*yl56Lo`ciJ6. + + Returns a record detail for the E911 Record Id specified + + Args: + + Returns: + mixed: Response from the API. A JSON object of of an E911 record + that satisfy your search criteria. + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/e911s/{}'.format(e911_id) + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare and execute request + _request = self.http_client.get(_query_url) + + return self.handle_request_and_response(_request) + + def validate_address(self, + label, + first_name, + last_name, + street_name, + street_number, + city, + state, + country, + zipcode, + address_type=None, + address_type_number=None): + """Does a POST request to /v2/e911s/validate. + + Returns a 204 No Content on success, or a 404 with error data + + Args: + label (string): the alias or friendly name of your entry + first_name (string): + last_name (string): + street_name (string): + street_number (string): + city (string): + state (2 character string): + country (string USA or Canada): + zipcode (string postal code) + address_type (string address type) + address_type_number (string when address_type used, required) + + Returns: + mixed: Response from the API. A 204 - No Content or a + JSON object ith error data + + 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. + + """ + body = { + 'data': { + 'type': 'e911', + 'attributes': { + 'label': label, + 'first_name': first_name, + 'last_name': last_name, + 'street_name': street_name, + 'street_number': street_number, + 'city': city, + 'state': state, + 'country': country, + 'zip': zipcode, + } + } + } + + if address_type and address_type_number: + body['data']['attributes']['address_type'] = address_type + body['data']['attributes']['address_type_number'] = address_type_number + + # Prepare query URL + _query_builder = Configuration.base_uri + _query_builder += '/v2/e911s/validate' + + # Return appropriate type + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/vnd.api+json' + } + + # Prepare and execute request + _request = self.http_client.post(_query_url, headers=_headers, + parameters=APIHelper.json_serialize( + body)) + + return self.handle_request_and_response(_request) + + def create_address(self, + label, + first_name, + last_name, + street_name, + street_number, + city, + state, + country, + zipcode, + address_type=None, + address_type_number=None): + """Does a POST request to /v2/e911s. + + Creates an address record that can then be associated + with 1 or more DIDs + + Args: + label (string): the alias or friendly name of your entry + first_name (string): + last_name (string): + street_name (string): + street_number (string): + city (string): + state (2 character string): + country (string USA or Canada): + zipcode (string postal code) + address_type (string address type) + address_type_number (string required if address_type specified) + + Returns: + mixed: Response from the API. A JSON object containing the new + record information. + + 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. + + """ + body = { + 'data': { + 'type': 'e911', + 'attributes': { + 'label': label, + 'first_name': first_name, + 'last_name': last_name, + 'street_name': street_name, + 'street_number': street_number, + 'city': city, + 'state': state, + 'country': country, + 'zip': zipcode, + } + } + } + + if address_type and address_type_number: + body['data']['attributes']['address_type'] = address_type + body['data']['attributes']['address_type_number'] = address_type_number + + # Prepare query URL + _query_builder = Configuration.base_uri + _query_builder += '/v2/e911s' + + # Return appropriate type + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/vnd.api+json' + } + + # Prepare and execute request + _request = self.http_client.post(_query_url, headers=_headers, + parameters=APIHelper.json_serialize( + body)) + + return self.handle_request_and_response(_request) + + def update_address(self, + e911_id, + label=None, + first_name=None, + last_name=None, + street_name=None, + street_number=None, + city=None, + state=None, + country=None, + zipcode=None, + address_type=None, + address_type_number=None): + + """Does a PATCH request to /v2/e911s/. + + Updates an existing address record and any associations it may have + + Args: + e911_id (integer, required): the id of the e911 record to update + label (string, optional): the alias or friendly name of your entry + first_name (string, optional): + last_name (string, optional): + street_name (string, optional): + street_number (string, optional): + city (string, optional): + state (2 character string, optional): + country (string USA or Canada, optional): + zipcode (string postal code, optional) + + Returns: + mixed: Response from the API. A JSON object containing the + new record information. + + 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. + + """ + cur_record = self.get_e911(e911_id) + record_data = cur_record + + # Only update the fields specified + if label is not None: + record_data['data']['attributes']['label'] = label + if first_name is not None: + record_data['data']['attributes']['first_name'] = first_name + if last_name is not None: + record_data['data']['attributes']['last_name'] = last_name + if street_name is not None: + record_data['data']['attributes']['street_name'] = street_name + if street_number is not None: + record_data['data']['attributes']['street_number'] = \ + str(street_number) + if city is not None: + record_data['data']['attributes']['city'] = city + if state is not None: + record_data['data']['attributes']['state'] = state + if country is not None: + record_data['data']['attributes']['country'] = country + if zipcode is not None: + record_data['data']['attributes']['zip'] = str(zipcode) + record_data['data']['attributes']['zip_code'] = str(zipcode) + + record_data['data']['attributes']['address_type'] = address_type + record_data['data']['attributes']['address_type_number'] = \ + address_type_number + + # Fix address_type if not used + if 'address_type' in record_data['data']['attributes'] and \ + record_data['data']['attributes']['address_type'] == u'': + record_data['data']['attributes'].pop('address_type', None) + record_data['data']['attributes'].pop('address_type_number', None) + + # Prepare query URL + _query_builder = Configuration.base_uri + _query_builder += '/v2/e911s/{}'.format(e911_id) + + # Return appropriate type + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/vnd.api+json' + } + + # Prepare and execute request + _request = self.http_client.patch(_query_url, headers=_headers, + parameters=APIHelper.json_serialize( + record_data)) + + return self.handle_request_and_response(_request) + + def delete_address(self, e911_id): + """Performs a DELETE request to /v2/e911s/. + + Removes the existing address record and any associations it may have + + Args: + e911_id (integer, required): the id of the e911 record to update + + Returns: + mixed: Response from the API. A 204 - No Content or a + JSON object ith error data + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/e911s/{}'.format(e911_id) + + # Return appropriate type + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/vnd.api+json' + } + + # Prepare and execute request + _request = self.http_client.delete(_query_url, headers=_headers) + + return self.handle_request_and_response(_request) + + def associate(self, e911_id, did): + """Does a PATCH request to /v2/numbers//relationships/e911s/. + + Associates the specified e911 record with the specified did + + Args: + e911_id (integer, required): the id of the e911 record to update + did (string, required): the phone number to associate with + + Returns: + mixed: Response from the API. A 204 - No Content or a + JSON object ith error data + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/{}/relationships/e911s/{}'.format(did, + e911_id) + + # Return appropriate type + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/vnd.api+json' + } + + # Prepare and execute request + _request = self.http_client.patch(_query_url, headers=_headers) + + return self.handle_request_and_response(_request) + + def disconnect(self, did): + """Does a DELETE request to /v2/numbers//relationships/e911s. + + Un-Associates the specified e911 record with the specified did + + Args: + did (string, required): the phone number to associate with + + Returns: + mixed: Response from the API. A 204 - No Content or a + JSON object ith error data + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/{}/relationships/e911s'.format(did) + + # Return appropriate type + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/vnd.api+json' + } + + # Prepare and execute request + _request = self.http_client.delete(_query_url, headers=_headers) + + return self.handle_request_and_response(_request) + + def list_dids_for_e911(self, e911_id): + """Does a GET request to /v2/e911s//relationships/numbers + + Lists all Did records associated with the specified E911 record + + Args: + e911_id (integer, required): the id of the e911 record to query + + Returns: + mixed: Response from the API. A JSON Object list with the associated + DID records + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/e911s/{}/relationships/numbers'.format(e911_id) + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare and execute request + _request = self.http_client.get(_query_url) + + return self.handle_request_and_response(_request) + diff --git a/flowroutenumbersandmessaging/controllers/e911s_controller.pyc b/flowroutenumbersandmessaging/controllers/e911s_controller.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ce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T{O%2gw}PN>WYG6$5Zn zD|K}ul$_2I?`&+`eYkUX^MWf{{68~S)O6u8^?QnyK*Hy3Qb3C)`p2iV_=WTbBunPK zvFWY;OkYAVX>bggrif#i;E(FSU7r(a6}*i#j0NcEWMr)D^gQ_EF67?%FDqKC|CAJ z;?)39A7=NaCdlebJ?t=7EMU&9bMN{s1rtsRyAcb#ehQxdDDT;pl{P zY6f7(I7@l$zhbyC7JqU(vwT?A&gJPv2i1$TqC!E5;}3cgg-zb{$6Vk zhpzn};n479a0oA5;84aW&U;$yG#o0g{a1`b&P_O!L*nExC^{?JILmB&0@OHf@xif> z>)hi^S>gZ21T^93#W>TbTsr?qbK|UxCy3Jjo$&-J;=$BGmIoez9JSGpUYt+fmrw3s#f+QQIffN+!B6>k_HZOxPn2sQter~Zl?Q-IPX;-I~Gt!rh+)HFu6~TPO-ID27ERf z4xbS=2X0R^v+otyboeyPb0phLi5J1Zu`wQdD2&yfgVKr4chtw&lTjahFpv1kj=zEv z+l+}J<8*zJahi$v$i(tdEcn1a9aH)7jr=Jef06gQcnYTu*QMU)0?=|0Q-fXTkSDUN$pxF5-n%Dzj zdxSkbRdsM*SZyFviUVGL!7V#r;ZY0PO~2rl9fLD10kx?JU(*Xx_m;yQ$N3=(igG@* aVo#`lnXT@xxE0!LZlih?2fzHiRQnH3-q2kD literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/controllers/numbers_controller.py b/flowroutenumbersandmessaging/controllers/numbers_controller.py new file mode 100644 index 0000000..c653487 --- /dev/null +++ b/flowroutenumbersandmessaging/controllers/numbers_controller.py @@ -0,0 +1,480 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.controllers.numbers_controller + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). +""" + +from .base_controller import BaseController +from ..api_helper import APIHelper +from ..configuration import Configuration +from ..models.number_26 import Number26 + + +class NumbersController(BaseController): + + """A Controller to access Endpoints in the + flowroutenumbersandmessaging API.""" + + def list_available_exchange_codes(self, + limit=None, + offset=None, + max_setup_cost=None, + areacode=None): + """Does a GET request to /v2/numbers/available/exchanges. + + Returns a list of all Central Office (exchange) codes containing + purchasable phone numbers. + + Args: + limit (int, optional): Limits the number of items to retrieve. A + maximum of 200 items can be retrieved. + offset (int, optional): Offsets the list of phone numbers by your + specified value. For example, if you have 4 phone numbers and + you entered 1 as your offset value, then only 3 of your phone + numbers will be displayed in the response. + max_setup_cost (float, optional): Restricts the results to the + specified maximum non-recurring setup cost. + areacode (int, optional): Restricts the results to the specified + area code. + + Returns: + mixed: Response from the API. A JSON object of Central Office + (exchange) codes containing + purchasable phone numbers that satisfy your search criteria. + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/available/exchanges' + _query_parameters = { + 'limit': limit, + 'offset': offset, + 'max_setup_cost': max_setup_cost, + 'areacode': areacode + } + _query_builder = APIHelper.append_url_with_query_parameters( + _query_builder, + _query_parameters, + Configuration.array_serialization) + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare and execute request + _request = self.http_client.get(_query_url) + + return self.handle_request_and_response(_request) + + def list_available_area_codes(self, + limit=None, + offset=None, + max_setup_cost=None): + """Does a GET request to /v2/numbers/available/areacodes. + + Returns a list of all Numbering Plan Area (NPA) codes containing + purchasable phone numbers. + + Args: + limit (int, optional): Limits the number of items to retrieve. A + maximum of 400 items can be retrieved. + offset (int, optional): Offsets the list of phone numbers by your + specified value. For example, if you have 4 phone numbers and + you entered 1 as your offset value, then only 3 of your phone + numbers will be displayed in the response. + max_setup_cost (float, optional): Restricts the results to the + specified maximum non-recurring setup cost. + + Returns: + mixed: Response from the API. A JSON object of area codes containing + purchasable phone numbers that satisfy your search criteria. + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/available/areacodes' + _query_parameters = { + 'limit': limit, + 'offset': offset, + 'max_setup_cost': max_setup_cost + } + _query_builder = APIHelper.append_url_with_query_parameters( + _query_builder, + _query_parameters, + Configuration.array_serialization) + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare and execute request + _request = self.http_client.get(_query_url) + + return self.handle_request_and_response(_request) + + def search_for_purchasable_phone_numbers(self, + starts_with=None, + contains=None, + ends_with=None, + limit=None, + offset=None, + rate_center=None, + state=None): + """Does a GET request to /v2/numbers/available. + + This endpoint lets you search for phone numbers by state or rate + center, or by your specified search value. + + Args: + starts_with (int, optional): Retrieve phone numbers that start + with the specified value. + contains (int, optional): Retrieve phone numbers containing the + specified value. + ends_with (int, optional): Retrieve phone numbers that end with + the specified value. + limit (int, optional): Limits the number of items to retrieve. A + maximum of 200 items can be retrieved. + offset (int, optional): Offsets the list of phone numbers by your + specified value. For example, if you have 4 phone numbers and + you entered 1 as your offset value, then only 3 of your phone + numbers will be displayed in the response. + rate_center (string, optional): Filters by and displays phone + numbers in the specified rate center. + state (string, optional): Filters by and displays phone numbers in + the specified state. Optional unless a ratecenter is + specified. + + Returns: + mixed: Response from the API. OK + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/available' + _query_parameters = { + 'starts_with': starts_with, + 'contains': contains, + 'ends_with': ends_with, + 'limit': limit, + 'offset': offset, + 'rate_center': rate_center, + 'state': state + } + _query_builder = APIHelper.append_url_with_query_parameters( + _query_builder, + _query_parameters, + Configuration.array_serialization) + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/json' + } + + # Prepare and execute request + _request = self.http_client.get(_query_url, headers=_headers) + + return self.handle_request_and_response(_request) + + def list_account_phone_numbers(self, + starts_with=None, + ends_with=None, + contains=None, + limit=None, + offset=None): + """Does a GET request to /v2/numbers. + + Returns a list of all phone numbers currently on your Flowroute + account. The response includes details such as the phone number's rate + center, state, number type, and whether CNAM Lookup is enabled for + that number. + + Args: + starts_with (int, optional): Retrieves phone numbers that start + with the specified value. + ends_with (int, optional): Retrieves phone numbers that end with + the specified value. + contains (int, optional): Retrieves phone numbers containing the + specified value. + limit (int, optional): Limits the number of items to retrieve. A + maximum of 200 items can be retrieved. + offset (int, optional): Offsets the list of phone numbers by your + specified value. For example, if you have 4 phone numbers and + you entered 1 as your offset value, then only 3 of your phone + numbers will be displayed in the response. + + Returns: + mixed: Response from the API. A JSON object of phone numbers in + your account + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers' + _query_parameters = { + 'starts_with': starts_with, + 'ends_with': ends_with, + 'contains': contains, + 'limit': limit, + 'offset': offset + } + _query_builder = APIHelper.append_url_with_query_parameters( + _query_builder, + _query_parameters, + Configuration.array_serialization) + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/json' + } + + # Prepare and execute request + _request = self.http_client.get(_query_url, headers=_headers) + + return self.handle_request_and_response(_request) + + def purchase_a_phone_number(self, id): + """Does a POST request to /v2/numbers/{id}. + + Lets you purchase a phone number from available Flowroute inventory. + + Args: + id (int): Phone number to purchase. Must be in 11-digit E.164 + format; e.g. 12061231234. + + Returns: + Number26: Response from the API. CREATED + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/{id}' + _query_builder = APIHelper.append_url_with_template_parameters( + _query_builder, { + 'id': id + }) + # Return appropriate type + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/json' + } + + # Prepare and execute request + _request = self.http_client.post(_query_url, headers=_headers) + + return self.handle_request_and_response(_request) + + def list_phone_number_details(self, id): + """Does a GET request to /v2/numbers/{id}. + + Lists all of the information associated with any of the phone numbers + in your account, including billing method, primary voice route, and + failover voice route. + + Args: + id (int): Phone number to search for which must be a number that + you own. Must be in 11-digit E.164 format; e.g. 12061231234. + + Returns: + Number26: Response from the API. A JSON object of phone numbers in + your account + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/{id}' + _query_builder = APIHelper.append_url_with_template_parameters( + _query_builder, { + 'id': id + }) + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/json' + } + + # Prepare and execute request + _request = self.http_client.get(_query_url, headers=_headers) + + return self.handle_request_and_response(_request) + + def release_a_did(self, id): + """Does a DELETE request to /v2/numbers/{id}. + + Lets you release a phone number back to available Flowroute inventory. + + Args: + id (int): Phone number to purchase. Must be in 11-digit E.164 + format; e.g. 12061231234. + + Returns: + Number26: Response from the API. CREATED + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/{id}' + _query_builder = APIHelper.append_url_with_template_parameters( + _query_builder, { + 'id': id + }) + + # Return appropriate type + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/json' + } + + # Prepare and execute request + _request = self.http_client.delete(_query_url, headers=_headers) + + return self.handle_request_and_response(_request) + + def set_did_alias(self, id, alias): + """Does a PATCH request to /v2/numbers/{id}. + + Lets you set an alias on one of your DIDs. + + Args: + id (int): Phone number to purchase. Must be in 11-digit E.164 + format; e.g. 12061231234. + alias (string): String to use as alias for this DID + + Returns: + Number26: Response from the API. CREATED + + 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/{id}' + _query_builder = APIHelper.append_url_with_template_parameters( + _query_builder, { + 'id': id + }) + # Return appropriate type + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/json' + } + + body = { + 'type': 'number', + 'alias': alias + } + + # Prepare and execute request + _request = self.http_client.patch(_query_url, headers=_headers, + parameters=APIHelper.json_serialize( + body)) + + return self.handle_request_and_response(_request) + + def set_did_callback(self, id, url): + """Does a POST request to /v2/numbers/{id}/relationships/dlr_callback. + + Lets you set a dlr callback for a specific DID. + + Args: + id (int): Phone number to purchase. Must be in 11-digit E.164 + format; e.g. 12061231234. + url (string): String / URL to notify + + Returns: + 204 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 + _query_builder = Configuration.base_uri + _query_builder += '/v2/numbers/{id}/relationships/dlr_callback' + _query_builder = APIHelper.append_url_with_template_parameters( + _query_builder, { + 'id': id + }) + # Return appropriate type + _query_url = APIHelper.clean_url(_query_builder) + + # Prepare headers + _headers = { + 'accept': 'application/json' + } + + body = { + 'data': { + 'attributes': { + 'callback_url': url + } + } + } + + # Prepare and execute request + _request = self.http_client.post(_query_url, headers=_headers, + parameters=APIHelper.json_serialize( + body)) + + return self.handle_request_and_response(_request) diff --git a/flowroutenumbersandmessaging/controllers/numbers_controller.pyc b/flowroutenumbersandmessaging/controllers/numbers_controller.pyc new file mode 100644 index 0000000000000000000000000000000000000000..973ee6d068c4f1c09ba0d6c8a10b9973f5cf9ab4 GIT binary patch literal 15203 zcmeHOTXP)68SUMbRu`K<2oQ4b00|3`cWvPkRSuOz$RZGo?2JWGQ7W~JW_q<_W@nb^ zS=j=s@?igfyyWtpACQN<!b z|9$X}-+ChZ*TCOj;8%Z)!WUu(Wli{X5!S?@E_Ujo<~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S}8CB3-Y6PhcqEm>iWsx^v-hrBMb%*non=`?pgQ=~^crU|$ z9&edFkifm}o%{FXojbQ8J%l^j&k7_uI|<@C=v(VhxeGW*q{w7kmo3fPc4k#)<%+m& zxayMQak&XWwNk9~$4-pPNoKFsn!Grh_YdUm!G3>lzyFHSpTy|5K?X`oUT_y$B5b|X zJOWLJ5{Jtu{{iYQqZ|PWoUv8@jOKIHCNGf(NC7>TM>&p1Co2x))RDvZcj=0cR*2v) z53s)jZN|(Xzv33}3`egKo^tLdzD?Y|*0|o>Xl+!pM&ihxE18Kjku=OO;%%Eieb>KjX0j^P2?bHhu}sKW>I}L`H!u9iHt{D>|t!gJ~Bw(HF%|Z21hs5n0@)omG!JdkS$~Tt2v>0k-T-HJ@XW7x*Y|zWj zEs}oDExugNkTNLFUM>ynAE@UOQGuj|&c$vt_c;}Gr+j{jV@uz6CxCvEMPr;M`h2|U z`%xD9zV}T?;M2o>9PN2;()cA6-=|^|#Vm2-t1snf(1RNllyn-(LEEi%bFI^AT>Ht| zkJfIw%=d?=x7319WM@Z>9;yV7AKy>m)RVqta>+5pLTESpmdS-&94AqCFT=Qb7JugE T?HBx&6rD!5o3AzK_gd?}x|P?T literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/decorators.py b/flowroutenumbersandmessaging/decorators.py new file mode 100644 index 0000000..4475c26 --- /dev/null +++ b/flowroutenumbersandmessaging/decorators.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.decorators + + 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/flowroutenumbersandmessaging/decorators.pyc b/flowroutenumbersandmessaging/decorators.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e3e9591ebe85a9c866295536ffde05f1e88206c6 GIT binary patch literal 1206 zcmcgq!EO^V5FPJ^&;}|%oVfXz9>^jN91ubc<~SyelI zWl`IXLSv~aY+bMP+ z9BTV@WtMGNx|UWqf)t;;5t^F8u^`sL$O4q8nWQ^elOE(}Ly?b%3}b!6SQoWLW*b^9 zPw2`cSx*%c4t`W5oP9lx<@ytbwSqN(iNRtU^NYZi37^yW4vBlSxg*-+z!+~EXAJGj zZs&`*9?G9%BD#8(%jF@DE#PO4va+o%9cD%L0on9yVZHOgyX^PJz!v>$C z^QCLEe-$dbk&UC}YR9bd6&WKQqi_bbuL^NW7BZsj7aXwc65z`ov=5_N_CVAt*eLjx z0wp_R7AdS#*rcF%y7ol=6s4Xr{V0|0@)kO>L~Sk)#)ivdqAbI7K{6LL(jA^JZQZ$B z^+yOA!!-=K-z1o`gI`)Ei*-!oe5|u0% literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/exceptions/__init__.py b/flowroutenumbersandmessaging/exceptions/__init__.py new file mode 100644 index 0000000..42782a8 --- /dev/null +++ b/flowroutenumbersandmessaging/exceptions/__init__.py @@ -0,0 +1,4 @@ +__all__ = [ + 'api_exception', + 'error_exception', +] \ No newline at end of file diff --git a/flowroutenumbersandmessaging/exceptions/__init__.pyc b/flowroutenumbersandmessaging/exceptions/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aaa67e7d32cd63ad3d5b475eb883136c4522b279 GIT binary patch literal 253 zcmYL^O^(7a429En0YXB+0~Vrd9JX%N4hoCXCFC#s6#2m^!B!O zG4@Urh_>qxYnA2=IcW(l`3ng&uop@KXUoKq3BF@91mZ046&-;DSqibE1g9=uQyen! o5Po#VvI`_)ThA^0e@Ot*v(JdD{+_4$)H*~rbhH^4lo3_&2P-v1V*mgE literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/exceptions/api_exception.py b/flowroutenumbersandmessaging/exceptions/api_exception.py new file mode 100644 index 0000000..3aaf90f --- /dev/null +++ b/flowroutenumbersandmessaging/exceptions/api_exception.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.exceptions.api_exception + + 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. + context (HttpContext): The HttpContext of the API call. + + """ + + def __init__(self, + reason, + context): + """Constructor for the APIException class + + Args: + reason (string): The reason (or error message) for the Exception + to be raised. + context (HttpContext): The HttpContext of the API call. + + """ + super(APIException, self).__init__(reason) + self.context = context + self.response_code = context.response.status_code diff --git a/flowroutenumbersandmessaging/exceptions/api_exception.pyc b/flowroutenumbersandmessaging/exceptions/api_exception.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ec895189e59dfc440985c0c51564bf6a81b54c50 GIT binary patch literal 1464 zcmc&!!EVz)5M3v2Xi|DYg6kaJ12*chLWq!7Y7bOZ8V;0$wXr9OgR>iX$896^R<8UH zKLJ0(jT19#Cv7iWkihbccXwuI=e^l+`{!Qo`|8`LR5eeVzi(L_u*#IWWF06B)Fe<@ zOMOx5PN|QVEtR#^MYtuNUs?44U{cuY(pH3~T8y!D+GGoKPET_)jqoPLCFRz*NH6nb zGwsRF(JXf`$qR&Q?Lb##7n<@^7sU#uXt30T8H`uZKRL7XrA^vsP-C) z{uPfB^(=fM+-(bs)e_4g4;1aNN|M~P%Fg~(rwLrdy@qn*d>=y2&Lz7_{ z|EW*oO=CJ~s{1~TmaCyO#xoWtDXHD(K{xP!fCjkH3uNFuwk65JW>q0m;UP&fn){c{kKdY8os!JVB>>&){#l(LW*HkZp6^*^WUseN6O`9`R8QiM+HHvuS=;{X5v literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/exceptions/error_exception.py b/flowroutenumbersandmessaging/exceptions/error_exception.py new file mode 100644 index 0000000..607d1c2 --- /dev/null +++ b/flowroutenumbersandmessaging/exceptions/error_exception.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.error_exception + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" +from ..api_helper import APIHelper +import flowroutenumbersandmessaging.exceptions.api_exception +import flowroutenumbersandmessaging.models.error_1 + +class ErrorException(flowroutenumbersandmessaging.exceptions.api_exception.APIException): + def __init__(self, reason, context): + """Constructor for the ErrorException class + + Args: + reason (string): The reason (or error message) for the Exception + to be raised. + context (HttpContext): The HttpContext of the API call. + + """ + super(ErrorException, self).__init__(reason, context) + dictionary = APIHelper.json_deserialize(self.context.response.raw_body) + 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.errors = None + if dictionary.get("errors") != None: + self.errors = list() + for structure in dictionary.get("errors"): + self.errors.append(flowroutenumbersandmessaging.models.error_1.Error1.from_dictionary(structure)) diff --git a/flowroutenumbersandmessaging/exceptions/error_exception.pyc b/flowroutenumbersandmessaging/exceptions/error_exception.pyc new file mode 100644 index 0000000000000000000000000000000000000000..283d2252c27fa6050234a5aee210efe9892d0760 GIT binary patch literal 2387 zcmc&$U2h{b6upzA-6nKDBn0B?!Ea23$ZU~#saA;6t=N6os-#^ZiqOcJaT3o?#)Iv& z4eCCXSN;!wf**tU0dTG-O&XBOV@I`Pdwj32&pG!_+kZXm{W1Uj$BY(F8^2$px$n^B zL}%zD%3D-MG;PsYi=w7t#Q7Kfry>>;?`yZ0B(m1QqOXnE z>FE|CiX(Ksiw;IFR9P#l|HgCVA7Sl~!#KQ&VhI=9e1qmbLZ<*1E=_!C00rE5(5Asj z%m-wQZ3m5i5768xI*-4It^iYuiWXgA+~RTM+f;P;MX|8}^*W-rZSq@mg}%$1>~Yx8 z;}yJ(s=!urocoiHF_rUnmU&~v2+dEFSig$MO6gn!D|51M$8Ilx%rkzhlFn2jh9mH@ zvnNjB~w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X-jTG^_k=y^7aK6dfchr71f9b#>z`-hOV z5c+s0fd=+My};Eoab|)|Zb~9nfprc9l4K#ofqFQ1`O)X1#3h~V#&bv{;@ikATvTr` a*aKqZsEEtkQ>W(ilX55>{SL2+$$bG~%sU(a literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/http/auth/basic_auth.py b/flowroutenumbersandmessaging/http/auth/basic_auth.py new file mode 100644 index 0000000..dab71f8 --- /dev/null +++ b/flowroutenumbersandmessaging/http/auth/basic_auth.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.http.auth.basic_auth + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" + +import base64 +from ...configuration import Configuration + +class BasicAuth: + + @staticmethod + def apply(http_request): + """ Add basic authentication to the request. + + Args: + http_request (HttpRequest): The HttpRequest object to which + authentication will be added. + + """ + username = Configuration.basic_auth_user_name + password = Configuration.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 \ No newline at end of file diff --git a/flowroutenumbersandmessaging/http/auth/basic_auth.pyc b/flowroutenumbersandmessaging/http/auth/basic_auth.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2732a54beabb2ec2dd57fdbb9c750dc8906eefa0 GIT binary patch literal 1481 zcmc&!!EVz)5FOh|+C(j&g2Z*XxrfGpplYKE5yF8Us8CuCgoCy5Zj!ZZZ}6@gg(jzR z;g8@W_!>R{W;Ruua^MJ-cQQNPd7gQ1oZ#nn>&N`t#{{mf0DoWNGKXjczyPfW!iUU* z0XhMQ8e~4?0Sp50L>V4Mwyd+Y@W2ZC=?)d&rGSVscxQbv99kjZ`Mtj2nhwopY-ao@H}3mW3?2m4XfDto!cx zZTIZB$IhR&AG44VqUl5tpDLHpR+{a$)GxeF6!jN+XzVtco-RgeTp^Uwg>7Qw6&2CN z8m<}fDT>QHL?e+A52R1jP|HY40R2;km=J6O7rmp0%iw9S0I3H{&pAFUG1Y@KfQ1JO zA1*NxfUQAV2it&j0~P_H;+<|1mFO&y)4-+F+_nx2yb-oZS{$JSry;%8d`H8&0!g7J zh_Z<+h%)MqS7H(&JCR)ASUVBy76sP$vs6A+;tHY7t+%II6;fD&S%Hfc zf`g3Dc~;2~pMf)Gj9w&4buLYmMDG#RL@6(1p$i$k)=8D4;3n!}-I2-7o{xYftBv^x)HJHot?8p|+se^qSs|_sF~Jg*Du}-eN~_99z;Mj&m)lOyZU@ zjHOQ&1(;~j-@(95FaNxuK7F39DEgus{;Cw}(y<@MLML(DCvDx7CF}nUZoVACf9$}~ TeY7I@1x<{hVjKRJchCO~E69g6 literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/http/http_call_back.py b/flowroutenumbersandmessaging/http/http_call_back.py new file mode 100644 index 0000000..b2815d8 --- /dev/null +++ b/flowroutenumbersandmessaging/http/http_call_back.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.http.http_call_back + + 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, + context): + """The controller will call this method after making the HttpRequest. + + Args: + context (HttpContext): The HttpContext of the API call. + """ + raise NotImplementedError("This method has not been implemented.") diff --git a/flowroutenumbersandmessaging/http/http_client.py b/flowroutenumbersandmessaging/http/http_client.py new file mode 100644 index 0000000..cd29e1f --- /dev/null +++ b/flowroutenumbersandmessaging/http/http_client.py @@ -0,0 +1,177 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.http.http_client + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). +""" + +from .http_request import HttpRequest +from .http_method_enum import HttpMethodEnum + +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 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/flowroutenumbersandmessaging/http/http_client.pyc b/flowroutenumbersandmessaging/http/http_client.pyc new file mode 100644 index 0000000000000000000000000000000000000000..65f289328d25b91626954ea5e1ec568e2d8e6d0f GIT binary patch literal 6688 zcmeHMPjlNu6kq>|lelRKrF0kuW|o^e)7lIN{$v=2;JTzUZ5kBkKsab*X&oy_TBBXH zcqSKU4;(mg9u`drB zENrlSXO%|!0iwyV4PyBylerdYp7ceg{4`92QvOkt9<_#AkBsnwI1;IDnn!xWNbx}w z3;xJg+|RX4d>sXT9FO^tNJZvr5%T_+Z|~i`zumjr;Sb+yy~`a=!>O%y+aE>diB=@} zjaDBC<&0-Tm z8w5VCuXV?19wWJ-Pqzim~QS{gjJ%L0*&AbooDHpVeM#E2R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@oQ|#2x5KTy9q0~=dsvszixbdMWKH*(b$=*5 zi1RLUBHAflMXaltH2O?rPIz=7aHp%R^yVBxR%Gu3U(W1ITeNI`_SO|`gO)dN(PN z%BfuWAO3(7U&9YDGj0P?5l8CS&$FK0nR#z#Q~J4H{W1UcK7_NYgzxA07=aK0^bj3T z4h$TKT=)WT3h=JyLR5lIZHZ=nMW_nA21$0DXH%>6H0`V0NFAlh7&(mfus*VO!Vsj& zjjhQ)3PB-1q=krl9O#vZVsDAK^~w+} zL9YT)8G6g0Rv@Y{dz`k)!{zf~75q+Zg<^h3plnoeoN18_gw$fE+ii=Yl!9-=+C1)~ zPG*z&lXfp#-A&P;m+;lmR2jQ)wcm8uNAHWygTi<47gwX(+@YXtGA^v#ZoO`GTjVdS z#RN`lsS&UmOIu8t`9u4lYs>V3BH9XC#oEwClV;MYCO+mF!lx%-0jvWj*fkD}UFsb) zwm;s64=#Mhy96hAJ8a(6?wdki;nC*dd8gzEe7#tl$>P%NS^=ti&5BIHwd`_%iEqJ)VwruZZC z*U57O;WuNp{%hCxm>)=fa~+|wR&f`<(zVs%H262s#iuswk5y=S&1DwNd-1eTe~Yx| IjjFi60F6wkwEzGB literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/http/http_request.py b/flowroutenumbersandmessaging/http/http_request.py new file mode 100644 index 0000000..d8835f8 --- /dev/null +++ b/flowroutenumbersandmessaging/http/http_request.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.http.http_request + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). +""" +from ..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/flowroutenumbersandmessaging/http/http_request.pyc b/flowroutenumbersandmessaging/http/http_request.pyc new file mode 100644 index 0000000000000000000000000000000000000000..485e0c6d8f0cfa39313e2886d605b8b4a2084d29 GIT binary patch literal 3532 zcmd5N>Yx>8A2AfZ*YtVjz>E3wsLx(CX^n%I-Z#qk8sxK*UR zbuau1uKWbVf8f_};mG&iIF1uUrAjN7bp3Wb_PlxT``-H|>Hhh!_s9IV9}-c2y7>PK zT=p?cD#QhBAkvP=12OH0i;f7=uFzdE#_Wc8BgCx`-(PHqbW?m6Zqdr0VR{muac*u( zQ#oB!(~&N%D$=R8R$XSrWq;z_j7?nXpDJx#kJp?}GAqYfuH}ugQdQ1OmCF*9=W}_f z3tcLwQ#qQ;;mgw(!}HT)dHqTMu?!{ovxkF$nq|DApBcH|?`0iC69zDD2L`K7bUxFi zdk=RfSQGi(8vr&je}v0EgV6v0dBS!m!R5a|yx96u`*LSvl2iV$uUS(JBRS2Mi5CI#Z>>LzZCf>MKyRe<;r<+K1(5 zrJE=R14?R=q@9>5PaAg}lP)Pcc{9<4B&KxQZ(gV~kYSo74m%7b4S<6x=hBQ98OrcS zJ(q{_TIH4A_xt*-$%6VLsxeP5ZC@$;V0NEm^ zW>uXM_VK=*S^8PR{jUkMUSYIUsiiZGH;!~Af%T|CJtx5!j!eq1w6gMCCJ#`KbWuGY zma_V9j*5-t>jzwE!|#R|dVc>YN19`jT7; z@;T49%5S~c`o5Y7`!iN+*1;Botdb2ajw-H((LKU=9VpksdC={w9;+BSe=g} zsEBBIwqT;5nntr( z^PVpI=odVaLsWyR1&ykMdbrg{E$Dp@?GOv}DIn=%NAltEUo8OE$+b0pZf#K` zJ!gCfGW;Q>6%hhV5bedpv4eL(1{D!{DfXFuiaSdMBew5F!mn6Slh9P;+vK5fdQU1^ z>(<$z7Fe zcwH!2{8(I*T&sd!{J#*tN8y9`wUEEYw50+S+q=PDa2B#)kcnfGj5ucTkK?IHtDJ60 z%i}mT3C4uZ8ALmxZ`~1zYeWSW(IK*|ZXW$-q94)E0O~PIQEa`xwb>2mZ+CB}x6?Zd u`BWk_I5GT?fFRLtg$Pr^5fo;0r4z?~-c=HOay|8!KO@8~LA@0`>iiAEm&3XM literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/http/http_response.py b/flowroutenumbersandmessaging/http/http_response.py new file mode 100644 index 0000000..f92112a --- /dev/null +++ b/flowroutenumbersandmessaging/http/http_response.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.http.http_response + + 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. + headers (dict): A dictionary of headers (key : value) that were + returned with the response + raw_body (string): The Raw body of the HTTP Response as a string + + """ + + def __init__(self, + status_code, + headers, + raw_body): + """Constructor for the HttpResponse class + + Args: + status_code (int): The response status code. + headers (dict): The response headers. + raw_body (string): The raw body from the server. + + """ + self.status_code = status_code + self.headers = headers + self.raw_body = raw_body diff --git a/flowroutenumbersandmessaging/http/http_response.pyc b/flowroutenumbersandmessaging/http/http_response.pyc new file mode 100644 index 0000000000000000000000000000000000000000..87b45d8a931d4c0956f6c252325466698339f0ab GIT binary patch literal 1579 zcmc&!&2AGh5cVbzXeein%yBD~EaDg;L+DW$T+L7%|6sb2j@gO_{ zFTr#00K5P*-k+wG$`MxbWHuhpH{Uno?f-r}{JHz_DPzsk$KThu9H5bmU7(Gair6Az zvd6wM_Jy&J7d^#0lk>Ah^0iQ)-w$@Z$>8hM7>x7o2a!xFBy&SE)UkAgja%-cV z8iqr&RqkMs7Yeq*fvCJGh0ill6gyZdt*r1$!h8plv(tBz+36HEFGkNH21@A0Ng~#H zI5El%9F2zl5X(8iy|jVps71K(h6;XyMja=O~*Scj0w1PRSt7wLcoeY^C-w5Tce57S@#DX;;~evgiumB_iz1*g9A`@CNr$ z@%Hqni)<={SmqhwO@JJvFYFG?qGbT_XSIVdY(!D1qW}h5WmT7l5L^1N&HXCW*5Y+x zr~xMpAa+P!FB^twBMl)Er<;n?grEo%Uu&1q1k$3uO{sTJ(OgCBiZPB(FF5$x4^HTH z)8t=t0_V`%D)Ytyw!22$n;pms;am+xye4+J*ChJqjz+a~_d9kiH66SyH?_Ar)ok88 zaff2|rD3rA1AK3g{6q9xfN-rnsp?d*Na^0Bq;E=DVqCRx zc!yXbZN5=1$&wE^elEEbT4|$I^44TkskC>=6o)u*rF-U-#ygPw?K6?ktq!L9OpMmM zP#x#F&OPUJd)FxilH)>3#IC83ga&(MS=T p9pG}L?ci|Gs~eM2^`0o1`K8Kyi2H9<2C-k(>b)ZE9QA(C`vaSqy_5g| literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/http/requests_client.py b/flowroutenumbersandmessaging/http/requests_client.py new file mode 100644 index 0000000..168d5d1 --- /dev/null +++ b/flowroutenumbersandmessaging/http/requests_client.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.http.requests_client + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). +""" + +import requests + +from cachecontrol import CacheControl +from requests.adapters import HTTPAdapter +from requests.packages.urllib3.util.retry import Retry + +from .http_client import HttpClient +from .http_response import HttpResponse +from .http_method_enum import HttpMethodEnum + +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, retry_interval=None): + """The constructor. + + Args: + timeout (float): The default global timeout(seconds). + + """ + self.timeout = timeout + self.session = requests.session() + + if max_retries and retry_interval: + retries = Retry(total=max_retries, backoff_factor=retry_interval) + self.session.mount('http://', HTTPAdapter(max_retries=retries)) + self.session.mount('https://', HTTPAdapter(max_retries=retries)) + + if cache: + self.session = CacheControl(self.session) + + 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) + + 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) + + 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. + + """ + if binary: + return HttpResponse(response.status_code, response.headers, response.content) + else: + return HttpResponse(response.status_code, response.headers, response.text) diff --git a/flowroutenumbersandmessaging/http/requests_client.pyc b/flowroutenumbersandmessaging/http/requests_client.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3c5443161e7c7851e029174f113f609a98c249c3 GIT binary patch literal 3897 zcmdT{&5j#I5Uv^jt-ZTR2ni$*NDFb89Iz4Gq9|fng2*AOXm&xu97gS#ws$u3W2SpH zv9vjDjz}Ch^Bz0}Pr(~-;sjrHkJn}sMVwg0c9;8ax~r?c`nsm|=l0i}Gz6Z=*dR)u$;|-J};pr$pb6FY)&K!PZi%fxu^)l~1d( zHma!eiK?_Ll3ZymXK67T9vU+rR_e!EX``b!OI2Y8_OXM*REuevDe+WlA!}3S(xkD> zvW1wbLRHeJL`)W9=kdcwI|mPU#qnpuPemYjNqu)TlJnF)F-%KwXE;dz#%C|^pqpU@ zcV&F2cFV$4W#)P}(fiH8!Q-7o&W);EX9u03GSwpGCtcrwCt{aftL|z^?hBQkmxWfY z_fj+Skury6@&Fbv+!Zzlb_<+&l=u1)Mc;=|@F9a3Yi`YZ>`ShaA9)x#c_c40f zw$h`dV=EgJ?gu?y=U0fGLZtaTQ#mXP1D1s-r(&hOFo)8JS}QGi=uylIPvI&D1x^YR)+nD1&@9;FtKWejq49wJ~ zlMaTwQ=h!mSm&j&0z3Fr{Y<9Yta0j8@Cie(d}GunP>zoo!_B6uV^dbmY1ke+)ojf= z|FRGQL7unKEGs86Tbe4+3acg>a9tUgtzt?eGYg%GjGvU#X*89*v1T_j;DL9;_|4_B zr~+J5MA$|%#=)>>0bzK0<1xd-OLy1-U_b*Oq0f_e*SxF?6Ef~Y6bjf!rVXK0HVrun z?6jC8DeQBT!Ohz*BEUga$55KLY%~f`B`fp{wNX-~$4Zal(YG4BFglWjD#}8QzAEFI z;i^ZwWuitp*Pm!rB&r&{j!Q;thtcvx4VMh(3wzKA3Z*8BZed@2h4tw5z03ZVcip?? z-S)d)%%^UlY@=8ZN>msx_<3Z2s1{=qxMEnK0%*C4jY;l71iCpJ7Io<9b4>Cg13L9P z&w*0ZHyLN(AOLdT+Eo96tsXp6F+xj7F@seK8=_4_3R8me42A$WuqL9&k&Iw8tf2BT z_8M!5z)_Q>*(OR~xr=g2ticc5S69V3NW0aX4ld@;Gy=I81jpKbYl~Sh94ZM{YD5{) zTvjsI7E_4?Ju&K-^R-1+z`h8XtQ!GPyu&3as_3g-lEeM?Z09GY>WXA@qWMruK(iYT-<6)M9X|kl#?SB8%}5E} zQ)9>`wT!62s5P=`T%wKx`7Xv{NX3nXkWtUf8kaG8EG;|dT?~*cz`uhgnlA|2?0Pr- zy};7_2HH^s8>=X?)Ez~6nba9K`Djs;lyMY=AEIv0w})&Zyoy#RSbW5S<7ag;Tl+t= zk&sWt!L9l3>Grz*^{f4B{cFKxG{ZYAIFGZhC^oTTf8iCyW?+VcY?53F7BVxJ-tivx!i?=ZOvs^V_`0>7OT;=Tas1kDcezIV gBIh`Z&vJpbwD;~k2Z8$x0DISU{Vo5Bhi@bQ0lWay;Q#;t literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/models/__init__.py b/flowroutenumbersandmessaging/models/__init__.py new file mode 100644 index 0000000..acc3b3a --- /dev/null +++ b/flowroutenumbersandmessaging/models/__init__.py @@ -0,0 +1,20 @@ +__all__ = [ + 'error_84', + 'new_route', + 'links', + 'attributes', + 'attributes_28', + 'data_27', + 'delivery_receipt', + 'message', + 'error_1', + 'account_routes', + 'attributes_62', + 'data_61', + 'number_26', + 'mdr_2', + 'data', + 'route_type_enum', + 'number_type_enum', + 'message_type_enum', +] \ No newline at end of file diff --git a/flowroutenumbersandmessaging/models/__init__.pyc b/flowroutenumbersandmessaging/models/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9ef9c71cff32f929027323896b1fab56c2ff85a3 GIT binary patch literal 563 zcmah`%TB{U40K=g0e$iZoO*#(D^z+w2no(y5EnSC(%4jiWK*pjs{9#W!O!pmI7y`l zaUh#`XGUJntkU`(4!-iwmkfIYxI-~jL#@C0xO zI0764P5`H{ox!snoWbM#REJ1U3wfV7cwe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K6YI1(T2agZi5_hn$FGqQX%a)nQG(eC80M_dt?Jr(7ruPgwou|w=PcIzVs*Mv~ zf}o8k<6PPJvAEQ0gGd#oxipB(9Q%M{gh#R2P#8K=h64uO7&sOOqY)g~e28~%a$z28 z-IxRY#Z%#Se`^XfyU7eYl!<$Er%-2?admJQV#o^#AFLLZ;eZxfaz=ahqL4#At z48XSp*cmn)@7`_D^FF}IAK~FYC}OSdl#1&PeJjpQ1io9&r!3jNb!W?2FIJr5CEo*= z;^#Do5+{A1f%1J=X`GNq?C||43(=;W<1=-c3m#nu3?&^-R>&^>EMn#6puA&b=${QK zq+6&eH!H=WQ@!+CD_w?1(W&2X*&jZ}e6xw_O?+OtT4c+x literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/models/attributes_28.py b/flowroutenumbersandmessaging/models/attributes_28.py new file mode 100644 index 0000000..e777bc4 --- /dev/null +++ b/flowroutenumbersandmessaging/models/attributes_28.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.attributes_28 + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" + + +class Attributes28(object): + + """Implementation of the 'Attributes28' model. + + TODO: type model description here. + + Attributes: + alias (string): TODO: type description here. + cnam_lookups_enabled (bool): TODO: type description here. + number_type (NumberTypeEnum): TODO: type description here. + rate_center (string): TODO: type description here. + state (string): TODO: type description here. + value (int): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "alias" : "alias", + "cnam_lookups_enabled" : "cnam_lookups_enabled", + "number_type" : "number_type", + "rate_center" : "rate_center", + "state" : "state", + "value" : "value" + } + + def __init__(self, + alias=None, + cnam_lookups_enabled=None, + number_type=None, + rate_center=None, + state=None, + value=None): + """Constructor for the Attributes28 class""" + + # Initialize members of the class + self.alias = alias + self.cnam_lookups_enabled = cnam_lookups_enabled + self.number_type = number_type + self.rate_center = rate_center + self.state = state + 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 + alias = dictionary.get("alias") + cnam_lookups_enabled = dictionary.get("cnam_lookups_enabled") + number_type = dictionary.get("number_type") + rate_center = dictionary.get("rate_center") + state = dictionary.get("state") + value = dictionary.get("value") + + # Return an object of this model + return cls(alias, + cnam_lookups_enabled, + number_type, + rate_center, + state, + value) + + diff --git a/flowroutenumbersandmessaging/models/attributes_28.pyc b/flowroutenumbersandmessaging/models/attributes_28.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3524e32a69b8c5ea62c5585231bebd3266e3af56 GIT binary patch literal 2519 zcmd5-&2HO95MGKhWvkB5p~s@wLs2t_iiHn?ArwVbrw1RR1hjIfdLUNhN}^5e61yv> zD$kIV>dhE;e1^UfWk>n=G&!w%%UC)rS!;Ad^{imF5ej)yThh;go zg0TtqfXRT(0#>xxE5>da`*G4@MaVAWHd+3Lt;_M7Rr-a|D<{=zIhDo=RV<~oVqU6w zZ>bAe*`9FDlvCK)?DVYbkBt|l<+HMq{DrVwtejp7SLULs)_g9NG{VV(PuG0-?BdCA zd~wciPJ3VTm@k~G?I1}+UHTKfQu9Y$cZ_(3+s~YyZFB43#rG8P0-Ho`NC|t3l@TS0 zyN?uc_mLd#e$i&Q`^5pn-7jDjvHk?_j^4OC>{Y}j2Ta1~(8Cn4Nr$DEahJaMN5I&{ zvaaM(Du?W};(Es2Lh_USP*1prskZ^<>EovZ?$)(z9`i!l+?2IHzK}+4>~V@moMEKlad#s8%>sD)+t!J-F@w_4MevPa(YxGWQ8y>>=Uxy|law zAFG#q068@$trpffmK|Vw8L*d(We{3kfEs!MYTFA?54-?1@&cMQz-W>m`z1Nk3SF?u zoi==iMNPNsnA0vvn^HA zR+g2jbXoQVeVoXEb&rDAS5C>173Jb_zJ&msiw?U!Wac3Wm(Z^~A>0P+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flowroutenumbersandmessaging/models/data_27.py b/flowroutenumbersandmessaging/models/data_27.py new file mode 100644 index 0000000..8b81229 --- /dev/null +++ b/flowroutenumbersandmessaging/models/data_27.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.data_27 + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" +import flowroutenumbersandmessaging.models.attributes_28 +import flowroutenumbersandmessaging.models.links + +class Data27(object): + + """Implementation of the 'Data27' model. + + TODO: type model description here. + + Attributes: + attributes (Attributes28): TODO: type description here. + id (string): TODO: type description here. + links (Links): TODO: type description here. + relationships (object): TODO: type description here. + mtype (string): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "attributes" : "attributes", + "id" : "id", + "links" : "links", + "relationships" : "relationships", + "mtype" : "type" + } + + def __init__(self, + attributes=None, + id=None, + links=None, + relationships=None, + mtype='number'): + """Constructor for the Data27 class""" + + # Initialize members of the class + self.attributes = attributes + self.id = id + self.links = links + self.relationships = relationships + self.mtype = mtype + + + @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 + attributes = flowroutenumbersandmessaging.models.attributes_28.Attributes28.from_dictionary(dictionary.get("attributes")) if dictionary.get("attributes") else None + id = dictionary.get("id") + links = flowroutenumbersandmessaging.models.links.Links.from_dictionary(dictionary.get("links")) if dictionary.get("links") else None + relationships = dictionary.get("relationships") + mtype = dictionary.get("type") if dictionary.get("type") else 'number' + + # Return an object of this model + return cls(attributes, + id, + links, + relationships, + mtype) + + diff --git a/flowroutenumbersandmessaging/models/data_27.pyc b/flowroutenumbersandmessaging/models/data_27.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3b4913548d0f9b10931c0382dc376c41b2806e74 GIT binary patch literal 2670 zcm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VXYWz1jACuQR{9P3N%hZ9HKljy}a6OP_@MYUk!Z&`QljR5Nz_ lfuio?MUit&!B#Fp!`$POYHZQRzp^`y$x@p@eh>^t;YZW literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/models/data_61.py b/flowroutenumbersandmessaging/models/data_61.py new file mode 100644 index 0000000..e85c283 --- /dev/null +++ b/flowroutenumbersandmessaging/models/data_61.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.data_61 + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" +import flowroutenumbersandmessaging.models.attributes_62 + +class Data61(object): + + """Implementation of the 'Data61' model. + + TODO: type model description here. + + Attributes: + mtype (string): TODO: type description here. + attributes (Attributes62): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "mtype" : "type", + "attributes" : "attributes" + } + + def __init__(self, + mtype='route', + attributes=None): + """Constructor for the Data61 class""" + + # Initialize members of the class + self.mtype = mtype + self.attributes = attributes + + + @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 + mtype = dictionary.get("type") if dictionary.get("type") else 'route' + attributes = flowroutenumbersandmessaging.models.attributes_62.Attributes62.from_dictionary(dictionary.get("attributes")) if dictionary.get("attributes") else None + + # Return an object of this model + return cls(mtype, + attributes) + + diff --git a/flowroutenumbersandmessaging/models/delivery_receipt.py b/flowroutenumbersandmessaging/models/delivery_receipt.py new file mode 100644 index 0000000..e53c26d --- /dev/null +++ b/flowroutenumbersandmessaging/models/delivery_receipt.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.delivery_receipt + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" +from flowroutenumbersandmessaging.api_helper import APIHelper + +class DeliveryReceipt(object): + + """Implementation of the 'DeliveryReceipt' model. + + TODO: type model description here. + + Attributes: + level (int): TODO: type description here. + status (string): TODO: type description here. + status_code (int): TODO: type description here. + status_code_description (string): TODO: type description here. + timestamp (datetime): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "level" : "level", + "status" : "status", + "status_code" : "status_code", + "status_code_description" : "status_code_description", + "timestamp" : "timestamp" + } + + def __init__(self, + level=None, + status=None, + status_code=None, + status_code_description=None, + timestamp=None): + """Constructor for the DeliveryReceipt class""" + + # Initialize members of the class + self.level = level + self.status = status + self.status_code = status_code + self.status_code_description = status_code_description + self.timestamp = APIHelper.RFC3339DateTime(timestamp) if timestamp 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 + level = dictionary.get("level") + status = dictionary.get("status") + status_code = dictionary.get("status_code") + status_code_description = dictionary.get("status_code_description") + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + + # Return an object of this model + return cls(level, + status, + status_code, + status_code_description, + timestamp) + + diff --git a/flowroutenumbersandmessaging/models/delivery_receipt.pyc b/flowroutenumbersandmessaging/models/delivery_receipt.pyc new file mode 100644 index 0000000000000000000000000000000000000000..67f6ce2683e631a3b682453b1a97a1beb801237b GIT binary patch literal 2626 zcmd5;!EW0|5FLsVZ7WG*pobPcEqXD1s2Ie6ffzwi$3{>e;uN%Us0x&z$(2NfB8AU6Ho7wYi4lV^whlOuKUu=hZPYV6$19z;<(E96A4sMT(__!C#?!7sN3fkWTw za;A;D5AAsALEJcSg#^d)1jGIap@9SfhHO#M5lB4R2P}B@0SKObz=3BUK;YRQU~%*M z6VSU34LYO)$~Oc$j|LkQpM~s|{RIx5OlPH@>dGP9x>EH}xv^F|H+;7awwVEzY+solP4I5MEL@vg z6h0?785`lz!Z_knPa)oT^oA(Gq$LxmzD%IDWdgNB<`KCzO*%Zk^r%98 zH3v6%au%{pyUT{_3dxygt~P3j!4-6)fK*nd)}Dr&*dFu2nEO6%v*3_p43h4MpC0Y) z?L9gMYJH#v4~S0dO2-_A^t&usT@G(GB-_|p$ihw_qTHb6ZIneXELb6$q?N8EnMUKeDNv}Psi!Jc zd66*%q-N3Z1b6SD8Lf3cudH^VH?B^gI}X?XW%SHwB;z_S)#nqPIhEQgK4FXXxl4-* z{49QO^`UdMDblj|=^CwJ5!An96->`iw7RGI*!@y3t{Z&z;;gSg=h;}zOwGK#P*sYK z1^`msAoO+8Tk;+I5^Fa%)s2uFw-Mnj2sWKFH@az&byK(X2^Y?(v_Z_Z=D3YU+DZS! zoHEB1$3P?(X*t(Yk$+Q=dsTDY522bc#_zLthuJd>si^3)=@sW8Y z=1&Rs&3*w9+zWi)+gRS+b`!bp-Mw=f3YmV2O>PI`eKgj?CrdJx&yt3H8H=V;<#nrI XW%iLHmJB{_a`v@Q5&sYb-gfIRWKXXp literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/models/error_1.py b/flowroutenumbersandmessaging/models/error_1.py new file mode 100644 index 0000000..96a3a5e --- /dev/null +++ b/flowroutenumbersandmessaging/models/error_1.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.error_1 + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" + + +class Error1(object): + + """Implementation of the 'Error1' model. + + TODO: type model description here. + + Attributes: + id (string): TODO: type description here. + status (int): TODO: type description here. + detail (string): TODO: type description here. + title (string): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id" : "id", + "status" : "status", + "detail" : "detail", + "title" : "title" + } + + def __init__(self, + id=None, + status=None, + detail=None, + title=None): + """Constructor for the Error1 class""" + + # Initialize members of the class + self.id = id + self.status = status + self.detail = detail + self.title = title + + + @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") + detail = dictionary.get("detail") + title = dictionary.get("title") + + # Return an object of this model + return cls(id, + status, + detail, + title) + + diff --git a/flowroutenumbersandmessaging/models/error_1.pyc b/flowroutenumbersandmessaging/models/error_1.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0c2c1958188a195e5c621b84de1a7e01a8499137 GIT binary patch literal 2149 zcmd5+O>f&q5M7Fr?5b{(L(%iztQ;yfMd5=H6jhWSe27!f%Ax9kpvaN54z(n9S58%= zC#V0ZzoLJpf1q!MLL|3FkzRt5+|kZzKW5&%xAC8!4gT2v{!^iLPmJI1(7c8zm72ju ziXyd$RM}DQl)6>w$5}^}vAP;|dFF301C3`<)o)zA31m0xIXR!(a!uanOJkR#bzM^B zN90`XvL^#sFkKn17p5ZpCignugnFF^Q{+{()l0JE@<64YZ}s?xix=bR#YEqHJ^D%y z^(utMpC?J)7+EngwSGJZeMIs-AMoUTK0ORQ<0z*vgnW<&Y)6?cCx-6~Y2iCVLio-~ zjCa-94BpYf*HiDhYSvTKS7l#dh}7&zrB}ma-u;_Msf%?}(VA>P4z<9<} zEdY#miNAdQ@?3{)L+!9G$rsKvvT#L?cJsy|I5P*L{#*cKlufCJ9>aF|_*_r-8~t+& zp3RR(L>sS%#)c1FQc}oG^9)rQE}raJaE}{LpP>06 z%-cx4RVqWLBOSQ0bl`TSgCa(tDX$VjPihP3HbtnNUZ8P-+WP3C%Dul7MyDvIN_kPr za!8rwLy1NBPSxVx8JMLwEah{Uq;%$nd{QK@JhYHp=ay`3DS2KO8)k`5CXhtp*ZxaS zwj`JQn|_j3Kgmu%qh=eJcv)tw30bE3SRPQvpG5o?96sxT;}*n#6C+mk)azsA9&zUi z{+yU?`N29W2r zpjHqNykw#mu3qb0m!@FS=Wg37gZVmk%LBgi$bOa{?)xC~`0y`BjU!-rSAg~Wnu?%v z|6W17V?77KEp8WygLwe`kTZE@ez~Jx4Bn7C^%`3@pbw4o6tiE`_U?u+UR_N!E~8?l z8&@~v!dBZH_a6Wdp5YEVl=)8K97{@J!ADFwB zAYfolFDXc|#3?Et1{mBU`@i7#LxjZD$@X!LFyudnQ4da{Zu~HkH||F<-b=ZPcd}sU zvrN*;GB9pav3rD-Syt8s`pnf#DwOhY%6|A1Ms9*Ng;iaq?2D%N=HsY4#leb;;=h3D wpY-E6I+AzL*)a|NH#5HWaU0w>3y7-1^TBg*xxdyUM`{dFEtV;R{#J2 literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/models/error_84.py b/flowroutenumbersandmessaging/models/error_84.py new file mode 100644 index 0000000..6eecae6 --- /dev/null +++ b/flowroutenumbersandmessaging/models/error_84.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.error_84 + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" +import flowroutenumbersandmessaging.models.error_1 + +class Error84(object): + + """Implementation of the 'Error84' model. + + TODO: type model description here. + + Attributes: + errors (list of Error1): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "errors" : "errors" + } + + def __init__(self, + errors=None): + """Constructor for the Error84 class""" + + # Initialize members of the class + self.errors = errors + + + @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 + errors = None + if dictionary.get("errors") != None: + errors = list() + for structure in dictionary.get("errors"): + errors.append(flowroutenumbersandmessaging.models.error_1.Error1.from_dictionary(structure)) + + # Return an object of this model + return cls(errors) + + diff --git a/flowroutenumbersandmessaging/models/links.py b/flowroutenumbersandmessaging/models/links.py new file mode 100644 index 0000000..4d48afa --- /dev/null +++ b/flowroutenumbersandmessaging/models/links.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.links + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" + + +class Links(object): + + """Implementation of the 'Links' model. + + TODO: type model description here. + + Attributes: + self (string): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "self" : "self" + } + + def __init__(self): + """Constructor for the Links class""" + + # Initialize members of the class + self.self = self + + + @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 + self = dictionary.get("self") + + # Return an object of this model + return cls(self) + + diff --git a/flowroutenumbersandmessaging/models/links.pyc b/flowroutenumbersandmessaging/models/links.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28c5d7c3a20cf181ccd87887fce19ee2749a527e GIT binary patch literal 1731 zcmcgs!EO^V5OuO`+6GEFb744jdmxKI;!q((XfKs$i<0y}IINuAN#b_bUfE7dP&vUr z@GE=;Kf@0&LyQ|D zZ;Ee1d==uuuqpCL^y4*-B!_4N{lzHsdj zKA0*8V^ttrNe6P~O)0&~WKqmvf*P&#n8Roe-SK!$b?%B=Y=~h?^cMYnr_D!Y zRbYwQQ-wx@8H1l9?1tlZA@tT+bai@ox(|L{VeN(-U1n7k_D#{^BChMbRU-n+?FTd% zK!?Q`Vn-kJWN#k^%T)hJ;sXJ+D{D}ZJeo8PXt-@M*WpP6h5eX6xySt7XgXt-d1GNr zgIfumKvqcSPGU~fW3w`&m5A9m$|sWCs!Mc9mYg|aIysjbwb7Uynry~6x#WNdPh9Dq zI@CGZ66vWFpQP^GmWU;bHXxtW&8J%P1LAo0ma7HuoQfbnEsDl|I37}Q7P@ivUkeruj zcO6jbiipJy3@G{n=eH9cpY;bo*Cm@mWle?F&p}JNp9DZq0Nt`xtuAEBwe-->tp20r zx@_w3F9_D^npvy`wVH}mbrPf)w0lCD@yyBuePAanvcmZ`IhRn@Y9!YkYH){6WAxKy z8BfUNSexR({l;3f6U7@eU#OMQOw&+!nv#fS1ur=uO>>jcyv6eXdXEL{?~w^tu0%gI zd5>em9b1~axNSW;RxsX3(aMU8f}wQ&*{>9I4EUQ-^Tmj#B|T~rxRepTc8nvn|s H39aZitfSI7 literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/models/mdr_2.py b/flowroutenumbersandmessaging/models/mdr_2.py new file mode 100644 index 0000000..9064144 --- /dev/null +++ b/flowroutenumbersandmessaging/models/mdr_2.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.mdr_2 + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" +import flowroutenumbersandmessaging.models.data + +class MDR2(object): + + """Implementation of the 'MDR2' model. + + TODO: type model description here. + + Attributes: + data (Data): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "data" : "data" + } + + def __init__(self, + data=None): + """Constructor for the MDR2 class""" + + # Initialize members of the class + self.data = data + + + @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 + data = flowroutenumbersandmessaging.models.data.Data.from_dictionary(dictionary.get("data")) if dictionary.get("data") else None + + # Return an object of this model + return cls(data) + + diff --git a/flowroutenumbersandmessaging/models/mdr_2.pyc b/flowroutenumbersandmessaging/models/mdr_2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb3e2ed2819aed7de14605c64cc4321918ec68dd GIT binary patch literal 1915 zcmc&#&2HO95MGJ0oT$#vIS7hHFJ^#NEPU|6D2k}^#Rn?^tsLqeh!r`KRw0+f?#ihG z_tZQ>AEr;ym&pU9-z*i&E?OT`LOWV6XJ_Y|?;A4u_-OFg=FeYpvArVvzr=9g!W2SW z!gfT_6=g?Uc0~~hio_f%J@G+^--Y=3vd51v;yvDl1u>Ag=4JiP)@x5@UCqckWr~WN zQwwbt!>TT*bi=B!+0h`lPnX)sxh_e*Q%Q zU6uv8-0CK5Tau-%-^hEbXQ-Jw2}R*L7RoCbpTfR4k<(qE{|FHv^Paqm3_p)CLw*Ev z-4WM9WP#I*m>;{ZVaBy_-mY_BTRF#I91KI|rE+c(ci@w<30uM$j>>tvgk=%4afmCD z!s;t>NuIoMpgmbBL#8&AoYwi8i{+9r*iT&LzH?*>vdMi?Nm{8SK`O&$;~(IREYn8& zEPKX>G6=C3;6|A72ykCx0=OXZ?E_(-294r=6<7wD_NDM$v5Lg1Csuo6)o1UUr*JS3 zLRb9O<%(T*ng5HJqq|>GiLoUp5=u2vqjt*V)CvGH4k^pItt+Wyp>w8L*-fhj=5%Bi zw-^pA-+0M*w*!oiZUvB*8cQhJUBT6}73E$kccU4OSkJuD20at*v>xQh~NTblxC_oSlI`g)$x0>c$Qu1qS z{sFm78wmfUf~^?WmRbSc4#g^*#QU&8h7(B3Gb;=7{yF~d6O-@5p%qk+Ziv9G<)83Q z5SHzVAGi*o^V0bN9CpwC2jQm=k-;|@jypg+KIrtK<7g7|-L@&1jVuePW*K0vOTOh& zWm!?@m^1z?ke2eRG3CPfuV6x-SLBy<5e^Fdyfa^-vs0uYxXg}C|6xChI)mQ9e)z7W ukFn-Cq5Js#{9WPqU&>em;8tiM{0>o=eF<2Bn;%*>eq=5jSH9ml=>84ossFtI literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/models/message.py b/flowroutenumbersandmessaging/models/message.py new file mode 100644 index 0000000..380f555 --- /dev/null +++ b/flowroutenumbersandmessaging/models/message.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.message + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" + + +class Message(object): + + """Implementation of the 'Message' model. + + TODO: type model description here. + + Attributes: + mfrom (string): TODO: type description here. + to (string): TODO: type description here. + body (string): TODO: type description here. + media_urls (list of string): TODO: type description here. + is_mms (bool): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "mfrom" : "from", + "to" : "to", + "body" : "body", + "media_urls" : "media_urls", + "is_mms" : "is_mms" + } + + def __init__(self, + mfrom=None, + to=None, + body=None, + media_urls=None, + is_mms=None): + """Constructor for the Message class""" + + # Initialize members of the class + self.mfrom = mfrom + self.to = to + self.body = body + self.media_urls = media_urls + self.is_mms = is_mms + + + @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") + body = dictionary.get("body") + media_urls = dictionary.get("media_urls") + is_mms = dictionary.get("is_mms") + + # Return an object of this model + return cls(mfrom, + to, + body, + media_urls, + is_mms) + + diff --git a/flowroutenumbersandmessaging/models/message_type_enum.py b/flowroutenumbersandmessaging/models/message_type_enum.py new file mode 100644 index 0000000..03b386c --- /dev/null +++ b/flowroutenumbersandmessaging/models/message_type_enum.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.message_type_enum + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" + +class MessageTypeEnum(object): + + """Implementation of the 'MessageType' enum. + + TODO: type enum description here. + + Attributes: + LONGCODE: TODO: type description here. + TOLLFREE: TODO: type description here. + + """ + + LONGCODE = 'longcode' + + TOLLFREE = 'toll-free' + diff --git a/flowroutenumbersandmessaging/models/new_route.py b/flowroutenumbersandmessaging/models/new_route.py new file mode 100644 index 0000000..495cbb0 --- /dev/null +++ b/flowroutenumbersandmessaging/models/new_route.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.new_route + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" +import flowroutenumbersandmessaging.models.data_61 + +class NewRoute(object): + + """Implementation of the 'NewRoute' model. + + TODO: type model description here. + + Attributes: + data (Data61): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "data" : "data" + } + + def __init__(self, + data=None): + """Constructor for the NewRoute class""" + + # Initialize members of the class + self.data = data + + + @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 + data = flowroutenumbersandmessaging.models.data_61.Data61.from_dictionary(dictionary.get("data")) if dictionary.get("data") else None + + # Return an object of this model + return cls(data) + + diff --git a/flowroutenumbersandmessaging/models/number_26.py b/flowroutenumbersandmessaging/models/number_26.py new file mode 100644 index 0000000..fe5ddf4 --- /dev/null +++ b/flowroutenumbersandmessaging/models/number_26.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.number_26 + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" +import flowroutenumbersandmessaging.models.data_27 + +class Number26(object): + + """Implementation of the 'Number26' model. + + TODO: type model description here. + + Attributes: + data (Data27): TODO: type description here. + included (list of object): TODO: type description here. + + """ + + # Create a mapping from Model property names to API property names + _names = { + "data" : "data", + "included" : "included" + } + + def __init__(self, + data=None, + included=None): + """Constructor for the Number26 class""" + + # Initialize members of the class + self.data = data + self.included = included + + + @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 + data = flowroutenumbersandmessaging.models.data_27.Data27.from_dictionary(dictionary.get("data")) if dictionary.get("data") else None + included = dictionary.get("included") + + # Return an object of this model + return cls(data, + included) + + diff --git a/flowroutenumbersandmessaging/models/number_26.pyc b/flowroutenumbersandmessaging/models/number_26.pyc new file mode 100644 index 0000000000000000000000000000000000000000..048160054b8a534a443d9d94460b49b9024c44e4 GIT binary patch literal 2105 zcmc&#&5qkP5FS}x@5bFGIrY>7kwaHOTdVNF0Tw~A?(Ss|aSGWv)IA8aG`8u;lt9v( zx=2nNps&=Y$OGgx`T*?=<-cuZUKH8H+gv&9r3Q;NVEk#)1rK1%9TUCT29bdsq-aT zD`!g2I?FQ0!glJVwA*X@Eu*=zVyX%hZ=@A+<;taWDw9RA7Bkdnq{CcH)}sI8^^5-K z`cm9&%$=+3c^u11`5hfqil=S$Cp`mqLJ z9zc(BqF-+uLVo0bA-r$E_z1AIO`Z@rhGZDE*waT6*UPHFC2B`;ms*rl;pQmLw#T0d zpLl1J?#ru}=fbTktkoh%n;BL4t#dTEvFkf$)P#_<=N=|TH8x1ggkV%C>o~Y_vcSy!*M5JfYf^fAs>gHdDr2_rXwbN%VZR{pHh{MPDNP!F z;_)0tY-69WVX3V%tIU-~OldGiTZlwfNNWe)I0?u&;cXG0;X|-kOb_&=hKPmDNW{5O zH)!K5er1Vr@j`0UrN;QG%vM|$8($LhV!O28TGTn3_&%D(HBI9kO*_@vr=O-uE0?BU z^1%!Yv>pT*2g)xTtH)wO6T*U8=Jg4f$2=L*`@-XK8-Te0*MLO`izY0NV9{dh-6|Pq z;$8^v2*q0808+jS8B~Tggj?=AKGXg}SX~;V4x!G`RBP*`&akE+wUtjrOij5IQsgRQ zl1a0!naJ$uo7n-sShKeh(SA;B=^ri`tPB#EcPU>pOGvw8EPE^`PAW|d^l@<6iLGdq zEYz=eI);=tXwIx4*A=k^J7PrEuW^0X;fq(pk)W2(=AtrXg~qLgmUPb$0G?KKQyjL{ zrlUBP1l`K$zolGs@>`)O0;SJ?lvN0QGdl&@&mQxfp-G-!ss;8EBL z1`*%Jn;zmqrKyiQO)2?R!LOWtn&xFjb4Dfg^-TEVk}%U9JNK8w65YJa{bBwJ*o#kf z86*@6Fz)stiB`K6hQV>rZid0>iT@lXk4f*oCUIZ&x1YmJ)f3Ml&b_9iKV_espM9zf TeW{+;#rdA&^4DD}IBom|*~>7E literal 0 HcmV?d00001 diff --git a/flowroutenumbersandmessaging/models/number_type_enum.py b/flowroutenumbersandmessaging/models/number_type_enum.py new file mode 100644 index 0000000..3e5f80f --- /dev/null +++ b/flowroutenumbersandmessaging/models/number_type_enum.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.number_type_enum + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" + +class NumberTypeEnum(object): + + """Implementation of the 'NumberType' enum. + + TODO: type enum description here. + + Attributes: + STANDARD: TODO: type description here. + TOLLFREE: TODO: type description here. + INUM: TODO: type description here. + + """ + + STANDARD = 'standard' + + TOLLFREE = 'tollfree' + + INUM = 'inum' + diff --git a/flowroutenumbersandmessaging/models/route_type_enum.py b/flowroutenumbersandmessaging/models/route_type_enum.py new file mode 100644 index 0000000..c9c6c4a --- /dev/null +++ b/flowroutenumbersandmessaging/models/route_type_enum.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +""" + flowroutenumbersandmessaging.models.route_type_enum + + This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) +""" + +class RouteTypeEnum(object): + + """Implementation of the 'RouteType' enum. + + TODO: type enum description here. + + Attributes: + SIPREG: TODO: type description here. + HOST: TODO: type description here. + URI: TODO: type description here. + NUMBER: TODO: type description here. + + """ + + SIPREG = 'sip-reg' + + HOST = 'host' + + URI = 'uri' + + NUMBER = 'number' + diff --git a/iptables-rules.txt b/iptables-rules.txt new file mode 100644 index 0000000..fad2aeb --- /dev/null +++ b/iptables-rules.txt @@ -0,0 +1,3 @@ +iptables -A INPUT -s 52.88.246.140 -j ACCEPT +iptables -A INPUT -s 52.10.220.50 -j ACCEPT +iptables -A INPUT -p tcp --dport 8090 -j REJECT \ No newline at end of file diff --git a/smslisten.py b/smslisten.py new file mode 100644 index 0000000..5016705 --- /dev/null +++ b/smslisten.py @@ -0,0 +1,71 @@ +import os +import urllib +import requests +import json +import pprint +import time +from flask import Flask, request +from flowroutenumbersandmessaging.flowroutenumbersandmessaging_client import FlowroutenumbersandmessagingClient +import sys +reload(sys) +sys.setdefaultencoding('utf-8') + +basic_auth_user_name = os.environ.get('FR_ACCESS_KEY') +basic_auth_password = os.environ.get('FR_SECRET_KEY') + +from_number = os.environ.get('FROM_NUMBER') + +client = FlowroutenumbersandmessagingClient(basic_auth_user_name, basic_auth_password) +messages_controller = client.messages + +#Flowroute API endpoint and reply SMS to be sent +fr_api_url = "https://api.flowroute.com/v2.1/messages" +reply_message = 'Thanks for the picture!' + +app = Flask(__name__) +app.debug = True + +@app.route('/inboundsms', methods=['POST']) +def inboundsms(): + + #extract attributes from POSTed JSON of inbound MMS + json_content = request.json + reply_to = json_content['data']['attributes']['from'] + reply_from = json_content['data']['attributes']['to'] + body = json_content['data']['attributes']['body'].decode('utf-8') + + pprint.pprint(body) + + #send a reply SMS from your Flowroute number + sendreply(reply_to, from_number, "You said " + body) + file = open("sms-logs.txt","a") + + file.write(reply_to +': ' + body + "\n") + file.close() + + return '0' + +def sendreply(reply_to, reply_from, msg): + request_body = '{ \ + "data": { \ + "type": "message", \ + "attributes": { \ + "to": "' + str(reply_to) + '", \ + "from": "' + str(reply_from) + '", \ + "body": "' + msg + '", \ + "is_mms": "false" \ + } \ + } \ +}' + + print ("---Send A Message") + result = messages_controller.send_a_message(request_body) + pprint.pprint(result) + + return '0' + +if __name__ == '__main__': + app.run( + host="0.0.0.0", + port=int("8090") + ) \ No newline at end of file diff --git a/smssend.py b/smssend.py new file mode 100644 index 0000000..dd2c0c6 --- /dev/null +++ b/smssend.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +import pprint +import os +import json +import random +import string +from flowroutenumbersandmessaging.flowroutenumbersandmessaging_client import FlowroutenumbersandmessagingClient + +basic_auth_user_name = os.environ.get('FR_ACCESS_KEY') +basic_auth_password = os.environ.get('FR_SECRET_KEY') + +mobile_number = os.environ.get('TO_NUMBER') +from_number = os.environ.get('FROM_NUMBER') + +# Instantiate API client and create controllers for Messages +client = FlowroutenumbersandmessagingClient(basic_auth_user_name, basic_auth_password) +messages_controller = client.messages + +request_body = '{ \ + "data": { \ + "type": "message", \ + "attributes": { \ + "to": "' + str(mobile_number) + '", \ + "from": "' + str(from_number) + '", \ + "body": "Try me", \ + "is_mms": "false" \ + } \ + } \ +}' + +print ("---Send A Message") +result = messages_controller.send_a_message(request_body) +pprint.pprint(result) \ No newline at end of file