Commit ae23571c authored by Jo Sama's avatar Jo Sama 😱
Browse files

Return Operator from {create,update}_operator()

parent 59afded1
......@@ -238,18 +238,26 @@ class TopDeskClient:
# TODO: Remove password setting when proper auth arrives
op = operator.copy()
op.password = uuid.uuid4()
return self.post(url,
return_response=True,
data=op.json())
r = self.post(url,
return_response=True,
data=op.json())
if r.status_code == 201:
return Operator.from_dict(r.json())
else:
return None
def update_operator(self, operator):
url = self.urls.get_operator(operator.id)
# TODO: Remove password setting when proper auth arrives
op = operator.copy()
op.password = uuid.uuid4()
return self.patch(url,
return_response=True,
data=op.json())
r = self.patch(url,
return_response=True,
data=op.json())
if r.status_code == 200:
return Operator.from_dict(r.json())
else:
return None
def list_operators(self):
for x in self.get(self.urls.get_operators()):
......
Markdown is supported
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