Commit 32f7e8ba authored by Jo Sama's avatar Jo Sama 😱
Browse files

Aloow fetching operator(s) by username or UUID

parent 01988578
......@@ -87,9 +87,16 @@ class TopDeskClient:
def patch(self, url, **kwargs):
return self.call('PATCH', url, **kwargs)
def get_operator(self, identity):
url = self.urls.get_operator(identity)
return Operator.from_dict(self.get(url))
def get_operator(self, identity=None, username=None):
if identity:
url = self.urls.get_operator(identity)
return Operator.from_dict(self.get(url))
elif username:
url = self.urls.get_operators()
for x in self.get(url, params={'topdesk_login_name': username}):
yield Operator.from_dict(x)
else:
raise ValueError('identity or username must be set')
def create_operator(self, operator):
url = self.urls.get_operators()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment