Compare commits

..

No commits in common. "bd68cbd7d8bdc8d057f0f2c7798cf040d5cc7b5f" and "cf3c16c66a670bba89b71444d02a669ec9876c0d" have entirely different histories.

11 changed files with 74 additions and 166 deletions

View File

@ -1,7 +0,0 @@
mitel\_ommclient2.client module
===============================
.. automodule:: mitel_ommclient2.client
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,7 +0,0 @@
mitel\_ommclient2.connection module
===================================
.. automodule:: mitel_ommclient2.connection
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,7 +0,0 @@
mitel\_ommclient2.exceptions module
===================================
.. automodule:: mitel_ommclient2.exceptions
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,32 +1,53 @@
mitel\_ommclient2.messages package mitel\_ommclient2.messages package
================================== ==================================
.. automodule:: mitel_ommclient2.messages Submodules
:members: ----------
:undoc-members:
:show-inheritance: mitel\_ommclient2.messages.getaccount module
--------------------------------------------
.. automodule:: mitel_ommclient2.messages.getaccount .. automodule:: mitel_ommclient2.messages.getaccount
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
mitel\_ommclient2.messages.getppdev module
------------------------------------------
.. automodule:: mitel_ommclient2.messages.getppdev .. automodule:: mitel_ommclient2.messages.getppdev
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
mitel\_ommclient2.messages.getppuser module
-------------------------------------------
.. automodule:: mitel_ommclient2.messages.getppuser .. automodule:: mitel_ommclient2.messages.getppuser
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
mitel\_ommclient2.messages.open module
--------------------------------------
.. automodule:: mitel_ommclient2.messages.open .. automodule:: mitel_ommclient2.messages.open
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
mitel\_ommclient2.messages.ping module
--------------------------------------
.. automodule:: mitel_ommclient2.messages.ping .. automodule:: mitel_ommclient2.messages.ping
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
Module contents
---------------
.. automodule:: mitel_ommclient2.messages
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,45 @@
mitel\_ommclient2 package
=========================
Subpackages
-----------
.. toctree::
:maxdepth: 4
mitel_ommclient2.messages
Submodules
----------
mitel\_ommclient2.client module
-------------------------------
.. automodule:: mitel_ommclient2.client
:members:
:undoc-members:
:show-inheritance:
mitel\_ommclient2.connection module
-----------------------------------
.. automodule:: mitel_ommclient2.connection
:members:
:undoc-members:
:show-inheritance:
mitel\_ommclient2.exceptions module
-----------------------------------
.. automodule:: mitel_ommclient2.exceptions
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: mitel_ommclient2
:members:
:undoc-members:
:show-inheritance:

View File

@ -6,7 +6,4 @@ API Documentation
.. toctree:: .. toctree::
:maxdepth: 4 :maxdepth: 4
client mitel_ommclient2
connection
exceptions
messages

View File

@ -14,7 +14,7 @@ This is the documentation for mitel_ommclient2. To get started stick to the :doc
manual/client manual/client
manual/connection manual/connection
manual/messages manual/messages
api/index api/modules
Indices and tables Indices and tables
================== ==================

View File

@ -139,7 +139,7 @@ class OMMClient2:
yield user yield user
# Determine next possible ppn # Determine next possible ppn
next_uid = int(user.uid) + 1 next_uid = int(user["uid"]) + 1
def ping(self): def ping(self):
""" """

View File

@ -3,7 +3,6 @@
from xml.dom.minidom import getDOMImplementation, parseString from xml.dom.minidom import getDOMImplementation, parseString
from ..exceptions import exception_classes, OMResponseException from ..exceptions import exception_classes, OMResponseException
from ..types import cast_dict_to_childtype
class Message: class Message:
@ -75,9 +74,6 @@ class Message:
else: else:
object.__setattr__(self, name, value) object.__setattr__(self, name, value)
def __repr__(self):
return "{}({}, {}, {})".format(self.__class__.__name__, self.name, repr(self._attrs), repr(self._childs))
class Request(Message): class Request(Message):
""" """
@ -183,11 +179,6 @@ def parse(message):
new_child[item.name] = item.value new_child[item.name] = item.value
childname = child.tagName childname = child.tagName
# cast dict into child type
if response_type.CHILDS.get(childname) is not None:
new_child = cast_dict_to_childtype(response_type.CHILDS[childname], new_child)
if childname in childs: if childname in childs:
childs[childname].append(new_child) childs[childname].append(new_child)
else: else:

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from . import Request, Response, request_type, response_type from . import Request, Response, request_type, response_type
from ..types import PPUserType
@request_type @request_type
@ -15,5 +14,5 @@ class GetPPUser(Request):
@response_type @response_type
class GetPPUserResp(Response): class GetPPUserResp(Response):
CHILDS = { CHILDS = {
"user": PPUserType, "user": None,
} }

