Skip to content

Commit

Permalink
Merge pull request #137 from livechat/LC-2534-add-new-ban-methods
Browse files Browse the repository at this point in the history
LC-2534: Add new ban methods to conf-api v3.6
  • Loading branch information
skamieniarz authored Aug 2, 2024
2 parents f9b4673 + 55e5135 commit 6d6fc59
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
## [0.4.0] - TBA

### Added
- New `get_company_details` method in configuration-api v3.6.
- New `get_company_details`, `list_customer_bans` and `unban_customer` methods in configuration-api v3.6.
- Added `response_timeout` parameter in `open_connection` methods.
- New `get_license_info` method in agent-api v3.5.

Expand Down
44 changes: 44 additions & 0 deletions livechat/configuration/api/v36.py
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,50 @@ def get_company_details(self,
json=payload,
headers=headers)

def list_customer_bans(self,
payload: dict = None,
headers: dict = None) -> httpx.Response:
''' Lists banned customers.
Args:
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
headers (dict): Custom headers to be used with session headers.
They will be merged with session-level values that are set,
however, these method-level parameters will not be persisted across requests.
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}/list_customer_bans',
json=payload,
headers=headers)

def unban_customer(self,
ip: str = None,
customer_id: str = None,
payload: dict = None,
headers: dict = None) -> httpx.Response:
''' Unbans customer with provided IP or ID.
Args:
ip (str): IP address of the customer to be unbanned.
customer_id (str): ID of the customer to be unbanned.
payload (dict): Custom payload to be used as request's data.
It overrides all other parameters provided for the method.
headers (dict): Custom headers to be used with session headers.
They will be merged with session-level values that are set,
however, these method-level parameters will not be persisted across requests.
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}/unban_customer',
json=payload,
headers=headers)


# Batch requests

Expand Down

0 comments on commit 6d6fc59

Please sign in to comment.