Skip to content

Commit 293c2fb

Browse files
author
skamieniarz
committed
LC-1065: Add support for agent_id param in logout method
1 parent 6c3c853 commit 293c2fb

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ All notable changes to this project will be documented in this file.
44
## [0.3.8] - TBA
55

66
### Added
7-
- Support for `logout` method in agent-api v3.6 class.
7+
- Support for `logout` method in agent-api v3.6 web class.
8+
- Support for `agent_id` parameter in agent-api v3.6 `logout` method.
89

910
### Changed
1011
- Implemented truncation of request params in logging for large data.

livechat/agent/rtm/api/v36.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,11 @@ def send_event(self,
344344
opts['author_id'] = author_id
345345
if payload is None:
346346
payload = prepare_payload(locals())
347-
return self.ws.send({'action': 'send_event', 'payload': payload, **opts})
347+
return self.ws.send({
348+
'action': 'send_event',
349+
'payload': payload,
350+
**opts
351+
})
348352

349353
def send_rich_message_postback(self,
350354
chat_id: str = None,
@@ -810,21 +814,23 @@ def set_away_status(self,
810814
payload = prepare_payload(locals())
811815
return self.ws.send({'action': 'set_away_status', 'payload': payload})
812816

813-
def logout(self, payload: dict = None) -> RtmResponse:
814-
''' Logs out agent.
817+
def logout(self,
818+
agent_id: str = None,
819+
payload: dict = None) -> RtmResponse:
820+
''' Logs the Agent out.
815821
816822
Args:
823+
agent_id (str): Login of the agent to logout.
817824
payload (dict): Custom payload to be used as request's data.
818825
It overrides all other parameters provided for the method.
819826
820827
Returns:
821828
RtmResponse: RTM response structure (`request_id`, `action`,
822829
`type`, `success` and `payload` properties)
823830
'''
824-
return self.ws.send({
825-
'action': 'logout',
826-
'payload': {} if payload is None else payload
827-
})
831+
if payload is None:
832+
payload = prepare_payload(locals())
833+
return self.ws.send({'action': 'logout', 'payload': payload})
828834

829835
def list_routing_statuses(self,
830836
filters: dict = None,

0 commit comments

Comments
 (0)