diff --git a/templates/endpoint.j2 b/templates/endpoint.j2 index 9dc53f1..f9268ed 100644 --- a/templates/endpoint.j2 +++ b/templates/endpoint.j2 @@ -4,4 +4,4 @@ class {{class_name}}(): self.base = base def fetch(self, params={}): - return self.base.request(self.method) \ No newline at end of file + return self.base.request(self.method, params=params) \ No newline at end of file diff --git a/templates/method_generator.py b/templates/method_generator.py index 6a7ebe3..082347f 100644 --- a/templates/method_generator.py +++ b/templates/method_generator.py @@ -7,8 +7,8 @@ print("Which category does this endpoint fall under?") subdir_index = int(input("1: accounts, 2: call_detail_records, 3: dids, 4: general, 5: voicemail: ")) subdir = ("accounts", "call_detail_records", "dids", "general", "voicemail")[subdir_index - 1] -endpoint = "getCountries" -method = "countries" +endpoint = "getLanguages" +method = "languages" filename = "../voipms/api/{}/{}.py".format(subdir, method) @@ -45,8 +45,6 @@ for k, v in enumerate(contents): pos = k break -print(pos) - for k, v in enumerate(contents[pos+2:], pos+2): if v == "\n": contents.insert(k, output_init + "\n") diff --git a/voipms/api/__init__.py b/voipms/api/__init__.py index 129a06e..a57af24 100644 --- a/voipms/api/__init__.py +++ b/voipms/api/__init__.py @@ -90,4 +90,8 @@ class Client(object): @property def countries(self): - return self.general.countries \ No newline at end of file + return self.general.countries + + @property + def languages(self): + return self.general.languages \ No newline at end of file diff --git a/voipms/api/general/__init__.py b/voipms/api/general/__init__.py index 5f7e5e8..ddd3b34 100644 --- a/voipms/api/general/__init__.py +++ b/voipms/api/general/__init__.py @@ -2,6 +2,7 @@ from voipms.api.general.balance import Balance from voipms.api.general.ip import IP from voipms.api.general.transaction_history import TransactionHistory from voipms.api.general.countries import Countries +from voipms.api.general.languages import Languages class General(): def __init__(self, base): @@ -9,6 +10,7 @@ class General(): self._ip = None self._transaction_history = None self._countries = None + self._languages = None self.base = base @@ -34,4 +36,10 @@ class General(): def countries(self): if self._countries is None: self._countries = Countries(self.base) - return self._countries \ No newline at end of file + return self._countries + + @property + def languages(self): + if self._languages is None: + self._languages = Languages(self.base) + return self._languages \ No newline at end of file diff --git a/voipms/api/general/balance.py b/voipms/api/general/balance.py index 4738402..e6f5f35 100644 --- a/voipms/api/general/balance.py +++ b/voipms/api/general/balance.py @@ -4,4 +4,4 @@ class Balance(): self.base = base def fetch(self, params={}): - return self.base.request(self.method) \ No newline at end of file + return self.base.request(self.method, params=params) \ No newline at end of file diff --git a/voipms/api/general/countries.py b/voipms/api/general/countries.py index 843369e..e1eb06e 100644 --- a/voipms/api/general/countries.py +++ b/voipms/api/general/countries.py @@ -4,4 +4,4 @@ class Countries(): self.base = base def fetch(self, params={}): - return self.base.request(self.method) \ No newline at end of file + return self.base.request(self.method, params=params) \ No newline at end of file diff --git a/voipms/api/general/ip.py b/voipms/api/general/ip.py index 09bfa06..28b02fe 100644 --- a/voipms/api/general/ip.py +++ b/voipms/api/general/ip.py @@ -4,4 +4,4 @@ class IP(): self.base = base def fetch(self, params={}): - return self.base.request(self.method) \ No newline at end of file + return self.base.request(self.method, params=params) \ No newline at end of file diff --git a/voipms/api/general/languages.py b/voipms/api/general/languages.py new file mode 100644 index 0000000..6040cf9 --- /dev/null +++ b/voipms/api/general/languages.py @@ -0,0 +1,7 @@ +class Languages(): + def __init__(self, base): + self.method = "getLanguages" + self.base = base + + def fetch(self, params={}): + return self.base.request(self.method, params=params) \ No newline at end of file diff --git a/voipms/api/general/transaction_history.py b/voipms/api/general/transaction_history.py index 1165f31..05f43f7 100644 --- a/voipms/api/general/transaction_history.py +++ b/voipms/api/general/transaction_history.py @@ -4,4 +4,4 @@ class TransactionHistory(): self.base = base def fetch(self, params={}): - return self.base.request(self.method) \ No newline at end of file + return self.base.request(self.method, params=params) \ No newline at end of file