Skip to content

Commit

Permalink
Merge pull request #92 from livechat/API-11633-lc-sdk-py-add-bot-batc…
Browse files Browse the repository at this point in the history
…h-actions

API-11633 Added Bot batch actions
  • Loading branch information
kacperf531 authored Nov 23, 2022
2 parents eb0b9d6 + 7c1a96c commit 8a047ba
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
7 changes: 6 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log
All notable changes to this project will be documented in this file.

## [0.3.5] - TBA

### Added
- Support for new batch methods in configuration-api v3.5: `batch_create_bots`, `batch_delete_bots`, `batch_update_bots`.

## [0.3.4] - 2022-10-26

### Added
Expand All @@ -24,7 +29,7 @@ All notable changes to this project will be documented in this file.
## [0.3.3] - 2022-07-20

### Added
- Support fo new batch methods in configuration-api v3.5: `batch_create_agents`, `batch_delete_agents`, `batch_update_agents`, `batch_approve_agents`, `batch_suspend_agents`, `batch_unsuspend_agents`.
- Support for new batch methods in configuration-api v3.5: `batch_create_agents`, `batch_delete_agents`, `batch_update_agents`, `batch_approve_agents`, `batch_suspend_agents`, `batch_unsuspend_agents`.

### Changed
- Updated requirements.txt.
Expand Down
57 changes: 57 additions & 0 deletions livechat/configuration/api/v35.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,3 +1426,60 @@ def batch_unsuspend_agents(self,
return self.session.post(f'{self.api_url}/batch_unsuspend_agents',
json=payload,
headers=headers)

def batch_create_bots(self,
requests: list = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
''' Batch method for `create_bot`.
Args:
requests (list): Array of Request objects of corresponding non-batch method.
Returns:
httpx.Response: The Response object from `httpx` library,
which contains a server's response to an HTTP request.
'''
if payload is None:
payload = prepare_payload(locals())
return self.session.post(f'{self.api_url}/batch_create_bots',
json=payload,
headers=headers)

def batch_delete_bots(self,
requests: list = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
''' Batch method for `delete_bot`.
Args:
requests (list): Array of Request objects of corresponding non-batch method.
Returns:
httpx.Response: The Response object from `httpx` library,
which contains a server's response to an HTTP request.
'''
if payload is None:
payload = prepare_payload(locals())
return self.session.post(f'{self.api_url}/batch_delete_bots',
json=payload,
headers=headers)

def batch_update_bots(self,
requests: list = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
''' Batch method for `update_bot`.
Args:
requests (list): Array of Request objects of corresponding non-batch method.
Returns:
httpx.Response: The Response object from `httpx` library,
which contains a server's response to an HTTP request.
'''
if payload is None:
payload = prepare_payload(locals())
return self.session.post(f'{self.api_url}/batch_update_bots',
json=payload,
headers=headers)

0 comments on commit 8a047ba

Please sign in to comment.