Add CreatePPUser message
This commit is contained in:
parent
428c4b8661
commit
deba76228b
@ -52,6 +52,23 @@ class OMMClient2:
|
||||
r = self.connection.request(m)
|
||||
r.raise_on_error()
|
||||
|
||||
def create_user(self, num):
|
||||
"""
|
||||
Create PP user
|
||||
|
||||
:param num: User number
|
||||
"""
|
||||
t = types.PPUserType()
|
||||
t.num = num
|
||||
m = messages.CreatePPUser()
|
||||
m.childs.user = [t]
|
||||
r = self.connection.request(m)
|
||||
r.raise_on_error()
|
||||
if r.childs.user is None:
|
||||
return None
|
||||
return r.childs.user[0]
|
||||
|
||||
|
||||
def get_account(self, id):
|
||||
"""
|
||||
Get account
|
||||
|
@ -134,6 +134,7 @@ def response_type(c):
|
||||
RESPONSE_TYPES[c.__name__] = c
|
||||
return c
|
||||
|
||||
from .createppuser import CreatePPUser, CreatePPUserResp
|
||||
from .getaccount import GetAccount, GetAccountResp
|
||||
from .getppdev import GetPPDev, GetPPDevResp
|
||||
from .getppuser import GetPPUser, GetPPUserResp
|
||||
|
18
mitel_ommclient2/messages/createppuser.py
Normal file
18
mitel_ommclient2/messages/createppuser.py
Normal file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from . import Request, Response, request_type, response_type
|
||||
from ..types import PPUserType
|
||||
|
||||
|
||||
@request_type
|
||||
class CreatePPUser(Request):
|
||||
CHILDS = {
|
||||
"user": PPUserType,
|
||||
}
|
||||
|
||||
|
||||
@response_type
|
||||
class CreatePPUserResp(Response):
|
||||
CHILDS = {
|
||||
"user": PPUserType,
|
||||
}
|
4
ommcli
4
ommcli
@ -68,6 +68,10 @@ if __name__ == "__main__":
|
||||
parser_exit = subparsers.add_parser("exit")
|
||||
parser_exit.set_defaults(func=exit)
|
||||
|
||||
parser_get_account = subparsers.add_parser("create_user")
|
||||
parser_get_account.add_argument("num")
|
||||
parser_get_account.set_defaults(func=c.create_user, format=format_child_type)
|
||||
|
||||
parser_get_account = subparsers.add_parser("get_account")
|
||||
parser_get_account.add_argument("id", type=int)
|
||||
parser_get_account.set_defaults(func=c.get_account, format=format_child_type)
|
||||
|
Loading…
Reference in New Issue
Block a user