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
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 = ("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")

View File

@ -91,3 +91,7 @@ class Client(object):
@property
def countries(self):
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.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
@ -35,3 +37,9 @@ class General():
if self._countries is None:
self._countries = Countries(self.base)
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
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
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
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
def fetch(self, params={}):
return self.base.request(self.method)
return self.base.request(self.method, params=params)