From 0a442e4ab56d72bd8dc19dfc3038347cea1f3dd7 Mon Sep 17 00:00:00 2001 From: clerie Date: Mon, 2 May 2022 00:41:46 +0200 Subject: [PATCH] Add child typing to all other existing message types --- mitel_ommclient2/client.py | 2 +- mitel_ommclient2/messages/getaccount.py | 3 +- mitel_ommclient2/messages/getppdev.py | 3 +- mitel_ommclient2/types/__init__.py | 43 +++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/mitel_ommclient2/client.py b/mitel_ommclient2/client.py index fe393f9..c24a61d 100644 --- a/mitel_ommclient2/client.py +++ b/mitel_ommclient2/client.py @@ -102,7 +102,7 @@ class OMMClient2: yield pp # Determine next possible ppn - next_ppn = int(pp["ppn"]) + 1 + next_ppn = int(pp.ppn) + 1 def get_user(self, uid): """ diff --git a/mitel_ommclient2/messages/getaccount.py b/mitel_ommclient2/messages/getaccount.py index 839e784..52d219d 100644 --- a/mitel_ommclient2/messages/getaccount.py +++ b/mitel_ommclient2/messages/getaccount.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 from . import Request, Response, request_type, response_type +from ..types import AccountType @request_type @@ -14,5 +15,5 @@ class GetAccount(Request): @response_type class GetAccountResp(Response): CHILDS = { - "account": None, + "account": AccountType, } diff --git a/mitel_ommclient2/messages/getppdev.py b/mitel_ommclient2/messages/getppdev.py index 322bead..61c0e4d 100644 --- a/mitel_ommclient2/messages/getppdev.py +++ b/mitel_ommclient2/messages/getppdev.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 from . import Request, Response, request_type, response_type +from ..types import PPDevType @request_type @@ -14,5 +15,5 @@ class GetPPDev(Request): @response_type class GetPPDevResp(Response): CHILDS = { - "pp": None, + "pp": PPDevType, } diff --git a/mitel_ommclient2/types/__init__.py b/mitel_ommclient2/types/__init__.py index 87f7177..c6041dc 100644 --- a/mitel_ommclient2/types/__init__.py +++ b/mitel_ommclient2/types/__init__.py @@ -79,6 +79,10 @@ class CallForwardStateType(EnumType): ] +class DECTSubscriptionStateType(EnumType): + VALUES = None + + class LanguageType(EnumType): VALUES = None @@ -91,6 +95,45 @@ class PPRelTypeType(EnumType): VALUES = None +class AccountType(ChildType): + FIELDS = { + "id": int, + "username": str, + "password": str, + "oldPassword": str, + "permission": None, + "active": bool, + "aging": None, + "expire": int, + "state": str, + } + + +class PPDevType(ChildType): + FIELDS = { + "ppn": int, + "timeStamp": int, + "relType": PPRelTypeType, + "uid": int, + "ipei": str, + "ac": str, + "s": DECTSubscriptionStateType, + "uak": str, + "encrypt": bool, + "capMessaging": bool, + "capMessagingForInternalUse": bool, + "capEnhLocating": bool, + "capBluetooth": bool, + "ethAddr": str, + "hwType": str, + "ppProfileCapability": bool, + "ppDefaultProfileLoaded": bool, + "subscribeToPARIOnly": bool, + # undocumented + "ppnSec": int, + } + + class PPUserType(ChildType): FIELDS = { "uid": int,