Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
it-bott-integrasjoner
topdesk-client
Commits
ae23571c
Commit
ae23571c
authored
Nov 21, 2019
by
Jo Sama
😱
Browse files
Return Operator from {create,update}_operator()
parent
59afded1
Changes
1
Hide whitespace changes
Inline
Side-by-side
topdesk_client/client.py
View file @
ae23571c
...
...
@@ -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
()):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment