Add GetAccount
This commit is contained in:
parent
496b915c9d
commit
f62579ce90
@ -37,6 +37,18 @@ class OMMClient2:
|
|||||||
else:
|
else:
|
||||||
self.session = session
|
self.session = session
|
||||||
|
|
||||||
|
def get_account(self, id):
|
||||||
|
"""
|
||||||
|
Get account
|
||||||
|
|
||||||
|
:param id: User id
|
||||||
|
"""
|
||||||
|
|
||||||
|
r = self.session.request(message.GetAccount(id))
|
||||||
|
r.raise_on_error()
|
||||||
|
|
||||||
|
return r.account[0]
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
"""
|
"""
|
||||||
Is OMM still there?
|
Is OMM still there?
|
||||||
|
@ -97,10 +97,9 @@ class Response:
|
|||||||
def maxLen(self):
|
def maxLen(self):
|
||||||
return self.attrs.get("maxLen")
|
return self.attrs.get("maxLen")
|
||||||
|
|
||||||
|
from .getaccount import GetAccount, GetAccountResp
|
||||||
from .ping import Ping, PingResp
|
from .ping import Ping, PingResp
|
||||||
|
|
||||||
|
|
||||||
def construct(request):
|
def construct(request):
|
||||||
"""
|
"""
|
||||||
Builds the XML message DOM and returns as string
|
Builds the XML message DOM and returns as string
|
||||||
@ -123,6 +122,7 @@ def construct(request):
|
|||||||
|
|
||||||
def _response_type_by_name(name):
|
def _response_type_by_name(name):
|
||||||
response_types = [
|
response_types = [
|
||||||
|
GetAccountResp,
|
||||||
PingResp,
|
PingResp,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
27
mitel_ommclient2/messages/getaccount.py
Normal file
27
mitel_ommclient2/messages/getaccount.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from . import Request, Response
|
||||||
|
|
||||||
|
|
||||||
|
class GetAccount(Request):
|
||||||
|
def __init__(self, id, maxRecords=None, **kwargs):
|
||||||
|
super().__init__("GetAccount", **kwargs)
|
||||||
|
|
||||||
|
self.attrs["id"] = id
|
||||||
|
|
||||||
|
if maxRecords is not None:
|
||||||
|
self.attrs["maxRecords"] = maxRecords
|
||||||
|
|
||||||
|
@property
|
||||||
|
def id(self):
|
||||||
|
return self.attrs.get("id")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def maxRecords(self):
|
||||||
|
return self.attrs.get("maxRecords")
|
||||||
|
|
||||||
|
|
||||||
|
class GetAccountResp(Response):
|
||||||
|
@property
|
||||||
|
def account(self):
|
||||||
|
return self.attrs.get("account")
|
Loading…
Reference in New Issue
Block a user