diff --git a/changelog.md b/changelog.md index 3bd3bc8..7fb549c 100644 --- a/changelog.md +++ b/changelog.md @@ -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 @@ -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. diff --git a/livechat/configuration/api/v35.py b/livechat/configuration/api/v35.py index 02121b3..47bf25e 100644 --- a/livechat/configuration/api/v35.py +++ b/livechat/configuration/api/v35.py @@ -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)