added more endpoints

This commit is contained in:
Daniel 2019-08-18 22:02:13 -04:00
parent 25e0635db8
commit 599ea9163c
9 changed files with 28 additions and 11 deletions

View File

@ -4,4 +4,4 @@ class {{class_name}}():
self.base = base self.base = base
def fetch(self, params={}): def fetch(self, params={}):
return self.base.request(self.method) return self.base.request(self.method, params=params)

View File

@ -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_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] subdir = ("accounts", "call_detail_records", "dids", "general", "voicemail")[subdir_index - 1]
endpoint = "getCountries" endpoint = "getLanguages"
method = "countries" method = "languages"
filename = "../voipms/api/{}/{}.py".format(subdir, method) filename = "../voipms/api/{}/{}.py".format(subdir, method)
@ -45,8 +45,6 @@ for k, v in enumerate(contents):
pos = k pos = k
break break
print(pos)
for k, v in enumerate(contents[pos+2:], pos+2): for k, v in enumerate(contents[pos+2:], pos+2):
if v == "\n": if v == "\n":
contents.insert(k, output_init + "\n") contents.insert(k, output_init + "\n")

View File

@ -90,4 +90,8 @@ class Client(object):
@property @property
def countries(self): def countries(self):
return self.general.countries return self.general.countries
@property
def languages(self):
return self.general.languages

View File

@ -2,6 +2,7 @@ from voipms.api.general.balance import Balance
from voipms.api.general.ip import IP from voipms.api.general.ip import IP
from voipms.api.general.transaction_history import TransactionHistory from voipms.api.general.transaction_history import TransactionHistory
from voipms.api.general.countries import Countries from voipms.api.general.countries import Countries
from voipms.api.general.languages import Languages
class General(): class General():
def __init__(self, base): def __init__(self, base):
@ -9,6 +10,7 @@ class General():
self._ip = None self._ip = None
self._transaction_history = None self._transaction_history = None
self._countries = None self._countries = None
self._languages = None
self.base = base self.base = base
@ -34,4 +36,10 @@ class General():
def countries(self): def countries(self):
if self._countries is None: if self._countries is None:
self._countries = Countries(self.base) self._countries = Countries(self.base)
return self._countries return self._countries
@property
def languages(self):
if self._languages is None:
self._languages = Languages(self.base)
return self._languages

View File

@ -4,4 +4,4 @@ class Balance():
self.base = base self.base = base
def fetch(self, params={}): def fetch(self, params={}):
return self.base.request(self.method) return self.base.request(self.method, params=params)

View File

@ -4,4 +4,4 @@ class Countries():
self.base = base self.base = base
def fetch(self, params={}): def fetch(self, params={}):
return self.base.request(self.method) return self.base.request(self.method, params=params)

View File

@ -4,4 +4,4 @@ class IP():
self.base = base self.base = base
def fetch(self, params={}): def fetch(self, params={}):
return self.base.request(self.method) return self.base.request(self.method, params=params)

View File

@ -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)

View File

@ -4,4 +4,4 @@ class TransactionHistory():
self.base = base self.base = base
def fetch(self, params={}): def fetch(self, params={}):
return self.base.request(self.method) return self.base.request(self.method, params=params)