View File

@ -1,124 +0,0 @@
#!/usr/bin/env python3
class ChildType:
"""
Base type class
:param name: Name of the message
:param attrs: Message attributes
:param childs: Message children
"""
FIELDS = {}
def __init__(self, attrs={}):
self._attrs = {}
for k, v in attrs.items():
setattr(self, k, v)
def __getattr__(self, name):
if name in self.FIELDS.keys():
return self._attrs.get(name)
else:
raise AttributeError()
def __setattr__(self, name, value):
if name in self.FIELDS.keys():
if self.FIELDS[name] is not None and type(value) != self.FIELDS[name]:
raise TypeError()
self._attrs[name] = value
else:
object.__setattr__(self, name, value)
def __repr__(self):
return "{}({})".format(self.__class__.__name__, repr(self._attrs))
def cast_dict_to_childtype(t, d):
for k, v in d.items():
if k in t.FIELDS.keys():
if t.FIELDS[k] is not None and type(v) != t.FIELDS[k]:
d[k] = t.FIELDS[k](v)
else:
raise KeyError()
return t(d)
class PPUserType(ChildType):
FIELDS = {
"uid": int,
"timeStamp": int,
"relType": None, #PPRelTypeType,
"ppn": int,
"name": str,
"num": str,
"hierarchy1": str,
"hierarchy2": str,
"addId": str,
"pin": str,
"sipAuthId": str,
"sipPw": str,
"sosNum": str,
"voiceboxNum": str,
"manDownNum": str,
"forwardStateCall": None, #ForwardStateType,
"forwardTime": int,
"forwardDest": str,
"langPP": None, #LanguageType,
"holdRingBackTime": int,
"autoAnswer": str,
"microphoneMute": str,
"warningTone": str,
"allowBargeIn": str,
"callWaitingDisabled": bool,
"external": bool,
"trackingActive": bool,
"locatable": bool,
"BTlocatable": bool,
"BTsensitivity": str,
"locRight": bool,
"msgRight": bool,
"sendVcardRight": bool,
"recvVcardRight": bool,
"keepLocalPB": bool,
"vip": bool,
"sipRegisterCheck": bool,
"allowVideoStream": bool,
"conferenceServerType": str,
"conferenceServerURI": str,
"monitoringMode": str,
"CUS": None, #MonitoringStateType,
"HAS": None, #MonitoringStateType,
"HSS": None, #MonitoringStateType,
"HRS": None, #MonitoringStateType,
"HCS": None, #MonitoringStateType,
"SRS": None, #MonitoringStateType,
"SCS": None, #MonitoringStateType,
"CDS": None, #MonitoringStateType,
"HBS": None, #MonitoringStateType,
"BTS": None, #MonitoringStateType,
"SWS": None, #MonitoringStateType,
"credentialPw": str,
"configurationDataLoaded": bool,
"ppData": str,
"ppProfileId": int,
"fixedSipPort": int,
"calculatedSipPort": int,
# undocumented
"uidSec": int,
"permanent": bool,
"lang": None,
"forwardState": None,
"autoLogoutOnCharge": bool,
"hotDeskingSupport": bool,
"authenticateLogout": bool,
"useSIPUserName": None,
"useSIPUserAuthentication": None,
"serviceUserName": None,
"serviceAuthName": None,
"serviceAuthPassword": None,
"keyLockEnable": None,
"keyLockPin": None,
"keyLockTime": None,
}